On 8/5/2020 9:52 AM, Tom Burrows via ffmpeg-user wrote:
I need to get the duration of any video file such that when multiplied
with the media's fps value (in this case, either ’tbr’ or ‘fps'), it
equals the number of frames in the video.
That works until you find a variable frame-rate video. I have found that to get a truly accurate duration or frame-count, you have to effectively render the entire file, even if to /dev/null. It does take (much) longer, but it's not really a re-encode, just a copy.

A prime example of this is an mp2 pulled out of a dvd vob- I've seen a lot of cases where the metadata info is wildly wrong* or that parts of the video change between 24 fps and 29.97, there's also the 3:2 pulldown flag....

*duration 00:46:13 on a 90 minute movie? I think not.

AFAICT, no video tool has solved this without running the entire stream. You might take one approach for fixed-rate containers/encodings and another for variable-rate.

Later,

z!
_______________________________________________
ffmpeg-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to