AppleTV Advanced Settings (Post PsyRDO)

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.
jbjoret
Regular User
Posts: 98
Joined: Sat Feb 16, 2008 12:08 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by jbjoret » Fri Nov 06, 2009 12:49 pm

mithrandir wrote:The CRF you choose depends on at least the source and your playback device (i.e. TV).

I've encoded SD videos (720x480) at CRF 21.5 for display on a 36" analog CRT TV and found that using a lower CRF barely improved perceptual quality.

However, I recently purchased a 50" plasma TV and now those videos don't look so good: I can see compression artifacts introduced by x264 since the displayed image is so much larger (over 2x). As a result I am now using CRF 19 though I am not sure that is good enough. Because the 50" screen is so "large" and the source is SD I can see psy-RDO effects in high-motion scenes where I did not notice them on the smaller 36" set...so I may need to dial down the psy-rd strength as well.

That said even at CRF 19 the average video bitrate on encodes can remain below 1000 kb/s. This is great compression considering the average MPEG2 source (DVD) is about 5000 kb/s.
I am not sure if using 19 will solve your problem on your 50" TV. Have you checked with the original SD video ? My experience is that no matter how good your x264 video is encoded, in the end it is the source that makes the difference (if it is a DVD which uses MPEG2, you won't get it better than the original). 720p with CRF 20 though looks fantastic for me on a 90" movie screen.

mithrandir
Regular User
Posts: 101
Joined: Sun Nov 30, 2008 2:24 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by mithrandir » Mon Nov 09, 2009 2:52 pm

jbjoret wrote: I am not sure if using 19 will solve your problem on your 50" TV. Have you checked with the original SD video ? My experience is that no matter how good your x264 video is encoded, in the end it is the source that makes the difference (if it is a DVD which uses MPEG2, you won't get it better than the original). 720p with CRF 20 though looks fantastic for me on a 90" movie screen.
If I compare the original MPEG2 source with an x264 encode, generally the biggest visual problem with the latter is blockiness in flat/low-contrast areas. I noticed this even on my analog 36" TV.

x264 handles bright, punchy, high-contrast scenes very well (say the "intro-to-Hobbits" sequence in Fellowship of the Ring). In fact, I found I could get surprisingly respectable output even with a CRF as high as 26. But if the source is lower-contrast (say some of the scenes in the mines of Moria) x264 needs to be told to use more bits.

While it may not be optimal, I am now using no-fast-pskip=1:no-dct-decimate=1:aq-strength=1.33. Increasing the aq-strength is perhaps the most beneficial for addressing blockiness but as you increase this value closer to 2.0, the bitrate increases dramatically...so it's a trade-off: lower CRF or increase aq-strength?

davidw89
Posts: 13
Joined: Tue Sep 15, 2009 3:30 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by davidw89 » Wed Nov 11, 2009 8:43 am

Is it a good idea to encode to 1280 x 720 and turn anamorphic off for AppleTV?

jbjoret
Regular User
Posts: 98
Joined: Sat Feb 16, 2008 12:08 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by jbjoret » Thu Nov 12, 2009 9:52 am

If the source is not HD 1080 or 720, I would not do that. Upscaling will add information that is not there, it might not be relevant at first, but your bitrate will have to increase too on average. In my opinion with the same bitrate you will reach a better keeping the anamorph settings.

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

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by dynaflash » Fri Nov 13, 2009 5:35 pm

Now, there is a new x264 option player on the block as of http://trac.handbrake.fr/changeset/2922 called weightp. Note that it is not present in the current SVN2907 Snapshot, but I am posting this here for those " gotta have the latest hb so I compile from svn on my own" folks, as well to prepare the atv users out there when the next release occurs.

I have been testing this much awaited feature for a few days on my AppleTV. Sad to say it is a No-Go. the modified qt 7.1 that the appletv uses to decode breaks on it. You can transfer via iTunes fine, but there is horrible blockiness particularly on fades. So.... if you use svn 2922 or greater you will need to add:

Code: Select all

weightp=0
To your advanced option string. So, this would make my own preferred option string for HandBrakes current svn head:

Code: Select all

