I am working with PHP. I want to find a way to upload a maximum of 30 second video clips on upload. How to check that the uploaded video duration is only 30 seconds long?
Also, I want to find a way with PHP to convert a video in other formats such as MP4.
Please suggest us.Answer1:
You can get the ID3 information of the file and probably do a check later:
$getID3 = new getID3; $file = $getID3->analyze($filename); // Access duration and dimensions $duration = $file['playtime_string']; $dimensions = $file['filesize'];
If you want to convert it in other formats there is this package <a href="https://github.com/PHP-FFMpeg/PHP-FFMpeg" rel="nofollow">PHP-FFMpeg</a>.
Also check these resources:<ul><li>
<a href="http://getid3.sourceforge.net/" rel="nofollow">http://getid3.sourceforge.net/</a></li> <li>
<a href="http://ffmpeg.org/" rel="nofollow">http://ffmpeg.org/</a></li> <li>
Similar question: <a href="https://stackoverflow.com/questions/4847752/how-to-get-video-duration-dimension-and-size-in-php" rel="nofollow">How to get video duration, dimension and size in PHP?</a></li> </ul>