Shutter and Audio sync

Discuss encoding for devices and presets.
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.
loyalty_anchored
Bright Spark User
Posts: 183
Joined: Wed Mar 14, 2007 1:49 pm

Post by loyalty_anchored »

has anyone tried encoding that cat in tree scene with as well as without advanced x264 options?

im assuming this issue is related to hardware being unable to keep up, maybe one of the advanced option requires more decoding power and causes the ATV to choke on certain complex scenes?

just a thought, i dont have the DVD to reproduce this otherwise i would test it myself.
SicMX
Novice
Posts: 66
Joined: Thu Mar 22, 2007 11:31 pm

Post by SicMX »

I had a problem with High Crimes, stuttering video at times. Gonna test ripping without anamorphic tomorrow and also with mediafork just to see if it has any effect. So far non of my Mediafork rips have had any issues...
fwhite
Posts: 14
Joined: Tue May 01, 2007 12:35 am

Post by fwhite »

I don't think it's a hardware problem. Why does the same movie clip, the cat in the tree scene, doesn't have any shutter problems with Streamclip or VisualHub, even at 5000 kbs? I'm thinking it's a setting problem. I notice that there is a advance setting options, which I didn't realize there was so many options to enter. Maybe something is enables, which AppleTV has a hard time to decode.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

fwhite wrote:I don't think it's a hardware problem.
fwhite wrote:Maybe something is enables, which AppleTV has a hard time to decode.
Errr...wouldn't that be the very definition of a hardware problem? Set "cabac=0" as an x264 option and see if that helps. A week or two before the @tv was released, Apple nerfed its specs by removing cabac support. However, when people got the devices home and started testing for us, cabac worked fine at DVD rez. It's possible a high bitrate combined with this not-anywhere-near-"advanced" setting could cause the crappy hardware in the @tv to struggle. And I do believe a lame CPU not being able to decode main profile h.264 can indeed be called a hardware issue. After all, I don't call it a software issue when my PowerBook can't play back 720p h.264 trailers from Apple. You are running into the hardware limitations of your playback device. Know that turning cabac off will increase file size by 15-20% without improving picture quality.
Pleiades
Posts: 2
Joined: Mon May 21, 2007 10:04 pm

Post by Pleiades »

I have similar problems, though I don't notice much in the way of out-of-sync audio. It does stutter a lot and not just during action sequences. I've been trying to rip my Babylon 5 DVD's for display on my AppleTV and the lure of anamorphic with closed captioning have me using HB. Using the AppleTV preset plus 2-pass, de-interlacing, and closed captioning give me stuttering video on every episode, whether there's a lot of motion or not. One sequence comes to mind where a bunch of Centauri are just sitting at a conference table. It stutters throughout the scene.

I also see it when playing it back in QuickTime on the Mac desktop, so I don't think the AppleTV has a thing to do with it. Has anyone here tried playing their AppleTV-preset videos on the desktop to see if it stutters, too? Mine certainly does. That points to the encoding process, not the hardware.

When I encode using Visual Hub, I don't have anamorphic or closed captioning but I do get smooth-playing video that never stutters. I only use the normal AppleTV preset for VH with no modifications. I use standard quality because those 44-minute episodes end up being over a gigabyte using anything more. Even at standard for both VH and HB, I get over 800MB per video.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

Pleiades wrote:I have similar problems, though I don't notice much in the way of out-of-sync audio. It does stutter a lot and not just during action sequences. I've been trying to rip my Babylon 5 DVD's for display on my AppleTV and the lure of anamorphic with closed captioning have me using HB. Using the AppleTV preset plus 2-pass, de-interlacing, and closed captioning give me stuttering video on every episode, whether there's a lot of motion or not. One sequence comes to mind where a bunch of Centauri are just sitting at a conference table. It stutters throughout the scene.

I also see it when playing it back in QuickTime on the Mac desktop, so I don't think the AppleTV has a thing to do with it.
Please don't conflate separate issues.

