View Full Version : B-Frames and Audio Sync
Penguix
24th August 2003, 06:18
Hi...I'm a n00b here and I already searched extensively, so please don't flame. :)
Whenever I use b-frames to encode, the audio gets horribly out of sync. How can I use b-frames and keep the audio in-sync? Thanks
BoNz1
24th August 2003, 07:52
Which build and settings are you using? I remember this was a problem several months ago, but in order to answer we need more info!!! Check out this sticky on what to do when posting bugs http://forum.doom9.org/showthread.php?s=&threadid=24924
Penguix
24th August 2003, 17:14
oh I didn't think that this could be a bug, but rather I wasn't doing something right.
Well in the XviD readme, the date is 16/07/03 and it seems to be Nic's version.
I don't know what DShow filter I am using to decode
The "bug" occurs with any video clip
I'm using Windows XP Professional, AMD Athlon XP 2100+, 512MB, ATI Radeon 9500 Pro, and Windows Media Player 9.0
Encoding Options: 6-Ultra High Motion Search, H.263 Quantization type, XVID FourCC, 4-Wide Search VHQ, Max I-Frame Interval 240, min 1, chroma motion, quarterpel, max b-frames 2, b-frame quantizer ratio 150, b-fram offset 100, DX50 B-VOP compatibility. All same for second pass.
AviSynth Script:
SetWorkingDir("C:\PROGRA~1\GORDIA~1\")
LoadPlugin("mpeg2dec3.dll")
mpeg2source("C:\dvd\project\oldschool.d2v")
crop(0,58,716,360)
LanczosResize(640,272)
Penguix
29th August 2003, 18:36
anyone? :(
KpeX
29th August 2003, 19:17
Hi Penguix,
1. When posting an AVS script, delete all lines starting with a '#'. These are commented lines, they are ignored.
2. Nothing appears wrong to me with your script or avisynth script. Try posting your entire GKnot log or Besweet (audio) logfile. Many many people have used b-frames with the build you mention and they shouldn't cause sync problems. It is most likely an audio encoding or playback problem.
superdump
29th August 2003, 20:49
Penguix: What type of audio are you using and what container is it in? For example, is it VBR MP3 in an AVI?
frodoontop
29th August 2003, 20:58
Make sure your virtualdubmod version is up-to-date. Is should be from august 2003. Check for latest version at www.sourceforge.net.
droolian01
28th October 2003, 10:46
Hello all
I had sync issues too, and upgraded to vdub mod 1.5.4.1 and now there is no more gradual sync loss with xvid and mp3 audio.
Just one question - do you still have to add an audio delay to compensate b frame decoder lag, in my case it is 3 b-frames at 23.976 fps = 125 milliseconds in the interleave box.
Sorry if this is answered elsewhere as i have not encoded anything for ages and are a little out of touch.
thanks
droolian
jkwarras
28th October 2003, 11:58
Maybe is just a CPU intensive issue if you're running on a low ressources system. Use ffdshow to decode and a "light" mediaplayer as MPC and see if this helps.
chilledoutuk
28th October 2003, 12:48
I have also experienced delays resulting from the use of b frames however the delay seems to be just an offset just like droolian01 said I however have been using video with a fps of 25. using vdub i have been able to compensate for the audio delay.
However does anyone know a formulae for the delay that is introduced for a given number of bframes at a given fps.
Koepi
28th October 2003, 12:52
when using "dx bvop compatibility" (or "closed gop" in dev-api-4) there's max. 1 frame decoder lag. Also, make sure that you set the proper delay in besweet when you encode your audio files, smartripper and dvd decrypter write the delay into the filename of the extracted ac3 files. (1frame delay is surprisingly unnotable for me. I don't feel the need to compensate for that frame and add 40ms (PAL, 25fps) delay...)
I hope this helps,
Regards
Koepi
droolian01
28th October 2003, 13:32
Thanks for the info
1frame lag is definately not noticeable - often get that margin of error when processing audio!
erdie
11th November 2003, 13:18
Originally posted by Koepi
when using "dx bvop compatibility" (or "closed gop" in dev-api-4) there's max. 1 frame decoder lag.
when encoding with 2 max. B-Frames the first 3 frames are the same when opening the vid in VDub
Originally posted by Koepi
I don't feel the need to compensate for that frame and add 40ms (PAL, 25fps) delay...)
apparently it's not only 40ms because the resulting clip turns out to be desync and can be fixed by adding +120ms (3 frames for PAL) delay.
Also VDubMod seems to fix this issue, but only when muxing CBR MP3...
PowerMacG4
11th November 2003, 21:13
Originally posted by Koepi
when using "dx bvop compatibility" (or "closed gop" in dev-api-4) there's max. 1 frame decoder lag. Also, make sure that you set the proper delay in besweet when you encode your audio files, smartripper and dvd decrypter write the delay into the filename of the extracted ac3 files. (1frame delay is surprisingly unnotable for me. I don't feel the need to compensate for that frame and add 40ms (PAL, 25fps) delay...)
I hope this helps,
Regards
Koepi
I was under the impression Packed Bitstream was the influencing factor in B-frame decoder lag. Closed GOP refers to only allowing B-frames to reference P-frames, I think, which should not affect decoder lag.
erdie
5th November 2004, 10:03
just for the archives:
it's +40ms (PAL) alright with XviD 1.0+
seems like it was a bug with a build I used back then...
Teegedeck
5th November 2004, 13:32
Originally posted by erdie
Also VDubMod seems to fix this issue, but only when muxing CBR MP3...
When I read that thread again this is what I think: If CBR was OK but VBR resulted in a delay, the problem didn't seem to have to do with b-frames and packed bitstream. Muxing the streams into a more modern container format like OGM, MKV or MP4 should have helped.
stephanV
5th November 2004, 20:32
the only thing is that it doesnt make sense that CBR MP3 solves the issue...
interleaving has no effect on the delay whatsoever...
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.