kxhitiz
kxhitiz

Reputation: 1949

Requesting header information of a file

is there anyway I can request only the header information of any media. For example I just want to request header information of any video file so as to find its video length. I tried using ffmpeg -i {video_url} and did the work but I noticed that it actually downloads the given media in local storage and returns back the header information which obviously increases roundtrip time.

So I would really appreciate if there is any idea for finding the length of media in a fly. BTW I have a ruby on rails application where I need to implement this.

Upvotes: 0

Views: 247

Answers (2)

Itay k
Itay k

Reputation: 4469

You can also try mediainfo. you can download it from: http://mediainfo.sourceforge.net/en. There is also a wrapper gem for mediainfo but it didn't work well for me. I just used:
response = '#{mediainfo_path} #{source.path} --output=json 2>&1'
and you can then search the response for the properties you want such as "duration" etc.

Upvotes: 0

PaulJ
PaulJ

Reputation: 1718

You could try with ffprobe -show_format. ffprobe comes with ffmpeg, and should have been compiled and installed along with it.

Upvotes: 1

Related Questions