When uploading files of type video/mp4, fprobe (see Files.php#L299) seems to not extrude width/height and metadata from the file, resulting in empty fields (width/height) inside the CMS.
<VirtualHost *:80>
DocumentRoot "path/to/directus/public/"
ServerName api
<Directory "/">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
post_max_size=200M and upload_max_filesize=200M in php.iniffprobe should extract meta data (width/height) of the video.
width/height are empty
I was able to fix it by downloading ffmpeg from here: https://ffmpeg.zeranoe.com/builds/, put it into E:\\XAMPP\\ffmpeg\\ffprobe.exe and replace the code in Files.php with:
# Updates for file meta data tags
$script = "E:\\XAMPP\\ffmpeg\\ffprobe.exe";
if (strpos($fileData['type'],'video') !== false) {
#use ffprobe on local file, can't stream data to it or reference
$output = shell_exec("{$script} {$tmp} -show_entries format=duration:stream=height,width -v quiet -of json");
#echo($output);
$media = json_decode($output);
$width = $media->streams[0]->width;
$height = $media->streams[0]->height;
$duration = $media->format->duration; #seconds
} elseif (strpos($fileData['type'],'audio') !== false) {
$output = shell_exec("{$script} {$tmp} -show_entries format=duration -v quiet -of json");
$media = json_decode($output);
$duration = $media->format->duration;
}
Maybe I did just setup my XAMPP/ffmpeg wrong?
@guidoschmidt - You don't need to pass the hardcoded path for ffprobe.exe. Just set it into your environment variables. You can check here for more details.
Hey @bjgajjar thanks for the hint. Actually that was what I was trying. But now as I think about it, I only added it to PATH (User variables) but maybe I should have added it to Path (System variables). I'll give it a try ๐
@guidoschmidt - May I have an update for this?
Hey @bjgajjar, thanks for the reminder.
Just tested it with a fresh git clone of the directus suite and proper Path variable that contains ffmpeg: works right out of the box ๐ โค๏ธ
btw. we've been using Directus at the IAA in Frankfurt last week as a content management for a realtime newsfeed system and really liked it, keep up the good work ๐ช
Hey @guidoschmidt โ glad things are working for you now. Also, as the project lead for Directus, I'm always interested in learning more about how devs are using OSS Directus. Since we don't track any info, we don't know all the cool projects Directs is used in! Feel free to hit me up on Slack, I'd love to do a small case-study post on how IAA is using Directus. ๐
Most helpful comment
Hey @bjgajjar, thanks for the reminder.
Just tested it with a fresh
git cloneof the directus suite and proper Path variable that contains ffmpeg: works right out of the box ๐ โค๏ธbtw. we've been using Directus at the IAA in Frankfurt last week as a content management for a realtime newsfeed system and really liked it, keep up the good work ๐ช