Audio sync problems

HandBrake for Mac support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
treant985
Posts: 4
Joined: Tue Oct 09, 2007 9:06 pm

Audio sync problems

Post by treant985 »

I'm trying to use handbrake to copy some Band of Brothers discs that I've got. Everything runs normally, but when I open the completed files, the audio is a second or more after the corresponding part of the video. I've searched for things like 'audio sync' and 'lip sync,' but I haven't found anything that helps.

Any ideas on a simple solution? Are there are other programs besides handbrake that would let me rip DVD files for an ipod, that might not run into this audio sync problem?
eddyg
Veteran User
Posts: 798
Joined: Mon Apr 23, 2007 3:34 am

Re: Audio sync problems

Post by eddyg »

treant985 wrote:I'm trying to use handbrake to copy some Band of Brothers discs that I've got. Everything runs normally, but when I open the completed files, the audio is a second or more after the corresponding part of the video. I've searched for things like 'audio sync' and 'lip sync,' but I haven't found anything that helps.

Any ideas on a simple solution? Are there are other programs besides handbrake that would let me rip DVD files for an ipod, that might not run into this audio sync problem?
Version of HB, platform, and what options you used for HB would be helpful.

Did you see any issues in the Activity Window when encoding?

There really isn't much you can do about the lip sync issue, it shouldn't be an issue to be honest. At most it should be 100ms out.

Cheers, Ed.
PuzZLeR
Bright Spark User
Posts: 287
Joined: Tue Apr 24, 2007 4:01 am

Post by PuzZLeR »

After many gigabytes of encoded content from HandBrake not one byte is out of sync. I have never, ever had that problem with this wonderful app (thanks Devs!) and I think this is the first post like this on this forum that I've seen.

Sometimes when I DO find one clip out of sync, it has NEVER been a HandBrake issue. Instead it was either:

a) The decoder/playback device. Sometimes Windows Media Player acts funny and so does QuickTime when it's choking. Even VLC will hiccup and sometimes go out of sync. You have to understand, H.264 is a CPU intensive codec even in playback.

What decoders are you using? Try a different playback app and see what happens.

b) I'm on Windows, and as we users all know, a good system restart is necessary. Sometimes when I do alot of video editing, encoding, or even download something my system goes all wacky. This has an effect on my playback apps and the video goes out of sync with the audio. Again, after a fresh restart it's all good.

c) Maybe you're encoding with intense features: high refs, b-pyramids, 8x8 and even CABAC can slow down the video behind the audio. Again, not a HandBrake issue but quite normal among slower machines. What are your machines specs?

d) If none of the above, it's because something was wrong with the source. I've had a couple of bad video go through HandBrake and the corrupt streams came out of sync even before encoding, and after editing. You may need to look into demuxing/remuxing, etc. with apps like ProjectX which can remove bad time stamps and open GOPs from problematic MPEG-2 content.

e) Are you using Xvid? Then yes, you may have problems then. Older ASP codecs like DivX and Xvid and the ancient .avi container they use are notorious with A/V sync issues when encoding from MPEG-2 content. See d).

I don't think this is a HandBrake, MP4 or x264 issue at any rate.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

Well, it could easily be a HandBrake issue...

HB doesn't always deal well with TV sources, especially HBO TV sources, and Band of Brothers has come up in the past as a problem title for several reasons (chapter structure, title structure, and mixed NTSC content).
treant985
Posts: 4
Joined: Tue Oct 09, 2007 9:06 pm

Post by treant985 »

I'm on XP and using the newest version of HB (just downloaded it yesterday). I used standard options for everything except that I put 500kbps for the video and changed the video format to mp4.

I used some DVD ripper that I've got (either dvdfab or easydvdclone) to copy my discs of BoB onto my computer, then took those files and used HB on them. I tried several episodes and discs, all produced the same problem of the sound being noticeably off from the video from the very start of the episode.

I downloaded a trial version of xilisoft, to see if it ran into the same thing; the 5-min files it created all have the sound synced just right, so it must be a HB problem with either the way I ripped the files from disc, or with the HBO formatting itself....
treant985
Posts: 4
Joined: Tue Oct 09, 2007 9:06 pm

Post by treant985 »

It must just be a computer problem. I tried it again using HB and it seems to be syncing correctly now, even though I haven't even restarted the computer.

I'll post again if it happens again.....
PuzZLeR
Bright Spark User
Posts: 287
Joined: Tue Apr 24, 2007 4:01 am

Post by PuzZLeR »

