[FFmpeg-user] Forcing ffmpeg to detect duration reliably
Carl Eugen Hoyos
cehoyos at ag.or.at
Fri Mar 1 16:56:36 CET 2013
tracey jaquith <tracey <at> archive.org> writes:
> I use this for our archives when I get an estimated duration
> that seems wrong. Much faster than the "ffmpeg -i
> input -f null -", though I'm sure there may be some pros/cons.
> It uses "ffprobe" to "count video packets" and their durations,
> finally printing a total #seconds.
> ffprobe -select_streams v -show_packets -print_format compact
> *mpg 2>/dev/null | egrep -o
> 'duration_time=[^ ]+'|cut -f2 -d= | perl -ne 'chop; $n+=$_;
> print (int($n*10)/10)."\n" if (eof());'
Does this also work if the stream contains timestamp
More information about the ffmpeg-user