Skip to content

exiftool gives incorrect duration for some avi/riff files, ffprobe reads it correctly and speedily #371

@infinity0

Description

@infinity0
552d7206bcc2b541dcd1fe59b17e99c714516c34c4dfab92bc6268623c0ac9ea  Black Swan (2010) DVDRip XviD AC3 Soup/Black Swan (2010) DVDRip XviD AC3 Soup.avi
ffprobe  01:43:43.16
exiftool 01:08:16.080000 (4096.080000)
58a06a503a3824b472c8bb63403e722287ed9b65b628c8091aa1b89b972e8e58  Les.Miserables.2012.DVDSCR-EDAW2013.avi
ffprobe  02:37:47.02
exiftool 01:13:15.770304 (4395.770304)
39961a9a99f440a4f36b5d0a2ed1d98031b7f300a2f2e30b164bc62951d7de77  B-Movie.Lust.and.Sound.In.West-Berlin.1979-1989.2015.DOCU.BRRip.XviD.MP3-RARBG.avi
ffprobe  01:35:37.56
exiftool 01:19:41.381830 (4781.38183)
00fb2d526e9b3bae462490e91a458f8c87e3421f2e91bcbfb721d09738abb298  Mark.Felt.The.Man.Who.Brought.Down.the.White.House.2017.BRRip.XviD.AC3-EVO.avi
ffprobe  01:42:57.12
exiftool 00:00:12.220444 (12.220444)
b2b8a5c459ffe96e00ba4db91ad72872d1c4128c03e098527751949fe3340686  dune.1984.extended.dvdrip.xvid.ac3.6ch-[gx].avi
ffprobe  02:56:57.69
exiftool 02:44:53.095892 (9893.095892)

Files are copyrighted but I have provided the sha256sums, in case you are able to get them.

The durations are "fixable" via exiftool's own output by calculating max(VideoFrameCount/VideoFrameRate, AudioSampleCount/AudioSampleRate) which appears to match ffprobe's output, although I have not checked their source code to confirm that this exact calculation is indeed what they do to get the right answer. By "the right answer" I mean specifically that ffprobe output is consistent with other video players and one can seek to the exact timestamp that ffprobe claims is the duration and no later.

Currently exiftool appears to calculate the duration as FrameCount / FrameRate. But these files' metadata have a nonsensical FrameCount that is not consistent with VideoFrameCount or AudioSampleCount, even taking into account the different Rates. TotalFrameCount is a bit more reliable, but also nonsensical in a subset of the above files. The 4 fields {VideoFrame,AudioSample}{Count,Rate} appear to be correct in all of the files I have (several thousand).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions