Video duration is wrong for AVI OpenDML format videos

Probably not something to go on the critical list.

I've been recently transcoding my old AVI videos to MP4 (MPEG4AVC + AAC).

2018-03-14%2023_20_04-K__

In the above image:
1.avi : AVI file using XVID codec, (correct duration shown)
2.avi : AVI file using DIVX with an OpenDML Profile, (incorrect duration)
1.mp4 and 2.mp4 are the transcoded files reporting the correct duration

MediaInfo:
10

10

Probably the same cause underlying this previous thread

It's the same whether the video codec is XVID or DIVX, (and probably others, haven't looked), in my collection if it's OpenDML the duration is incorrectly reported.

Duration comes from what the codec/splitter on your system reports for the file, so the problem is most likely in those components rather than in Opus.

What do you see from File Explorer's duration column? (It may be different since it might use a different API to get the data, but if it's using the same API and installed components for the format in question then it'll get the same answer.)

Under Explorer the duration is reported correctly.

2018-03-15%2010_41_00-K__

I recently cleaned out almost all the non-default codecs/splitters/filters from my system because they were preventing Vegas 14 Pro from starting, the only codecs I have installed besides default are MagicYUV, Lagarith, and proDAD (part of an NLE).

2018-03-15%2010_47_14-System%20Information

I also found they weren't necessary as the NLEs/transcoders/players I use have their own internal codecs, if they require something I haven't got I'll transcode to lossless as an intermediary.

Just looking through Google, it appears that AVI Type 2 (OpenDML) was reportedly implemented in ~DirectShow 5.1

Is there an example file with this codec somewhere that we can try?

Using AVIDemux to create OpenDML output didn't seem to work but AVIMux GUI does, (MediaInfo identifies it as OpenDML).

I've cut a 01:01 minute segment from 1.avi and created a OpenDML AVI from it, (just to show it also happens on XVID) - DOpus reports it as 00:12 seconds, Explorer reports it correctly as 01:01.

Size is ~7MB: test1a.avi

BTW, just as a matter of interest, would it be possible for DOpus to use the MediaInfo.dll if found on the system?
So many other programs use it that I have 12 copies in various directories.

Just as an FYI, DOpus also reports the Duration of truncated AVI files as N/A even though Explorer will report the correct duration.

2018-03-20%2015_04_55-K__AVI-Files

The first issue you raised will be fixed in the next update, thanks for providing the sample file.

If you can provide a sample for the second issue I'll have a look at that too.

No problem, just got to work out what 'truncated' means in this scenario, otherwise the only samples I've got are 700MB+.

It might be next week since the rest of this one is taken up time-wise.

EDIT: Looks like it may be because the video and audio are not of the same duration or the file was not of the expected size.

From here:

It means the the file has not the expected size i.e. the copy was not complete.
But this is not really a reason for unsync (it is expected that both video and audio stop before the end, at the same moment).

Have to work out how to create this since what I'm using will either add blank audio to match the length of the video or cut one track to match the other.

Sure, no rush.

It might even be enough to split off a small chunk from the start of the file anyway? The video doesn't need to actually be playable.

Unfortunately, editing it seems to fix the problem when the video editor, (or ffmpeg), remuxes the output ... this is going to require some screwing around.

I meant literally just split a chunk from the file, e.g. use the Split tool in Opus to split it unto 1MB chunks and then see if the first chunk is enough to replicate the problem.

DOH!

That worked, I'll add a link to a 6MB test file to this post when it's up.
Explorer still reports it as the original length, (01:17:31), Dopus says N/A.

Here you go: test2a.avi

The original length could be completely wrong in that case. (e.g. 2 hour AVI with only the first 10 seconds still in the file.) Is it useful to have a misleading length instead of saying the length data is unavailable/invalid?

The fix for the first problem seems to have fixed the second as well :slight_smile:

The original length could be completely wrong in that case. (e.g. 2 hour AVI with only the first 10 seconds still in the file.) Is it useful to have a misleading length instead of saying the length data is unavailable/invalid?

Using the 6MB sample I provided isn't a good example of the problem, the correct length is/was available for the complete AVI, Explorer could read it and the video was playable and valid.
My guess is the audio track is a few ms shorter than the video track or vice versa, which leads MediaInfo to believe the file is truncated.

A simple remux of the sample, (and the original), fixes the problem for DOpus:

ffmpeg -i test2a.avi -c:v copy -c:a copy test2b.avi

DOpus will then show a length of 01:28 for the sample, whereas it's original length is 01:32 when played, the last 4 seconds being discarded, (last 4 seconds of video are frozen in the sample even though audio continues).

I'm guessing Jon has fixed it so that DOpus now looks at the same info Explorer does?