Michi Michi - 1 year ago 154
PHP Question

Get video duration of file hosted on Amazon S3

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?



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?

Answer Source

There is a sample code snippet from LongTail which uses PHP and FFMPeg http://www.longtailvideo.com/support/forums/jw-player/setup-issues-and-embedding/9448/how-to-get-video-duration-with-ffmpeg-and-php

Seems to be another solution here: http://www.jqueryphp.com/getting-video-duration-with-ffmpeg-php-function/2009/10/

You'll need FFMpeg installed on your server

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download