If your videos aren't playing back right on your computer, that's a totally separate issue from stuttering playback only on the @tv.

Specify the correct FPS for your material. B5 probably is 29.97fps because of all the CGI shots. If you use "Same as source" fps you're getting 23.976, film speed. HB has no way of knowing if your material is NTSC film or NTSC video, just if it's PAL or NTSC. That's all "Same as source" has ever done. Don't complain to me about it because I hate it as much as everyone else. I complained about it before I even got involved in development. I tried to remove it entirely from the last beta. The wording will change eventually. It is discussed in countless threads. We've even had net.gods like jwz come here after getting screwed over by it.

Hopefully, this small change will let you leave the stuttering to Vir, that moon-faced assassin of joy =)
eddyg
Veteran User
Posts: 798
Joined: Mon Apr 23, 2007 3:34 am

Another example of repeatable stuttering

Post by eddyg »

Little Miss Sunshine - encoded using HB latest SVN with AppleTV preset

During the teenager melt down scene there is 5 minutes of stutter on the AppleTV. Watched it many times, same problem every time at the same place.

Watched the same scene on my Mac Pro, no stutter.

I suspect that the AppleTV truly can't handle the bittrates that we are throwing at it.

I'm assuming that when we select 2500kbps that this is an average. What attempts does the H.264 encoding make to limit this to under 5000kbps maximum rate that the AppleTV supports?

Are there any options that we can select in HB that can limit the maximum rate used?

I'm loath to use the CABAC thingy that jbrjake is suggesting other than as a last resort.

Cheers, Ed.
roundy

Post by roundy »

@jbrjake

Thanks for the reply. I've been meaning to post a question about the AppleTV preset, but I didn't want to bother you guys too much. After all, you've done so much hard work on making HB such a great program.

My question is this: how did the HB team develop the AppleTV preset?

Also, if possible without going into too technical a detail, what do the advanced option set by the AppleTV preset do?

When I first encounted this skipping/pausing problem, one of my thoughts was that the one of the advanced settings was doing it. But I wanted to eliminate all other possibilities first. Also, I really didn't want to go turning off the settings one by one to see which one may be the culprit. I thought maybe some settings are dependent on others. For example, turning off bframes=3 may do nothing or affect the trellis=2 setting.

In any case, in my tests simplying encoding with the h.264 Main profile and no advanced options at 2500kbps still has skipping/pausing problems.

So, here's my theory du jour about this: somethings wrong with the AppleTV decoder buffer. I think the AppleTV has a small buffer that holds some of the data stream before being decoded. Of course this is to prevent breaks in playback due to network or other problems. My guess is that the buffer is dynamic based on the data stream size/complexity. I've noticed that the pauses/stuttering seem to come most often right after an abrupt scene change. For example, a black title screen suddenly switching to a full screen motion shot. Then the buffer is suddnely drained because it was based on the low data, east to decode, black title screen. Now the AppleTV has to rebuffer based on the higher data/more complex full screen motion shot. The result is stuttering.

My thought was perhaps Apple can build in more manual control over the buffering in the Settings menu (e.g. set buffer to 5, 10 or 20 minutes).

I'm not sure if I explained that right. I don't know enough about the technical details of encoding/decoding h.264 to know even what I said makes any sense at all.

Basically my point is I'm not sure just setting cabac=0 is going to help. As I've see the problem with just HB encoding a straight h.264 Main Profile (no AppleTV preset, no "advanced" x264 options).

Sorry for the long post.

roundy
fwhite
Posts: 14
Joined: Tue May 01, 2007 12:35 am

Post by fwhite »

Do you know if by not using the presets with no advance setting will turn off all of the advance settings?
dynaflash
Veteran User
Posts: 3820
Joined: Thu Nov 02, 2006 8:19 pm

Post by dynaflash »

roundy wrote:My question is this: how did the HB team develop the AppleTV preset?