ref=3:mixed-refs=1:bframes=3:me=hex:subq=7:b-adapt=2:8x8dct=1:weightb=0:trellis=0:weightp=0
Note: I have tried every permutation of weightp on the atv. It breaks on all of them as of atv 3.0.1

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

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by rhester » Fri Nov 13, 2009 6:13 pm

How strange. The whole point of weightp was that it was supposed to help fades. Urk. :/

Rodney

User avatar
Rodeo
HandBrake Team
Posts: 12272
Joined: Tue Mar 03, 2009 8:55 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by Rodeo » Fri Nov 13, 2009 6:14 pm

rhester wrote:How strange. The whole point of weightp was that it was supposed to help fades. Urk. :/

Rodney
Well, according to Dark_Shikari it does (haven't noticed the difference yet). But of course that's only if the player supports it, and the ATV apparently doesn't.

vidjock
Posts: 26
Joined: Tue Sep 30, 2008 9:50 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by vidjock » Fri Nov 13, 2009 6:32 pm

dynaflash why no trellis? I have noticed a nice increase in detail with a little in file size. IMHO with how well mb tree keeps the bit rate down while maintaining quality, the extra file size increase is no big deal.

Here's my settings.

Code: Select all

ref=3:mixed-refs=1:bframes=3:me=umh:subq=7:b-adapt=2:8x8dct=1:weightb=0:weightp=0:trellis=1:psy-rd=1.0,0.3

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

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by dynaflash » Fri Nov 13, 2009 6:36 pm

vidjock wrote:dynaflash why no trellis? I have noticed a nice increase in detail with a little in file size. IMHO with how well mb tree keeps the bit rate down while maintaining quality, the extra file size increase is no big deal.

Code: Select all

ref=3:mixed-refs=1:bframes=3:me=umh:subq=7:b-adapt=2:8x8dct=1:weightb=0:weightp=0:trellis=1:psy-rd=1.0,0.2
Well ... frankly only because I tried to up my encoding speed a bit post hb 0.9.3 and found that trellis was a relatively big speed hit ( encodes on a 2.16 c2d mbp ). I have been meaning to do some trellis vs. no trellis comparisons lately ... but haven't gotten to it yet. :)

Edit: big kudos to mbtree, its awesome imho.

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

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by dynaflash » Fri Nov 13, 2009 6:44 pm

Rodeo wrote:
rhester wrote:How strange. The whole point of weightp was that it was supposed to help fades. Urk. :/

Rodney
Well, according to Dark_Shikari it does (haven't noticed the difference yet). But of course that's only if the player supports it, and the ATV apparently doesn't.
Apparently it has more to do with the fact that decoding is broken on the atv's modified Qt 7.1 than an issue with x264's implementation. However note that with the weightp commit there is also fade detection if weightp=0 which *does* seem to improve fades with mbtree. So, its a mixed bag.

Da Man
Bright Spark User
Posts: 181
Joined: Sat Mar 08, 2008 5:47 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by Da Man » Fri Nov 13, 2009 6:49 pm

Just out of curiousity, when vidjock posted his settings, his final line is psy-rd=1.0,0.3. But when Dynaflash copy and pasted it, the final line is psyrd=1.0,0.2. Any idea why? And which is it?

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

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by dynaflash » Fri Nov 13, 2009 6:51 pm

dunno, I just hit "Quote" I imagine his settings are in his original post.

As per Dark_Shikari. I do not mess with the psy-rd defaults for my encodes.

Edit: Da Man ... I never knew you actually read these ! :)

Da Man
Bright Spark User
Posts: 181
Joined: Sat Mar 08, 2008 5:47 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by Da Man » Fri Nov 13, 2009 6:56 pm

How can I be snarky and harassing if I don't at least gloss over every post that has "Dynaflash" in it? I run something similar to a Googlebot, except it explicitly seeks out thread changes made by you and JBRJake for rebuttal or ill-witted humor.

Truthfully, this is a daily stop during lunch. You don't learn if you don't read. And I have come to enjoy simply watching this little beast progress.

vidjock
Posts: 26
Joined: Tue Sep 30, 2008 9:50 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by vidjock » Fri Nov 13, 2009 7:05 pm

Da Man, dyanflash quoted me while I was correcting my mistake. I use 0.3. Yes trellis is a speed hit. I went from 23 to 28 fps to 15 to 20 on my iMac C2D 2.4.

Da Man
Bright Spark User
Posts: 181
Joined: Sat Mar 08, 2008 5:47 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by Da Man » Fri Nov 13, 2009 7:12 pm

Speed's not an issue with me. I typically start an encode of three to four movies, drink a handbrake or two, pass out urinating through my neighbor's mail slot, and wake up to find them finished. It all balances out. It's a yin/yang thing.

:lol:

vidjock
Posts: 26
Joined: Tue Sep 30, 2008 9:50 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by vidjock » Fri Nov 13, 2009 7:19 pm

Da Man wrote:Speed's not an issue with me. I typically start an encode of three to four movies, drink a handbrake or two, pass out urinating through my neighbor's mail slot, and wake up to find them finished. It all balances out. It's a yin/yang thing.

:lol:
I hope your neighbor doesn't have a dog.
:D

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

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by rhester » Fri Nov 13, 2009 7:24 pm

I guess this says it all about the ATV decoder (from the x264 changelog):
All weightp modes may cause minor breakage in non-compliant decoders that take shortcuts in deblocking reference frame checks.
Rodney

User avatar
Rodeo
HandBrake Team
Posts: 12272
Joined: Tue Mar 03, 2009 8:55 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by Rodeo » Fri Nov 13, 2009 7:35 pm

dynaflash wrote:
Rodeo wrote:
rhester wrote:How strange. The whole point of weightp was that it was supposed to help fades. Urk. :/

Rodney
Well, according to Dark_Shikari it does (haven't noticed the difference yet). But of course that's only if the player supports it, and the ATV apparently doesn't.
Apparently it has more to do with the fact that decoding is broken on the atv's modified Qt 7.1 than an issue with x264's implementation. However note that with the weightp commit there is also fade detection if weightp=0 which *does* seem to improve fades with mbtree. So, its a mixed bag.
Well by "it" I meant weighted p-frame prediction, not "x264's implementation of weighted p-frame prediction".
vidjock wrote:dynaflash why no trellis? I have noticed a nice increase in detail with a little in file size. IMHO with how well mb tree keeps the bit rate down while maintaining quality, the extra file size increase is no big deal.
When I originally compared trellis vs. no trellis, that was my impression, but at some point after testing on more sources I found that even in CRF mode, trellis doesn't necessarily increase file size, it sometimes reduces it (IIRC, more often than not, but I can't find the spreadsheet where I logged all that right now).

Starhawk
Regular User
Posts: 90
Joined: Sun Feb 24, 2008 8:27 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by Starhawk » Sun Nov 15, 2009 8:34 pm

Does anyone use different deblock settings for their ATV encodes? I've noticed that the x264 tuning setting for "Film" are -1-1 and "Grain" are -2-2. I'm going to do some tests soon, but curious as to your impressions.

jbjoret
Regular User
Posts: 98
Joined: Sat Feb 16, 2008 12:08 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by jbjoret » Tue Nov 17, 2009 2:15 pm

Thanks for the update with "weighp". I have converted 6 HD movies in the last past days using a svn > 2930. I guess they need to be redone.

User avatar
Rodeo
HandBrake Team
Posts: 12272
Joined: Tue Mar 03, 2009 8:55 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by Rodeo » Tue Nov 17, 2009 2:21 pm

jbjoret wrote:Thanks for the update with "weighp". I have converted 6 HD movies in the last past days using a svn > 2930. I guess they need to be redone.
Actually, weightp has been in since 2922, FWIW.

jbjoret
Regular User
Posts: 98
Joined: Sat Feb 16, 2008 12:08 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by jbjoret » Tue Nov 17, 2009 6:45 pm

I am a little confused: in svn2922 it was updated with "update x264 to r1332 Default weightp to none for baseline. user can override." What does this mean ? That weightp=0 if I do not change anything ? In which case I don't need to reencode 10 HD Movies. Or am I unlucky ?

User avatar
JohnAStebbins
HandBrake Team
Posts: 5484
Joined: Sat Feb 09, 2008 7:21 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by JohnAStebbins » Tue Nov 17, 2009 7:30 pm

It means that if your settings had bframes=0, the weightp=0 got added for you by default. If bframes != 0, the weightp=2 is the default.

jbjoret
Regular User
Posts: 98
Joined: Sat Feb 16, 2008 12:08 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by jbjoret » Tue Nov 17, 2009 7:42 pm

JohnAStebbins wrote:It means that if your settings had bframes=0, the weightp=0 got added for you by default. If bframes != 0, the weightp=2 is the default.
Thanx, that is what I feared. Need to redo everything then.

Berylium
Posts: 23
Joined: Wed Apr 04, 2007 11:44 pm

Re: AppleTV Advanced Settings (Post PsyRDO)

Post by Berylium » Wed Nov 18, 2009 4:26 am

I was discouraged about the AppleTV's latest abortion, read: weightp fail, and talked with Dynaflash about it in IRC for a bit. We covered a few issues but principally the need for a more efficient h264 encoder for the ATV's version of QuickTime. I recalled that Perian, installed on a Mac, will use its own decoder for high profile h264 video. Since Perian can be hacked onto an ATV I decided to see if Perian on an ATV would also force the use of its own h264 decoder.

After some fooling around I found that Perian's h264 decoder can indeed be used on the AppleTV and there is both good news and bad news. The good news is that Perian's decoder has no problems at all with weightp, where the ATV's decoder doesn't work at all the Perian decoder works beautifully. The bad news, as noted in AwkwardTV's wiki, is that Perian's decoder, while more robust technically, is slower than the AppleTV's decoder.

On 480p material I did not see the Perian decoder struggle but I did not test very extensively. However, on 720p material the Perian decoder was very obviously struggling at all times on the test movie I used (G.I. Joe). The Perian decoder drops frames when it struggles which is far more graceful than the ATV's built in decoder which just throws up when pushed past its limit. Unfortunately, Perian struggles so much that it's not a viable solution with 720p encodes.

Based on forum threads and Trac tickets on Perian's website it seems the latest version of Perian, 1.1.4, has issues with high profile h264 with B-frames. To be thorough I also tried Perian's h264 decoder from Perian 1.1.3 on the AppleTV since it did not experience the problem 1.1.4 has. Very subjectively I think 1.1.3 decoded a little more smoothly but, again, the number and consistency of frame drops do not allow it to be a viable option.

If anyone would like to test Perian's decoder for themselves the steps to do so are fairly simple:
1. Hack your AppleTV with a patchstick. You can use the atvusb-creator http://code.google.com/p/atvusb-creator/ or PatchStickBuilder http://patchstick.wikispaces.com/PatchStickBuilder. I had to use the latter since it was the only one to easily find the ATV 3.0.1 update.
2. Download Perian 1.1.4 http://perian.org, or, if you'd like Perian 1.1.3 which doesn't have the potential B-Frame problems of 1.1.4 VersionTracker keeps around older copies: http://tc.versiontracker.com/product/re ... _1.1.3.dmg
3. The Perian download contains Perian.prefPane inside of which you'll find /Contents/Resources/Components/Perian.zip which contains Perian.component, the "file" we want.
4. SSH in to your hacked AppleTV (frontrow@[ip address of ATV], password is "frontrow"). In ~/Library create the folder "QuickTime" and copy the Perian.component into this new folder.
5. The ATV won't use Perian's decoder for high profile h264 decodes unless its own decoder is AWOL. Backup this file first but you'll need to "sudo rm -rf /System/Library/QuickTime/QuickTimeH264.component".
6. Restart your AppleTV and test away. To restore your ATV's decoder just copy the backed up QuickTimeH264.component back into /System/Library/QuickTime and restart the ATV. If you failed to backup you'll want to perform a Factory Restore.

For my tests I used HandBrake built from svn 2922. My 480p encodes were done with RF 19.5 and the following options:

Code: Select all

ref=3:mixed-refs=1:bframes=3:me=umh:subq=9:b-adapt=2:8x8dct=1:merange=24:no-fast-pskip=1:analyse=all:weightb=0:psy-rd=1.0,0.1:trellis=2
My 720p encodes were done with RF 22.25 and the following options:

Code: Select all

ref=3:mixed-refs=1:bframes=3:me=umh:subq=9:b-adapt=2:8x8dct=1:merange=24:no-fast-pskip=1:analyse=all:cabac=0:weightb=0
The 720p test was streamed to the ATV.

Post Reply