On Fri, Dec 14, 2018 at 3:03 AM Carl Eugen Hoyos <ceffm...@gmail.com> wrote:
> 2018-12-13 17:10 GMT+01:00, Robert Krüger <krueger@lesspain.software>: > > > is there a way to get the exact duration of a raw mpeg1 file using the > > ffmpeg command line? For testing I created a 30 minute test file using > > ffmpeg (using -c:v mpeg1video -f mpeg1video), then verified the duration > > using VLC and mediainfo and it is indeed exactly 30 minutes long but > ffmpeg > > -i shows the file's duration as 00:00:04.98 after displaying this > warning: > > > > [mpegvideo @ 0x7fe212806000] Estimating duration from bitrate, this may > be > > inaccurate > > > > Are there command line parameters to make it compute the exact size or is > > this a design or implementation limitation? > > Just the mpeg specification;-) > > Yes, sure, having to count packets/frames is unavoidable for some formats. My question is rather whether ffmpeg's (or rather libavformat's) duration computation code can be made to do this internally without these workarounds. > $ ffmpeg -i input -c copy -f null - > Thanks for the command line. Just a comparison: This approach gives me the duration information for a 180 minute file in 1.8 seconds while mediainfo does it in 0.25 seconds (being exact while ffmpeg is a few frames off, but that's a different topic), so there must be a faster way to implement it. Tested with a number of different files with identical results in principle. What keeps confusing me is that analyzeduration and probesize really seem to be the parameters that should address the behaviour and give the user a choice to make the trade-off between accuracy and performance but specifying these with limits beyond file duration and size does not change anything in this case. Looking at avformat_find_stream_info this looks like what it was meant to do but I am by far no ffmpeg code expert, so I might be misreading it. Disclaimer: I am neither criticising ffmpeg nor promoting mediainfo :-). Just interested in getting closer to a solution for the ffmpeg/libavformat community and trying to understand what the status quo is. Thanks, Robert _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".