Hi Jbrjake,
jbrjake wrote:Well, it could easily be a HandBrake issue...
Yes and no depending on how you look at it.
HB doesn't always deal well with TV sources, especially HBO TV sources, and Band of Brothers has come up in the past as a problem title for several reasons (chapter structure, title structure, and mixed NTSC content).
I would personally declare this a source problem not a HandBrake issue. :wink: AFAIC I would treat this as a "problematic stream" and apply my "d)" from my last post.

In fact, coming from DivX and the constant A/V sync problems with ASP codecs and AVI containers we built some good encoding habits which is something we encourage users - to assume all MPEG-2 content is "bad source" beforehand.

I wouldn't know of a Mac solution, but on Windows you would first need to rip out the content as MPEG-2 and demux it with an app called ProjectX that corrects time stamp errors. Depending on the encoding tool, you can input the streams as they are, or remux them or even cut them with special tools before encoding.

Yes, it's a pain, but this is what we recommend users of DivX to avoid A/V sync issues. Maybe this is why I don't get any A/V issues with HandBrake either since I carry these habits now to H.264. I've used a variety of sources as well: DvD movies, TV episodes, Music Videos, home-made stuff, DVR stuff, you name it - I've shoved it all into HandBrake and all's well. :lol:

An ounce of prevention saves a pound of headache later.
:D
Bear Hunter
Posts: 47
Joined: Fri Oct 05, 2007 11:13 pm

Post by Bear Hunter »

Would FFMPG X be the equivelent of Project X for Windows? Or does HB already incorporate all the features of FFMPG X?

http://homepage.mac.com/major4/tools.html
PuzZLeR
Bright Spark User
Posts: 287
Joined: Tue Apr 24, 2007 4:01 am

Post by PuzZLeR »

Bear Hunter wrote:Would FFMPG X be the equivelent of Project X for Windows? Or does HB already incorporate all the features of FFMPG X?
Hey Bear Hunter,

Not at all. ffmpegX is another encoding tool, much like HandBrake, with different input capabilities. Boy, if I had a Mac I'd love to play with that tool too. But hey, I'm still very happy HandBrake came to Windows from Mac at least. :D

ProjectX is a demuxer. It separates video and audio streams and corrects and adjusts time stamps, GOPs, etc. I don't know if it's available for Mac though.
leVnikolaïeVitch
Posts: 2
Joined: Sun Oct 14, 2007 8:20 am

Had the same problem here, found clues: the murderer is...

Post by leVnikolaïeVitch »

Hi there,

