Log in

View Full Version : .mkv with x264 and .ogg, slight v/a desync


R!tman
21st June 2006, 11:45
Hi all,

before I switched to x264, I used xvid. I never had problems with audio and video not being in sync. But since I use x264 in a matroska container, I have this desync of about 0.2 to 0.5 seconds. I can get rid of this by simply shifting the audio during muxing, but I find this quite annoying...

The way I do my movies:

* mplayer, to extract two languages in .wav.
* oggenc, to encode the two languages.
* mencoder, to encode the video (with -of rawvideo).
* MP4Box, to add the raw x264 video to an .mp4.
* mkvmerge, to mux everything.

Like I said, it's nothing serious. It's just pretty annoying!

Any help is greatly appreciated. If you need any more info, please ask :-).

Cheers,
R!tman

PS: I use the latest versions of all programs, except vorbis-tools. I do the whole thing on gentoo linux.

GodofaGap
21st June 2006, 12:34
I think the delay is just in the source... so there is not much you can do.

R!tman
21st June 2006, 12:48
I think the delay is just in the source... so there is not much you can do.
I doubt that. For all dvds I used this procedure (about 7 dvds), I had the desync. But the dvds were in sync.

GodofaGap
21st June 2006, 12:58
DVDs are in synch, but start times of different tracks might be different. The question is if mplayer compensates for this or not when extracting the audio. Most DVD ripping programs (DVD decrypter, DGIndex) print a delay value in the file name to be used when muxing.

FWIW - I've been doing x264/vorbis in mkv for more than a year, and I have never seen this problem.

MeteorRain
21st June 2006, 14:34
btw, have you tried x264.exe (CLI) instead of using mencoder x264 module + mp4box?

R!tman
23rd June 2006, 08:10
DVDs are in synch, but start times of different tracks might be different. The question is if mplayer compensates for this or not when extracting the audio. Most DVD ripping programs (DVD decrypter, DGIndex) print a delay value in the file name to be used when muxing.

FWIW - I've been doing x264/vorbis in mkv for more than a year, and I have never seen this problem.
As I used mplayer with xvid before, where everything worked, I assume mplayer is not the problem.

btw, have you tried x264.exe (CLI) instead of using mencoder x264 module + mp4box?
I did not try x264.exe, and I will not in the future. But what I can try is the x264 executable for linux ;-). Maybe over the weekend, but I don't have much time right now.
I will test this, but as I mentioned earlier, I doubt it's mplayers fault.

GodofaGap
23rd June 2006, 08:25
Ok, if you think it is not mplayer, then what do you think is to blame?

ssjkakaroto
23rd June 2006, 13:37
to make sure it's not a delay of the audio of the dvd, try doing this procedure with one of the 7 movies you've encoded with xvid and see if it desyncs with x264.

vlada
23rd June 2006, 16:32
I would try this:
1) Mux original video and audio in MKVToolnix
2) Mux original video and transcoded audio and vice-versa.
3) Mux it in MP4

Which of these are in sync and which are not?

R!tman
24th June 2006, 18:16
Following vlada's advice, I figured out what the problem was.

I used to resample the audio streams from 48 kHz to 41.4 kHz during the extraction into pcm. Muxing with ogmtools did not seem to be a problem, for mkvtoolnix it obviously is.

However, resampling while encoding to ogg works now, even with mkvtoolnix :-).

Thanks to all of you!