[FFmpeg-user] How to determine length of animation using C++ API?
cpz at tuunq.com
Fri Apr 26 01:50:41 EEST 2019
On 4/25/2019 3:40 PM, Moritz Barsnick wrote:
> The length of a video as indicated in its header and its actual length
> can differ. There's nothing much you can do about this, except to demux
> / decode a file to its end to check for the actual timestamps (and
> possible discontinuities).
Yep. If you want an actual accurate run time (length), you pretty much have
to demux/decode the entire file- some file formats support a changing frame
rate, there are variable-rate encodings, and there's the dread 3:2 pulldown
flag to account for. Don't even trust the first frame rate * the frame count
:(. (I've been bitten by all of them.)
About the only time you might trust the header's run time is on well-encoded
files from a trusted source.
More information about the ffmpeg-user