Determine the Video Duration
Using PHP, is there anyway we can know the length of a video (not size but duration of the video) that has been uploaded?
Any help is appreciated.
PHP does not have this feature built in. You can theoretically get the image data and attempt to find out (this would be hard) or you can attempt to use a library that already exists. Using ffmpeg and perhaps some other things you can probably figure out information. There might also be metadata in the file though this could be misleading.
Of course the simple answer is to check for filesize if you are worried about space, though that won't do much toward telling you how long the video is because there are various formats.
The real question is what format(s) the video will use. Once you know that, you can start to work out how to handle the information.
However, as a general warning, this won't be easy. In fact, it might be easier if you can install a program on the server that can read the videos natively then use an exec() command in PHP to ask that program how long the video is.
Daniel - Freelance Web Design | <?php?> | <html>| Deutsch | italiano | espa˝ol | portuguŕs | catalÓ | un peu de franšais | Ninasoma Kiswahili | 日本語の学生でした。| درست العربية
The Following User Says Thank You to djr33 For This Useful Post:
Originally Posted by djr33
I see your point.
Thanks for replying.