Log in

View Full Version : Keeping a/v sync when re-encoding transportstream


W3ird_N3rd
25th February 2006, 21:59
I have a TransportStream with 1080i MPEG2 and AC3 data. I want to convert it to a .mp4 file. I already encoded/converted the video to x264/720p. But I can't get the audio right. I use DGindex to get the audio seperated and use the d2v file for encoding video.

When I simply convert the audio to .aac with FAAD/MeGUI and mux the audio with the video, everything is OK at the beginning of the movie, but when I seek to the end I first hear the audio and the video shows up later. Less than a second I think, but it's very annoying.

To make it a bit less complex, I took the original .ac3 audio and tried muxing it together with the .mp4 video in a .mkv container. mkvmerge gives a lot of this kind of warnings :

Warning: The AC3 track 0 from 'G:\path\movie.audio T01 3_2ch 448Kbps DELAY -401ms.ac3' contained 886 bytes of non-AC3 data at the beginning which were skipped. The audio/video synchronization may have been lost.

The amount of bytes is different in every error, and I get lots of them. I tried fixing the transportstream with MPEG2repair and getting the .ac3 stream out of the fixed file but it made no difference, still errors. I tried converting the transportstream to MPEG2 with HDTVtoMPEG2 but it doesn't make any difference.

The transportstream itself plays just fine. How can I fix this, or is the .ts fubar?

Pookie
26th February 2006, 09:40
No, it isn't fubar, but it will be some sweat to get this working perfectly.


Convert the TS file to Regular Mpeg2 using ProjectX or Pvastrummento. Cut out commercials and/or demux with MPG2Cut2.

Start with that, and good luck.

W3ird_N3rd
27th February 2006, 03:58
No, it isn't fubar, but it will be some sweat to get this working perfectly.
Nice.
Convert the TS file to Regular Mpeg2 using ProjectX or Pvastrummento. Cut out commercials and/or demux with MPG2Cut2.

Start with that, and good luck.
Interesting. I downloaded ProjectX. First I just pushed some random big buttons because I'm too lazy to read manuals :D (I only start reading them when this approach doesn't work ;)). The interesting thing is that ProjectX started simply demuxing and gave messages like "5 frame(s) (160ms) added @ 00:00:28.192" to keep sync. When I would put the resulting .m2v en .ac3 in a new .mkv container, the sync is perfect.

Unfortunately, when I mux this .ac3 with the .mp4 I already had, there is no sync, the audio comes even earlier now. I guess these two days of encoding x264 are wasted.

But since the mux of the resulting files of ProjectX worked nice, I assume that in the future I could just demux with ProjectX and start encoding with the resulting files, and everything should be fine? Why is MPG2Cut2 required? (if I have no need to cut anything out)

Well, I tried converting the TransportStream to M2P with ProjectX, and the resulting file would just crash Mediaplayer Classic, but works fine in VLC. Then I visited the homepage of MPG2Cut2 but got confused, I have no idea if I should pick the Alpha or the Beta version in this case, and trying both and wasting another 2 days of encoding just to find out I picked the wrong one? :scared:

I'll assume the .mp4 I already had is useless, but will files encoded in the future be alright if I demux with ProjectX?

Pookie
1st March 2006, 18:30
Yeah, nothing more fun than a few days of useless encodes. I know the feeling well.

The Alpha version of Mpg2cut2 works fine. In addition to very, very fast cutting and trimming, the demuxing function is quite good and has saved my work when other apps refused to work properly.
You will need to convert your source from TS to regular MPEG2 before using it.

I like ProjectX a whole lot. It ensures A/V sync around 90% of the time. If you have the time and the disk space, you can always remux the audio and video tracks that ProjectX demuxed just to make 100% certain your material is in sync. There's a free muxer called Mplex which will do it for you.

W3ird_N3rd
4th March 2006, 22:28
I did a re-encode with the files ProjectX gave me. The strange thing is, the audio.mp4 seems to be playing fine.. The video.mp4 seems to be playing fine.. And when I mux them with MeGUI/Mp4box into one .mp4, all hell breaks loose. In MPC the file skips big parts, and there is nog soud.. Well, there is. Sometimes while playing something comes out of the speakers that could destroy them if I would turn up the volume. Squeeks or something. I can't listen to it, makes my ears hurt. In VLC it doesn't work either.

When I mux the files into a MKV the file seems to be in sync but CPU usage is 100% and the files plays horribly slow. So slow it gets out of sync in seconds. But when seeking even at the end it seems to be fine. My CPU should be fast enough to play it.

The only thing I really changed is that this time I picked the CE-Quicktime profile instead of the HQ-Slower profile.

Either I made a big mistake, my computer went bad or all of this technology is just not yet "ready". I'm not sure. It shouldn't matter but I'll try muxing again after the next reboot.