To start with:
I am running Handbrake 0.9.1 under Mac Os X (10.4.10) on an Aluminum Imac (24", 2,8 GHz Core 2 duo Extreme, 1 GB RAM).

Until now I used to encode in ABR 2 passes, and never had a problem with sound synchro. Yesterday I decided to change and begin encoding with CRF 70% and different H.264 options (boosted) which gives me just the expected video result for my max. acceptable file size (about 800 Mo per Hour) in a much shorter encoding time.

Since then I had that synchro problem: I tried it on different sources (recent and older films from different locations - french/american) and the result was constant: audio desynchronization of a couple of seconds from the beginning of the movie.

I tried my older method (ABR) with the same films and the same H.264 options: same problem.

Finally, I suspected my advanced H.264 options. My original "problematic" parameters were:

<string>ref=7:bframes=16:subq=7:me=umh:merange=32:trellis=0:no-fast-pskip=1:bime=1:brdo=1:mixed-refs=1:direct=auto:weightb=1:analyse=all:8x8dct=1</string>

I tried several variations changing the b-frames count and refs count and found the following (all other parameters remain unchanged):
- refs=7, bframes=16: KO (synchro problem)
- refs=6, bframes=6: OK
- refs=9, bframes=12: OK
- refs=12, bframes=6: OK
- refs=6, bframes=14: KO (synchro problem)

Conclusion, for bframes max number above 12, the problem arises...


I read in a X.264 options document found on the web the following concerning b-frames:

"
leVnikolaïeVitch
Posts: 2
Joined: Sun Oct 14, 2007 8:20 am

...end of last message

Post by leVnikolaïeVitch »

Hi there,

sorry...last message was truncated, here is the end...


I read in a X.264 options document found on the web the following concerning b-frames:

Max Consecutive: This setting controls the maximum number of consecutive B-Frames. B-Frames
refer to both, the previous and the following P-Frame/I-Frame. This way B-Frames can compress even
more efficient than P-Frames. The default setting allows a maximum of 2 consecutive B-Frames, which
should be considered a minimum setting. Using more consecutive B-Frames can greatly improve the
compression, which means better visual quality at the same file size! Note that you can safely choose
the maximum value of 16 B-Frames here, because you can trust the encoder to choose the optimal
number of B-Frames! Even if you allow up to 16 consecutive B-Frames, the encoder will seldom
decide to go that high. Therefore more B-Frames won't hurt the quality at all and they will even speed-
up the multi-threaded encoding! Limiting the number of B-Frames to less than 16 will only restrict the
encoder's freedom to choose to optimal number of B-Frames. If you set B-Frames to 0, then B-Frames
will be disabled.


This document does not link decoding processing power to b-frames, so it keeps me wondering what the real problem is. Obviously b-frames do have a part in this synchro problem...Any ideas ?

Hope this helps.
javascript:emoticon(':shock:')
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

Yes, > 14 b-frames do not work properly in 0.9.1 and that's why that many aren't used in any of the presets.

This has already been fixed in the development code.
PuzZLeR
Bright Spark User
Posts: 287
Joined: Tue Apr 24, 2007 4:01 am

Post by PuzZLeR »

leVnikolaïeVitch: I would venture to say that your settings verge rather on the "insane" side at any rate. No, not accusing you of being insane - it's a term used among the experienced encoders when high amounts of B or reference frames are used and the like. You may not need that much to begin with when the source is really only MPEG-2, especially more so when they may be problematic.
jbrjake wrote:Yes, > 14 b-frames do not work properly in 0.9.1 and that's why that many aren't used in any of the presets.

This has already been fixed in the development code.
Well, then that would be a problem with HB/x264 instead of the source. :wink:
Japester
Posts: 4
Joined: Thu Oct 18, 2007 12:34 pm

Perhaps it's Just My Settings

Post by Japester »

PowerMac G5 Dual 1.8Ghz/8Gb RAM/ATI 9500 64Mb
Source/Settings: PAL/Anamorphic 2500kbps H.264, 160kbps AAC
ref=6:bframes=16:direct=auto:weightb=1:subq=7:brdo=1:bime=1:me=umh:merange=64:analyse=all:deblock=0,0:trellis=2:cabac=0:mixed-refs=1:no-fast-pskip=1

I have been using Handbrake for a long time but have only recently run into problems. I've just ripped "Family Guy" Season 5 and every episode is out of sync. All previous seasons ripped without issue. Another batch of DVDs that are out of sync are 3 Studio Ghiblis (produced by Madman Entertainment [Australia]). I suspect that these discs are poorly mastered. Usually the above settings work well.

It could be bad discs but come to think of it, this issue started around the time I started using 0.9.0, and that's when I started tweaking the advanced settings (see above). I'll try it on the AppleTV preset and see if this is a factor.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

Sigh. Again:

Yes, > 14 b-frames do not work properly in 0.9.1 and that's why that many aren't used in any of the presets.

This has already been fixed in the development code.
Japester
Posts: 4
Joined: Thu Oct 18, 2007 12:34 pm

It Was My Settings

Post by Japester »

I've fallen back on AppleTV bare minimum, with the addition of 2 pass (turbo first pass). "Family Guy" ripped just fine.

On my top-quality settings, I've had most material come through fine (even some letterboxed movies cropped to 720 x 304 looked astounding for the resolution), so it looks like failure is disc-dependent. I'm running a new test now on a movie with the former insane settings, with the reduction in b-frames to 12. I'll see if that works.

I'm quality-obsessed, so I'll try any material at my top-quality settings first, and if it fails, I'll drop back to basics.
digital_user
Posts: 1
Joined: Tue Dec 15, 2009 10:37 am

Re: Audio sync problems

Post by digital_user »

Hi all,

I confirm what leVnikolaïeVitch posted above.
I had sync problem using MKV files generated by Handbrake on WD HDTVhttp://www.wdc.com/en/products/WDTV/ .

I was not doing any recode of the audio, so I knew the problem was not on Handbrake. I tweeked the settings:
Detelecine: OFF (on Video Filters tab)
Framerate (FPS): 25 (on Video tab)
Reference Frames: 6 (Advanced tab)
B-Frames: 6 (Advanced tab)
Weighted B-Frames: Unselected (Advanced tab)
8x8 DCT: Unselected (Advanced tab)
CABAC Entropy Coding: Unselected (Advanced tab)

With this settings (which I called High Profile Simple) was I able to playback files on my WD HDTV with sync problems.
For the sake of simplicity, I recomend a profile is created on Handbrake for standalone players...

Keep up the good work!!
User avatar
JohnAStebbins
HandBrake Team
Posts: 5583
Joined: Sat Feb 09, 2008 7:21 pm

Re: Audio sync problems

Post by JohnAStebbins »

Did you look at the date of the previous posts. The last post is more than 2 years old. So your problem is almost certainly unrelated. You really should have opened a new topic of your own with a more descriptive title.
Post Reply