I’ve been exploring how to generate videos on the fly through use of packages like ffmpeg (I installed this the other day), and recently tried out ClipBucket (a free video site script).
ClipBucket is a little rough around the edges, but has a load of great features, has a relatively active community, and large parts of the code are on GitHub.
It’s easy to setup, but I wasn’t getting thumbnails through ffmpeg for any of the uploaded videos. Instead I was getting:
Response : Oops ! Not Found.. See log Command : /usr/bin/ffmpeg -ss -i /var/www/html/files/... Invalid duration specification for ss: -i
Searching the web returned no results, so I’m posting this as a record.
The culprit was the casting of time, which is used when a duration is available.
It uses the following line in ffmpeg.class.php:
$d = new DateTime($d_formatted);
And on my server, this threw an invisible exception:
DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.
The DateTime construct gets rather unhappy when it doesn’t have a default timezone, and it turns out I’d neglected to put a default timezone in PHP.ini. Just a quick change in PHP.ini to:
date.timezone = Europe/London
Restart Apache and we’re good to go. Oops.
Another option for this is to set the timezone in the PHP code, but it should still be set at the server level:
$d = new DateTime($d_formatted, new DateTimeZone('Europe/London'));