View Full Version : x264 bug (causes audio sync issue)
Twisted Ladder
2nd July 2005, 15:25
I can't believe no one's noticed this yet, but when encoding with x264 in VirtualDubMod the audio is ahead by 1/fps * 4 seconds. I imagine this is because it encodes an extra 4 black frames in the beginning? Anyway that leads to the audio being 133ms ahead on NTSC content, 160ms ahead on PAL content, and 267ms ahead if I do NTSC content at half fps (which is how I noticed the bug, I always felt the audio was a little off but at 15 fps it became obvious). If you don't believe me encode at 1 fps with x264 in VirtualDubMod and it's easy to see the audio is playing 4 seconds too early. I can of course adjust for this in VirtualDubMod but it seems sort of silly that the video codec and framerate I choose can mess up my audio sync :confused:
what settings did you use during video encoding? b-frames? b-pyramid/references?
how did you encode the audio?
maybe your issue is the same as this (http://forum.doom9.org/showthread.php?t=96571) and this (http://forum.doom9.org/showthread.php?t=96708)
Sirber
2nd July 2005, 17:06
That's your source which is bad. I never got any problem.
Twisted Ladder
2nd July 2005, 19:56
It does this with every DVD I have. I rip with DVD Decrypter, index with the latest version of DGIndex and have it create my AviSynth script, which I then open in VirtualDubMod. It doesn't matter whether I encode the audio or direct stream it (ac3), it has this issue. And only the x264 codec does this. Anyway I figured out what the problem is. Start encoding in VirtualDubMod at a spot with motion, but at 1 fps. Watch the resulting video. For the first 4 seconds it's the same frame...
stephanV
2nd July 2005, 20:13
Do you happen to use max 4 b-frames in a row... that would result in an encoding delay of 4 frames in VirtualDub which on its turn results in 4 drop frames at the beginning of the file (you can check this in VirtualDub by looking at the frame type in the time-box, a drop frame is marked as [D]).
Try to encode without b-frames and see if you still have the same problem.
I can't believe no one's noticed this yet
thread " x264 - audio delay? (http://forum.doom9.org/showthread.php?t=95083)"
Twisted Ladder
2nd July 2005, 21:45
Heh, all right. So there's nothing that can be done about this? Guess I'll just stick with audio skew correction in VirtualDubMod. But I have one last question. I have max consecutive B-frames set to 2, and opening the resulting video in VirtualDubMod even shows only the first two frames as [D], so why is it off by 4?
Heh, all right. So there's nothing that can be done about this?
dont use a container which isnt able to handle b-frames correctly (as avi)
x264 can on its own output directly to .mp4, avc's native container (if you cant use a commandline tool, than use megui)
Twisted Ladder
2nd July 2005, 22:18
Well I get this same issue on AVI, OGM, and MKV. I don't know about MP4 but I'd like to stick with VirtualDubMod, so audio skew correction it is.
if you remux from avi to another container, the problem will not go away of course, cause the stream is already borked in the .avi and no muxer corrects the streams during remuxing
encode with x264 to .mp4 and report back if the problem goes away, or continue using an outdated container
Twisted Ladder
2nd July 2005, 22:39
OGM and MKV certainly aren't old and outdated. And I'm talking about encoding to them, not just direct streaming from AVI.
doesnt matter, vfw (as used in virtualdub(mod)) suffers from the same problems as avi not being able to handle b-frames correctly
Twisted Ladder
2nd July 2005, 22:50
I set max consecutive B-frames in XviD to 2, it's 0 frames off. I set it to 2 in x264, it's off by 4. But anyway I use VirtualDubMod for other reasons too, as I find it works best for what I need to do. Is that ok with you?
there are special workarounds in vdm which make b-frames work with xvid
of course its ok for me, to be honest i dont really care what you use ;)
just thinking out loud here
Are you using vdm to encode/add audio during the encode ?
this maybe could explain the 4 frame avi and mkv, ogm delays ?
celtic_druid
3rd July 2005, 01:55
If you encode to mp4 and then remux to mkv then the mkv will be ok. ogm I would say is quite old now as is VDubMod's mkv implimentation, mkv itself is still progressing quite nicely though as above with native AVC handling, etc.
Sirber
3rd July 2005, 02:01
If you encode to mp4 and then remux to mkv then the mkv will be ok. ogm I would say is quite old now as is VDubMod's mkv implimentation, mkv itself is still progressing quite nicely though as above with native AVC handling, etc.
I confirm MP4 --> MKV. I currently use that in RealAnime and it works like a charm.
Doom9
3rd July 2005, 02:20
I confirm MP4 --> MKVThat's the biggest gripe I have with the Matroska container right now.. mux it into a container so that you can mux it into another.. that already sounds stupid.
Sirber
3rd July 2005, 02:25
Currently I support only MKV and RMVB as output. Soon, I'll be able to produce MP4 video (x264.exe) with HE-AAC audio in MP4 container. Just a little more work... :)
Doom9
3rd July 2005, 02:33
well.. you can already do that in MeGUI ;) MP4 output was added back in the dark ages and a lot of time was spent doing things in complex ways you MP4 noobs these days don't even have to know about..
Sirber
3rd July 2005, 04:14
I never liked much MP4 container, but it's becoming a standart so... why not including it? ;)
stephanV
3rd July 2005, 06:12
@edit by admin: insults removed
be nice to each other, not liking some criticism is no reason for flaming
striked for rule 4
Sirber
3rd July 2005, 14:41
Saying that matroska is not natively supported by softwares would have been another way to say it.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.