I'm starting a portal which distributes videos. The idea is to upload the videos to Amazon S3 and gather the necessary data using PHP from my server. So far everything works fine... the only thing I could not manage to get is the duration of the video :-( Could anybody give me a hint on how to accomplish it?
Thanks, Miguel
UPDATE:
I finally opted to do it using FFmpeg. I have already installed FFmpeg on the server and I'm now trying to execute the command in the shell prior to execute it with PHP. I'm passing it the URL from Amazon (I tried both the cloudfront URL and the S3 URL) but it says that there is not such a directory or file. I've seen examples on the web using external files so I expected it to work.
The command I'm using is
ffmpeg -i https://s3-eu-west-1.amazonaws.com/path/to/file.m4v
Is there something I need to configure in order to use external URLs?
If you don't want to use FFmpeg (or can't install it on your server) another option is to look for the duration in the video file's embedded metadata.
It is usually stored in one or more tags called "Duration" or "PlayDuration".
You can read the embedded metadata from the video file using something like ExifTool and then parse the output for the tags.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With