Also, if possible without going into too technical a detail, what do the advanced option set by the AppleTV preset do?
Well, first off, as soon as a few of us got our hands on one, we immediately started running hundreds of different test encodes using all sorts of different options. Much of the testing was done by cdaiger and myself, but many others that had an AppleTV did testing as well.

We wanted the best quality possible, but needed to address two things as well, streaming quality as well as staying below the 4 GB limit that HB currently has.

We did concentrated on bitrates that would provide reliable streaming in most reasonable circumstances. For a week or so, we were favoring a constant quality encode of 72% using crf . However, when encoding a particularly grainy dvd, we were getting > 4 GB output, which we realized would be a horrendous situation for a Built In Preset as you had no way of knowing you would break the 4 >GB limit until you actually did the encode. As well, even if the 4 > GB limit was not an issue, the resulting bitrate would make streaming in a less than perfect wireless network scenario very "iffy". So, we started concentrating on what type of quality we could get using an average bitrate for the video of 2500 - 3000 kbps. After much testing it was determined at that time the bitrate tradeoff going to 3000 kbps was really not worth any discernable video quality difference when output to a 42" - 50" lcd/plasma at 720p. The decision to just use 1-pass encoding was merely a tradeoff of video quality vs. encoding time.

As far as the x 264 advanced opt string: "bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:no-dct-decimate=1:trellis=2" jbrjake can probably explain better exactly what you get here, but trying several different options and values we felt this yielded the best quality vs. encode speed.

Note: the "no-dct-decimate=1" has since been dropped in the svn as it is typically used in constant quality encodes and in the HB-AppleTV preset we are using average bitrate.

Realize, the next release will likely feature updated Built-In Presets as we have more time testing encodes on various target devices, this is especially true of the AppleTV as it came out only weeks before we released HandBrake 0.8.5b1.
Brad Bishop
Posts: 4
Joined: Tue May 22, 2007 2:26 pm

Post by Brad Bishop »

Don't know if this will help but I was experiencing much the same thing.

The easiest place for me to see it was in Shrek during the opening title (chapter 1).

I was originally accepting the defaults for Windows GUI for Handbrake and it was Video avg: 3000Kbps

When I lowered it to 2000Kbps, all worked well. Also, I bumped the audio bitrate up to 192Kbps (from the default of 160Kbps) which seemed to help the 'hollow'-like sound I was getting.

I haven't run test after test on this stuff. I'm really just looking for 'OK - that works - good enough'
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

dynaflash wrote:Note: the "no-dct-decimate=1" has since been dropped in the svn as it is typically used in constant quality encodes and in the HB-AppleTV preset we are using average bitrate.
I found this interesting. What's the reference for this "typical usage", given that the effect is on P-frames?

If the Apple TV is level-compliant, I'd recommend bitrate=2500, vbv-maxrate=2500, and vbv-bufsize as 1708 (corresponding to level 3.1). This should prevent overwhelming bitrate spikes (but again, only if the Apple TV actually adheres to the H.264 specification).

Rodney
dynaflash
Veteran User
Posts: 3820
Joined: Thu Nov 02, 2006 8:19 pm

Post by dynaflash »

rhester wrote:What's the reference for this "typical usage", given that the effect is on P-frames?
jbrjake had me remove them for this reason, as I recall (hopefully, I havent misquoted the reason, if i have, then my apologies and I am happy to stand corrected).
cbud
Bright Spark User
Posts: 181
Joined: Thu Feb 22, 2007 2:24 am

Post by cbud »

Maybe CABAC/B-Frames should be removed from the Apple TV preset and instead the bitrate and subme could be bumped up?

If people what to use CABAC and B-Frames, they can make their own presets. Its not HB's fault the AppleTV has problems, it should not take the wrap because of some preset.
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

subme can always be increased without stress to the decoder - all it governs is accuracy. bitrate is, of course, another matter that I discussed earlier.

Rodney
cbud
Bright Spark User
Posts: 181
Joined: Thu Feb 22, 2007 2:24 am

