Can’t get video meta from wp_read_video_metadata()

This is what I’m doing:

$video_url = get_field(‘video_file’, $post->ID);
$uploads = wp_upload_dir();
$uploads_dir = ( $uploads[‘basedir’] . $uploads[‘subdir’] );
$file = $uploads_dir .’/’. basename($video_url);
$metadata = wp_read_video_metadata( $file );

The $video_url is giving me a URL to video file: http://example.com/wp-content/uploads/2018/03/video.mp4

When I var_dump() the $metadata I’m getting bool(false).
The video file exists, it’s accessible through URL. I need to get video meta, please help.

EDIT: I have require_once( ABSPATH . ‘wp-admin/includes/media.php’ ); on my custom page and I’m using ACF to get video URL.

Read more here:: Can’t get video meta from wp_read_video_metadata()

Leave a Reply

Your email address will not be published. Required fields are marked *