Audio syncing issue on appended file with forced FPS duration
Here is my routine, chopping up a video file into multiple segments using avidemux 2.7.5. Each of them has different length depending on the scene, was not re-encoded and output as mkv.
Proceed by using mkvtoolnix to append them into a single mkv file, one chapter is generate for each appended file. The appended mkv usually show some irregular frame rate when inspecting using mediainfo. I do aware of mkv container do not specified frame rate directly, mediainfo derived it through probing PTS/STS timestamps.
The problem is I am able to notice there are minor stutter at the joint. The effect I describing here was more like a jetlag for only a frame or two, likey caused by the slight mis-match of the audio+video frames. Thus, appended file with DTS tracks are usually more noticeable than AAC. I found out there was frame count mis-match once play pass jointing point between playing in mpc-hc and loaded via video-only preview in vapoursynth indicating something going on here. These stutters are relatively mild, like if nobody told you about it, you simply woun't noticed. Some people might still felt nothing even after informed.
I found out long ago explicitly forcing the correct default FPS duration on mkvtoolnix alleviate the stutter issue. That's why I'm positive about the stutter was really there. I had since became uber sensitive to the stutters, now I can pretty much correctly identified its' present whenever I forgot to enter the force value before append.
However by forcing default FPS duration, it's actually solving one but lead to another new issue. The new issue which is also the topic of this open issue.
Once you forced FPS duration, the video track will be fine, the problem became the audio track. It seems like mkvmerge mostly just appending audio track without making much adjustments. So if there were some larger than expected audio/video length mis-match on the sourced files, audio from preceding track might make it to the start of the next. The more file you append, the mis-match will be more easily notieable.
Usually there is only a blip like a frame or two length, so that's fine for casual use. On some rare cases, usually sourced from bluray remux. The preceding audio on some joining segments might make it into the succeding one for a longer duration, the appended output became gradually out of sync.
Now that avidemux 2.7.6 released, there were some tweaking and fixes for its timestamps handling. Result in longer audio duration (by one or two audio frames compared to avidemux 2.7.5) being save into the chopped output mkv under same selection. It spelled big annoyance for me because appending file on mkvtoolnix using segments chopped from avidemux 2.7.6 almost guranteed a noticeable audio out of sync appended file now.
I'm aware this may not be seen as a mkvtoolnix/mkvmerge issue. Given that similar video file with a slightly larger than expected a/v mist-matched may also be produced by other tools. It's nice to have mkvmerge to implement some sort of bound checks while working appending under force FPS duration to prevent preceding audio creep into succeeding one. Or maybe introduced another append mode for this?
BTW To be able to spot these cases more easily, you can generate chapter for each appended file. Pick preceding file ends with loud noise and a suceeding file start with silent. Repeating appending them for a few more times. Play the file, paused, switch to the chapter, play. You should hear loud noise for a brief moment before it went silent.