Pyramidal B-Frames and PS3 audio issue

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
gminnick
Posts: 23
Joined: Thu May 07, 2009 7:49 pm

Pyramidal B-Frames and PS3 audio issue

Post by gminnick »

I was wondering if anyone with a PS3 has had any audio issues when using Pyramidal B-Frames in 0.9.4? For me, the audio is slightly off. You have to watch closely but you can tell it is off. From my testing it seems to be the Pyramidal B-Frames. However, the video plays fine in Windows so I am sure it is a PS3 problem. I do not recall this happening in 0.9.3 and I have a video I made with 0.9.3 that uses Pyramidal B-Frames and it seems to be fine.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Pyramidal B-Frames and PS3 audio issue

Post by jbrjake »

Why would you want to turn off mbtree?
Deleted User 11865

Re: Pyramidal B-Frames and PS3 audio issue

Post by Deleted User 11865 »

jbrjake wrote:Why would you want to turn off mbtree?
To be more specific, did you add mbtree=0 to your x264 options string? Otherwise you're not using b-pyramid, so the issue is elsewhere.

Also, as jbrjake pointed out, turning off mb-tree is a bad idea. mb-tree is much more useful than b-pyramid.
gminnick
Posts: 23
Joined: Thu May 07, 2009 7:49 pm

Re: Pyramidal B-Frames and PS3 audio issue

Post by gminnick »

I will admit I am no x264 expert so the replies are a little confusing. I was not aware I was turning off mbtree. What in my comment led you to that conclusion? I am just selecting options on the Advanced tab and do not see anything called mbtree

Here is the option string that HB generates for the options I pick. I do not add or take away from the option string. I let HB do all of that until I learn more about other options.

b-adapt=2:rc-lookahead=50:direct=auto:b-pyramid=1:me=umh:subq=9:analyse=all:no-fast-pskip=1

I would guess if mbtree is necessary for b-pyramid then it would be automatically placed in the option string. If I unselect Pyramidal B-Frames which actually removes b-pyramid from the option string, it seems to help. The out of sync is very small. Probably 1/10" of a sec, but it is just enough that when you watch it you can tell something is off.
Deleted User 11865

Re: Pyramidal B-Frames and PS3 audio issue

Post by Deleted User 11865 »

gminnick wrote:b-adapt=2:rc-lookahead=50:direct=auto:b-pyramid=1:me=umh:subq=9:analyse=all:no-fast-pskip=1

I would guess if mbtree is necessary for b-pyramid then it would be automatically placed in the option string. If I unselect Pyramidal B-Frames which actually removes b-pyramid from the option string, it seems to help. The out of sync is very small. Probably 1/10" of a sec, but it is just enough that when you watch it you can tell something is off.
mbtree is on by default and is incompatible with b-pyramid. When mbtree is on, x264 automatically disables b-pyramid (i.e. the mbtree option overrides the b-pyramid option).

So in your string above, you're not actually using b-pyramid. I just tested this by doing 2 test encodes, one with your options, and one with your options minus "b-pyramid=1". Both encodes resulted in identical output (and neither were actually using b-pyramid).

To use b-pyramid, you'd need to have both b-pyramid=1 and mbtree=0 in your options string (which, as jbrjake and I pointed out, is not advisable - mbtree is "better" than b-pyramid).
Deleted User 11865

Re: Pyramidal B-Frames and PS3 audio issue

Post by Deleted User 11865 »

As jbrjake pointed out on IRC:
jbrjake wrote:hb uses an mp4 feature called an edit list to realign the audio after the video render offsets from b-frames. maybe the sync is always off on the ps3 when b-frames are on and it's only really noticeable with b-pyamid because the offset becomes larger?
which makes sense as even though b-pyramid=1 doesn't enable b-pyramid unless mbtree is disable with mbtree=0, having b-pyramid=1 in the string does cause the offset to be doubled.

So anyway, there's no reason to use b-pyramid anyway since its benefits are negligible compared to mbtree's benefits, and apparently it doesn't play well on the PS3 because of the increased offset.
gminnick
Posts: 23
Joined: Thu May 07, 2009 7:49 pm

Re: Pyramidal B-Frames and PS3 audio issue

Post by gminnick »

