Nicolas Goy
Nicolas Goy

Reputation: 1430

Get media duration without downloading the whole file

I have about 5'000 media files (video) on S3, each file is available in webm, mp4, ogg and mpg2 (for a total of 20'000 files).

I need to get the duration of each file, and I'd like to avoid downloading them in whole.

I tried something like:

curl -r 0-500 http://myfile.mpg |ffmpeg -i -

To get the duration, but it doesn't work on any format.

Is there a range, in any of the format I have at my disposal I can reliably check for duration?

Upvotes: 2

Views: 1012

Answers (2)

Nicolas Goy
Nicolas Goy

Reputation: 1430

It may sound silly, but I discovered that ffmpeg will handle http just fine.

Which means:

ffmpeg -i http://myfile.mpg

just works.

It output all the meta data, including duration, and it does not download the whole file.

Upvotes: 2

Chris Livdahl
Chris Livdahl

Reputation: 4740

Are you saying "ffmpeg -i" is not working for any of your formats? Or is it working for some of the formats?

If it is working for some of the formats, then your version of ffmpeg is compiled to handle those formats. You may need to recompile ffmpeg with the additional formats installed.

Upvotes: 0

Related Questions