Post by cbud »

rhester wrote:subme can always be increased without stress to the decoder - all it governs is accuracy. bitrate is, of course, another matter that I discussed earlier.

Rodney
I guess the question is whether the stutter is because of CABAC, the short bursts of high bitrates (>5000 kbs), or both. So, either the erratic bitrates need to be brought under control with more x264 options or CABAC might have to be left out of the Apple TV preset.

Does anybody have some x264 options (rate tolerance etc.) I can try on the 'Cat in the Tree' scene to see if that helps?

I don't have any serious stutter issues, so I honestly don't give a hoot, but I would like to try and help make that preset better for others.
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

cbud wrote:I guess the question is whether the stutter is because of CABAC, the short bursts of high bitrates (>5000 kbs), or both. So, either the erratic bitrates need to be brought under control with more x264 options or CABAC might have to be left out of the Apple TV preset.
I'm guessing it's a combination of the two.
cbud wrote:Does anybody have some x264 options (rate tolerance etc.) I can try on the 'Cat in the Tree' scene to see if that helps?
From a post earlier in this thread:

If the Apple TV is level-compliant, I'd recommend bitrate=2500, vbv-maxrate=2500, and vbv-bufsize as 1708 (corresponding to level 3.1). This should prevent overwhelming bitrate spikes (but again, only if the Apple TV actually adheres to the H.264 specification).

Rodney
fwhite
Posts: 14
Joined: Tue May 01, 2007 12:35 am

Post by fwhite »

I'm not sure if anyone has tried this but I turned off Cabac and the shutter problem went away. I even had the bitrate up to 5000kbs. I was vary happy, since I love using handbrake and didn't care for the other programs. Does anyone know the advantages of Cabac?
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

fwhite wrote:Does anyone know the advantages of Cabac?
Tighter compression efficiency (read: higher quality for same bitrate, or same quality with lower bitrate).

Rodney
SicMX
Novice
Posts: 66
Joined: Thu Mar 22, 2007 11:31 pm

Post by SicMX »

How do you turn off Cabac? Possible to do in the GUI version of Handbrake?
cbud
Bright Spark User
Posts: 181
Joined: Thu Feb 22, 2007 2:24 am

Post by cbud »

fwhite wrote:I'm not sure if anyone has tried this but I turned off Cabac and the shutter problem went away. I even had the bitrate up to 5000kbs. I was vary happy, since I love using handbrake and didn't care for the other programs. Does anyone know the advantages of Cabac?
I will confirm with the 'Cat in Tree' scene.
cbud
Bright Spark User
Posts: 181
Joined: Thu Feb 22, 2007 2:24 am

Post by cbud »

rhester wrote:
If the Apple TV is level-compliant, I'd recommend bitrate=2500, vbv-maxrate=2500, and vbv-bufsize as 1708 (corresponding to level 3.1). This should prevent overwhelming bitrate spikes (but again, only if the Apple TV actually adheres to the H.264 specification).

Rodney
Do I have to change the level to 3.1 or will this work under HB's Main Profile default? Can I use other x264 options as well?
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

I don't have enough experience with Apple TV to know if you must specify the level. You can use other compatible x264 options, yes, but you'd do well to know which ones those are before playing at random. I'd suggest starting with the Apple TV preset and modifying it accordingly.

Rodney
eddyg
Veteran User
Posts: 798
Joined: Mon Apr 23, 2007 3:34 am

Post by eddyg »

The AppleTV says that it can handle 5000kbps maximum bitrate, so maybe vbv-maxrate=5000 would ensure that we don't peak above that when doing average bitrate encoding?

A bit of experimenting with a problem scene should iron this one out without dropping cabac.

With cabac the AppleTV may be limited to an even lower peak bitrate than 5000.

Cheers, Ed.
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Post by rhester »

Ah - in that case, set both bitrate and vbv_maxrate to 5000, I thought it was published as 2500 for H.264.

Rodney
Post Reply