Out of region PTS of MPEG-TS leads to wrong file duration (+ PTS gap)
Original reporter: Basic.Master
Some month ago, I recorded a movie and used (as usual) my selfmade TS demuxer/cutter to extract the video and the AC-3 elementary streams, in order to mux them into a new MKV file. It turned out that the recording had at one position some problems with (only) the AC-3 track, though satellite reception, TS continuity counters and AC-3 checksums itself were fine. So this must have been a problem introduced by the broadcasters hardware.
For better analysis, I cut out this position from the untouched TS (justed copied all consecutive TS packets of a certain range surrounding the problem). I also uploaded it to the sample server, named tshdcut_output - PTS-Gap.ts
.
The two problems I determined at the error position (at 0:12; you will here silence on the AC-3 track for half a second with VLC):
- one PES packet has a PTS, which is really out of region (PTS value was 201353 = 1:44:45.042877777778 s); an example for a correct PTS out of this file is 8024923721
If I directly mux the mentioned sample TS into a new MKV (
mkvmerge "tshdcut_output - PTS-Gap.ts" -o "tshdcut_output - PTS-Gap.mkv"
), the resulting MKV is not 23 seconds long as expected, but 1:44:46 according to VLC. - there is a "gap" on the AC-3 track - there is a consecutive range of 0.6435777777777778 s, which is not covered by any PES of the AC-3 track (this gap would also exist, if the mentioned wrong PTS was correct) I am not sure, how this is handled by mkvmerge: Whether anyway the PTS values are used in the MKV file, so that this does not matter - or if the consecutive AC-3 ES frames are muxed, so that audio/video gets asynchronous. So this is just a hint.
These are very specific problem and seem to occur very seldom (if they will repeat at all), so I would not be sad, if mkvmerge will not handle them (because TS support introduces a huge amount of opportunities, where things can go wrong...and nevertheless my selfmade program already handles the problems :-).