ac3 read from some ts have wrong timecodes
Created by: mkver
Hello,
today I noticed something odd concerning the timecodes of ac3 streams read from some transport streams: The files produced by mkvmerge have a gap at the beginning of the ac3 streams (all muxes were created with the --disable-lacing
-switch because of #1700 (closed); if one doesn't use it, there is a gap between the first two laces). In all my test files, the gap is always 32ms (one ac3 frame) long. Because it makes no sense to have such a gap (after all, for the ac3-frames coding (and therefore probably transmission) order and presentation order agree), I investigated the issue and now I am certain that this is a bug in mkvmerge:
First, I muxed the file with ffmpeg. Command line:
ffmpeg -i test.ts -map 0:0 -map 0:3 -c copy -sn ffmpeg.mkv
There is no gap in the output; more importantly, there is an A/V sync-issue: Because of the gap, all ac3-frames (except the first four) are delayed by 32ms in the file produced by mkvmerge compared to the file produced by ffmpeg (and of course, compared to the other tracks).
Then I cut away the first 10MB (M=10^6) from test.ts (resulting in test2.ts) and muxed it. The result was again a gap of one ac3-frame between the fourth and fifth frame. There was no gap between these two frames in the file muxed from the original transport-stream (without its beginning cut off); the adler-checksums were used here to distinguish the various ac3-frames. This confirms that this is a bug in mkvmerge and that ffmpeg does it probably right.
I also remuxed the transport stream with ffmpeg to another transport stream:
ffmpeg -i I:\test.ts -map 0 -c copy -sn test.ffmpeg.2.ts
and remuxed this file with mkvmerge. The result does not exhibit the gap and the A/V sync is just as in the files created directly by ffmpeg. So it only happens on some transport streams. My sample is a recorded satellite stream, It happens with other channels than ZDF and with both of my recording devices.
The other audio streams (MP2-audio) don't suffer from such a phenomenon. I don't have any test files for other audio formats.
If you want to, I can upload other sample files as well. (The files I have mentioned have been uploaded to your ftp-server; I have also cut the first 20MB, 30MB and 40MB of test.ts away and always got the same gap after four ac3 frames.)
Greetings Andi