Sanitize decode time stamps (DTS) in copy mode

Started by Jan Gruuthuse, April 16, 2018, 07:52:02 AM

Previous topic - Next topic

Jan Gruuthuse

setting found @ Avidemux Menu: Edit: Preferences
[Output]
[v] Sanitize decode time stamps (DTS) in copy mode

Couple of questions regarding this setting?

- Main purpose?
- When could this be used?
- When should this be avoided?


eumagga0x2a

This switch has been added to allow fallback to the old (well, not strictly old) mode when dealing with irregular DTS. Say we have DTS 0, 10, 20, 30, 32, 42, 51. Originally, Avidemux would silently drop the frame with DTS 32 resulting in severe video corruption if e.g. it happened to be a keyframe. Then I changed this so that Avidemux would modify DTS to be something like 0, 10, 20, 30, 36, 43, 51 (and PTS as well if necessary) to smoothen the bump. The goal was to raise the threshold for dropping frames but still to avoid DTS getting too close to each other, because some old hardware decoders didn't like this. This is what is called "Sanitize DTS in copy mode". This mode can sometimes result in out-of-order PTS (which is only half as bad).

The new behaviour is just to leave DTS (and thus also PTS) as they are and let the muxer deal with irregularities e.g. by delaying all subsequent frames if a timestamp collision is detected. FFmpeg-based muxers have been modified to cope with such streams, but not the others like MP4v2.

Due to a very thin test coverage, the decision was to keep a fallback option for a while. Originally, the hope was to get enough feedback either to remove the option or to make it default (or to return to the not-so-old behaviour completely) prior to the next release, but we have zero feedback, so the strange new option has to stay for now.

Jan Gruuthuse

In short
- Under normal conditions you would leave this option disabled
- If you would get corrupted video (dropped frames) (from specific source) you could try with this enabled option.

eumagga0x2a

Quote from: Jan Gruuthuse on April 17, 2018, 06:58:57 AM
- If you would get corrupted video (dropped frames) (from specific source) you could try with this enabled option.

No. If your old TV set exhibits difficulties to play a video despite supported codecs and container, you could try enabling this option. The option increases the probability of dropped frames.

Jan Gruuthuse

OK, seems clear now.
Only use if old TV has issues.