Rodeo wrote:mbtree is on by default and is incompatible with b-pyramid. When mbtree is on, x264 automatically disables b-pyramid (i.e. the mbtree option overrides the b-pyramid option).
Thanks for the clarification. The string I posted was the auto generated one HB uses and even though I was selecting b-pyramid with the checkbox I had no idea I needed to type in mbtree=0 if I actually wanted to use that option. A lot of this is still knew to me. But now I see that I don't need it from your recommendation. I used Media Info and it does shows b-pyramid=0 even though I had it checked. Thanks for pointing that out.
Last edited by Anonymous on Sun Dec 06, 2009 4:28 am, edited 1 time in total.
Reason: Fix quote
Deleted User 11865

Re: Pyramidal B-Frames and PS3 audio issue

Post by Deleted User 11865 »

The advanced panel hasn't been updated in a while. Next time it gets updated, b-pyramid will be removed from the panel altogether (now that x264 has mb-tree, it's not terribly useful - and it never was, even before mb-tree).
TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: Pyramidal B-Frames and PS3 audio issue

Post by TedJ »

Well, it was handy for breaking device playback compatibility. ;)
Spydor
Posts: 9
Joined: Fri Dec 05, 2008 5:42 am

Re: Pyramidal B-Frames and PS3 audio issue

Post by Spydor »

I am also seeing slight audio/video sync issues with the PS3 using 0.9.4. Plays fine in vlc on the workstation, but playing on the PS3 has issues. The VOB plays fine on the PS3, but the mp4 encodes have sync issues, although slight... usually about .5sec or less.

I am following the settings outlined in this thread: http://forum.handbrake.fr/viewtopic.php?f=7&t=16217, starting with the Regular High Profile.

I am encoding 2 audio tracks, AAC and AC3 Passthrough. Both tracks in the resulting encode are out of sync with the video on the PS3. I have also tried a variety of CQ settings, and my last attempt I used a 2-pass avg bitrate.

My last attempt:

Code: Select all

### CLI Query:  -i "D:\VTS_04_1.VOB" -t 1 -c 1 -o "D:\Handbrake\Test5.mp4" -f mp4 -w 720 -l 384 --detelecine --decomb -e x264 -b 1440 -2  -T  -a 1,1 -E faac,ac3 -6 dpl2,auto -R 48,Auto -B 160,auto -D 0.0,0.0 --markers="C:\Users\user\AppData\Local\Temp\Test5-1-chapters.csv" -x b-adapt=2:rc-lookahead=50:ref=16:bframes=4:slices=4:vbv-bufsize=30000:vbv-maxrate=40000 -v 1
Anyone have any thoughts? I don't recall having this type of issue in 0.9.3.
tlindgren
Bright Spark User
Posts: 260
Joined: Sun May 03, 2009 2:14 pm

Re: Pyramidal B-Frames and PS3 audio issue

Post by tlindgren »

Spydor wrote:I am also seeing slight audio/video sync issues with the PS3 using 0.9.4. Plays fine in vlc on the workstation, but playing on the PS3 has issues. The VOB plays fine on the PS3, but the mp4 encodes have sync issues, although slight... usually about .5sec or less.

I am following the settings outlined in this thread: http://forum.handbrake.fr/viewtopic.php?f=7&t=16217, starting with the Regular High Profile.
Spydor wrote:

Code: Select all

### CLI Query:  -i "D:\VTS_04_1.VOB" -t 1 -c 1 -o "D:\Handbrake\Test5.mp4" -f mp4 -w 720 -l 384 --detelecine --decomb -e x264 -b 1440 -2  -T  -a 1,1 -E faac,ac3 -6 dpl2,auto -R 48,Auto -B 160,auto -D 0.0,0.0 --markers="C:\Users\user\AppData\Local\Temp\Test5-1-chapters.csv" -x b-adapt=2:rc-lookahead=50:ref=16:bframes=4:slices=4:vbv-bufsize=30000:vbv-maxrate=40000 -v 1
Clearly you didn't read it, using ref=16 is just silly. I don't think there's any hardware decoder that can handle it either, I suspect it falls back on software decoding on your PC also instead of using the hardware acceleration on the graphics card (if you have that). Was the goal with the settings to discover if it was possible to make a PS3 glitch at DVD resolution? If so, congratulations!

