Rip DVD contents and fix clock problems
Everyting started with a DVD rip, which resulted in a video/audio with bad shuttering problem, at about every 30 seconds.
The DVD was the result of the conversion from a Super 8 film, so there was not CSS problem or alike. The original DVD played well into any DVD player, so the problem was introduced during the encoding using Avidemux. The final file was econded with XviD/MP3 codecs, into an AVI container.
We get the first hint of the origin of the problem when we played the VOB files directly with mplayer: at every point where a shuttering occur (into the resulting AVI file), the time counter resets to zero. It seems that the original stream is composed of several MPEG V2 pieces of about 30 seconds each, at each boundary something goes wrong so the decoders has to restart. Also using vlc with VLC_VERBOSE=2 on the VOB file, shows some problems at every gap point:
core input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 300 ms) core input error: ES_OUT_RESET_PCR called core decoder warning: early picture skipped ... core input error: ES_OUT_SET_(GROUP_)PCR is called too late (jitter of 23916 ms ignored) clock decoder error: Timestamp conversion failed (delay 300000, buffering 2444, bound 9000000) core decoder error: Could not convert timestamp 6503180647
With newer version of Avidemux (2.6.20) it is even impossible to open the VOBs files: the decoding stops at the first chunk of about 30 seconds.
Rip the DVD content using a tool like dvdrip or dvdbackup. You need to extract the VOB files ( dvdrip does not longer exist in Debian 10 Buster, see Ripping the content of a DVD as an alternative).
Concatenate the VOB files into a single file:
cat VTS_01_1.VOB VTS_01_2.VOB VTS_01_3.VOB > dvd_rip.vob
Repack the content into an MKV container, without re-encoding (lossles repack). We tried also an MP4 container, but Avidemux was not able to open it, where instead it was successful with the MKV:
ffmpeg -i dvd_rip.vob -c:v copy -c:a copy dvd_rip.mkv