The vbv settings is what the specification says it has to be handle as Blu-ray player (but the ref settings and possibly the b-frame setting violate it). If you're set on doing it this way you should reduce the ref and b-frames to 3 and then reduce the vbv-maxrate slightly just to get a little bit of safety margin.

For anything other than 1080p I'd really say restricting it to level 4.0 or lower, which also means you can drop the slices= parameter and the (minor?) hit in compression you get from it. Heck, much 1080p material is probably better that way too with modern x264 revisions.

As a Blu-ray player we know the hardware should be able to decode h.264 High@L4.0 and their own magic "L4.1 except smaller buffers and speed, fewer b-frames and at least 4 slices" that you tried to use but overshot. So shoot for High@L4.0 with "x b-adapt=2:rc-lookahead=50:ref=3:bframes=3:vbv-bufsize=24000:vbv-maxrate=24000" as a first step, though even those reduced values are still massive overkill for DVD resolution encodes.

It's a hair lower than what a Blu-ray capable unit should theoretically be able to handle (30k/25k for High@L4.0) but it happens to be a commonly recommended set of values for encoding 1080p for PS3/Xbox360... If it's Animation you're encoding it could be worthwhile to increase the number of B-frames up to 4-6, though some claim that some Blu-ray decoders are limited to 3 B-frames so there's a small risk involved. Max refs needs to be computed based on level and resolution, I'd say keep it at 4 or lower unless you've computed it for the specific combination.
joethezombie
Experienced
Posts: 81
Joined: Wed Dec 30, 2009 3:34 pm

Re: Pyramidal B-Frames and PS3 audio issue

Post by joethezombie »

You state you are using 0.9.4. I was also seeing slight audio drift with that release (I used to employ mkvtoolnix to fix the drift when 0.9.4 first came out and I was encoding to mkv for an m2ts remux for ac3 audio... shudder... i'm so happy that 3.30 gave us ac3 in mp4!). Anyway, try a nightly build. Doing so solved all my audio sync issues.

It should also be noted that nightly builds support b-pyramid along with MB-tree (this old thread pertains to 0.9.4 release, not nightlies, and specifies one must turn off mb-tree if using b-pyramids...).
tlindgren wrote:Clearly you didn't read it, using ref=16 is just silly. I don't think there's any hardware decoder that can handle it either, I suspect it falls back on software decoding on your PC also instead of using the hardware acceleration on the graphics card (if you have that). Was the goal with the settings to discover if it was possible to make a PS3 glitch at DVD resolution? If so, congratulations!
Yes, ref=16 may be silly, but the PS3 maintains level 4.2 compatibility including ref=16 with no issue at his resolution. Personally, I would use no more than 6 for anything at or below 720p, and 4 for anything above. Regadless, ref=16 is not the source of his audio drift. (I do need to update that thread stating that just because one can max out a setting, one should not necessarily do so. :wink: )

Code: Select all

:slices=4:vbv-bufsize=30000:vbv-maxrate=40000
is intended for demanding 1080p encodes, and is not needed for DVD resolutions. In fact, slices=4 is really only needed when using a vbv-maxrate above 30000. (PS3 starts to choke at 31500 without slices) For DVD, he would never come close to reaching that max, and its inclusion in the options string is meaningless.
Spydor
Posts: 9
Joined: Fri Dec 05, 2008 5:42 am

Re: Pyramidal B-Frames and PS3 audio issue

Post by Spydor »

Yeah, I know I did not need the slices, vbv-bufsize, and vbv-maxrate for the resolution I was encoding, and that I was on the extreme with the ref=16.... but this was my 10th+ encode, and I was grasping at straws at that point, willing to try anything to fix the audio drift.

I encoded to an mkv container, with just the ac3 passthrough audio track.. then using mkv2vob to create an mpg file, and that still works, with no audio sync issues. It almost seems like its a container issue with the PS3. Like I said, the mp4 encodes play fine in vlc on the workstation, just not on the PS3.

I will try the nightly build you linked me and report back. Thanks for the responses in this thread! I was nearly ready to post this issue in your PS3 thread :)
Spydor
Posts: 9
Joined: Fri Dec 05, 2008 5:42 am

Re: Pyramidal B-Frames and PS3 audio issue

Post by Spydor »

The nightly build (0.9.4.3314) seems to be working for me. So far, no audio sync issues with the mp4 container on the PS3.

thanks!
Post Reply