Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th May 2018, 16:19   #1  |  Link
aNToK
Registered User
 
Join Date: Nov 2005
Location: California
Posts: 81
Setting suggestions for 2-pass encodes

Hi, been a while!

I've combed through the threads for tuning settings for x265 and most of what I've found seems to be related to the CQ settings. I'm looking to re-encode a large number of movies (200+) to play on my entertainment system and the bitrates are too high for my NAS to handle so I'm recoding them down to 3500-4000 kbps and the audio down to 640kbps so that they'll play consistently.

I tried the default settings and they were too smooth. The grain tune seems to work pretty well but are there any other settings that will improve the quality further? I read that the --no -sao parameter will reduce excess smoothing and it seems to work with the action films I'm encoding. Any other parameters or threads to look at to learn more?
aNToK is offline   Reply With Quote
Old 1st June 2018, 05:19   #2  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,771
Quote:
Originally Posted by aNToK View Post
Hi, been a while!

I've combed through the threads for tuning settings for x265 and most of what I've found seems to be related to the CQ settings. I'm looking to re-encode a large number of movies (200+) to play on my entertainment system and the bitrates are too high for my NAS to handle so I'm recoding them down to 3500-4000 kbps and the audio down to 640kbps so that they'll play consistently.

I tried the default settings and they were too smooth. The grain tune seems to work pretty well but are there any other settings that will improve the quality further? I read that the --no -sao parameter will reduce excess smoothing and it seems to work with the action films I'm encoding. Any other parameters or threads to look at to learn more?
These 1080p24?

It's useful to know how much buffering there is on the NAS. If it's a fair amount, raising --vbv-bufsize can help quality some.

Things like --no-sao can improve quality at high bitrates (although not nearly as much in more recent x265 builds) but can hurt quality at lower bitrates.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is online now   Reply With Quote
Old 1st June 2018, 20:23   #3  |  Link
abaxas
Registered User
 
Join Date: May 2018
Posts: 9
crf 22-26 - adjust to taste
qcomp=0.85 - 0.7-0.85 depending on the the level of motion in the film. In my testing the difference between 0.5 and 0.85 is about a 20-30% bitrate increase.
keyint= 72 - nice mix of seeking and smaller file size (3x fps)
bframes=12 - lower if your playing hardware doesn't support this.
ref=6 - max inside spec
no-sao - to taste but sao will allow for lower bitrates to look 'ok'.
slower/veryslow - preset

As above vbv will help with setting a max rate and excessing bloating on high motion scenes. (which need bitrate but not as much quality as static)

2 pass is pointless unless you need a target average bitrate just use crf.

I would set up the encode as above BUT with the ultrafast preset, let it run and see the rough target bitrate, adjusting crf relative (ie increase if too big, descrease if too small) then do a final pass with slower/veryslow. Noting the ultrafast preset will tend to make a file 10-20% more bloaty than the final encode.

Eg ultrafast with crf 24, if bitrate too low, crf 23 etc etc

brain dump offlined.
abaxas is offline   Reply With Quote
Old 1st June 2018, 21:50   #4  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
I recommend not using VBV to control excessive bloating on high motion scenes, it is better to increase qcomp (and crf number if needed). VBV is meant to keep it steamable and will generate lower quality video than normal rate control would if it has to cap the bitrate during a specific scene. VBV doesn't move bits around intelligently, it is a simple cap to avoid a buffer underrun so it can cause qp spikes.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Old 2nd June 2018, 01:46   #5  |  Link
aNToK
Registered User
 
Join Date: Nov 2005
Location: California
Posts: 81
Hi all, thanks for the replies! Yes, almost all of the shows I'm encoding are 1080p/24. I don't know what buffering my NAS has but it's throuput for simple file transfers is around 22Mbps. It's an old Buffalo one with a Raid-5 array in it. I just have it set up as a network drive on my media pc. Anything with a bitrate over about 10Mbps and it starts to pause and stutter.

Starting to wonder if I'm being too picky or if it'll end up taking too much encoding time. I have a little distributed encoding setup with ripbot and a few i5 computers that handle most of it. Together they about match my main computer for encoding speed but it ends up taking 9-11 hours per movie doing the 2-pass with the grain and slow presets. I think I'll give the one-pass a try and see if I'm happy with the results.

One question with the -sao setting. What is considered a "low" bitrate these days? I'm about 6 years removed from spending hours upon hours playing with avisynth scripts and feeling rusty...
aNToK is offline   Reply With Quote
Old 2nd June 2018, 12:00   #6  |  Link
abaxas
Registered User
 
Join Date: May 2018
Posts: 9
Agreed with the issue with vbv BUT providing it is sensibly set it can help.

In terms of 'low bitrate' I target ~100kbps for kids shows :P
abaxas is offline   Reply With Quote
Old 4th June 2018, 19:50   #7  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
SAO becomes debatable around 2Mbps @ 1080p24 in my opinion, which is roughly crf 23, although there are always outliers. Below that, I always enable it, above that, I always disable it, but that's about the point where it's hard to pick one way or the other. 4Mbps with VBV restrictions might still benefit, try a 10min test either way.

Your NAS situation is great; it's exactly the network bottleneck that VBV made for, without the network. 99% of the time, it won't matter, but that one scene that otherwise would stutter will work. --vbv-maxrate is pretty obvious, set it to what your NAS can transfer (taking into account periods of congestion), but --vbv-bufsize is not easy to measure if you don't have real hardware constraints; double the maxrate is usually the default, but either you have control over your player's buffers, or you just have to take a wild guess. You might try a couple settings and induce a load on your NAS to make sure it still streams smoothly, or else see if it has some kind of QoS to service TV requests before anything else. If all else fails, you could get a Pi with Kodi to cache video on, taking the TV's buffer out of the equation.
foxyshadis is offline   Reply With Quote
Old 4th June 2018, 20:23   #8  |  Link
Gser
Registered User
 
Join Date: Apr 2008
Posts: 418
These should help prevent blurring. I mostly use crf 21 or 22. You might want to reduce the psy settings if it doesn't look pleasant on lower bit rates e.g. jerkiness in motion or blotchy unstable grain.

--deblock=-2:-3
--psy-rd=1.75 --psy-rdoq=5.00
--no-strong-intra-smoothing
--rdoq-level 1 or 2 depending on your speed preset.

I wonder what exactly the qcomp setting does?

Last edited by Gser; 4th June 2018 at 21:24.
Gser is offline   Reply With Quote
Old 5th June 2018, 02:57   #9  |  Link
Wolfberry
Helenium(Easter)
 
Wolfberry's Avatar
 
Join Date: Aug 2017
Location: Hsinchu, Taiwan
Posts: 99
Quote:
Originally Posted by Gser View Post
I wonder what exactly the qcomp setting does?
Taken from www.mplayerhq.hu/DOCS/HTML/en/menc-feat-x264.html

qcomp trades off the number of bits allocated to "expensive" high-motion versus "cheap" low-motion frames. At one extreme, qcomp=0 aims for true constant bitrate (CBR). Typically this would make high-motion scenes look completely awful, while low-motion scenes would probably look absolutely perfect, but would also use many times more bitrate than they would need in order to look merely excellent. At the other extreme, qcomp=1 achieves nearly constant quantization parameter (CQP). Constant QP does not look bad, but most people think it is more reasonable to shave some bitrate off of the extremely expensive scenes (where the loss of quality is not as noticeable) and reallocate it to the scenes that are easier to encode at excellent quality. qcomp is set to 0.6 by default, which may be slightly low for many peoples' taste (0.7-0.8 are also commonly used).
__________________
Monochrome Anomaly

Last edited by Wolfberry; 5th June 2018 at 06:37.
Wolfberry is offline   Reply With Quote
Old 5th June 2018, 10:01   #10  |  Link
abaxas
Registered User
 
Join Date: May 2018
Posts: 9
In terms of qcomp, lower values 'spread' out the Q of I/Q/B frames more than a higher value. IE closer to 1 head towards constant Q.

The best way to see this in action is to pick a high CRF (35 is a good place to start) then encode a section at different qcomp settings to see how it works. You'll notice that at a lower qcomp (0.5) the I frames have a higher quality but motion is terrible, but at 0.9 qcomp the I frames will be of lower quality but the motion better.

Once you start to increase CRF it is harder to notice the differences as it's masked by a better overall 'quality'.

Also a lower qcomp will lead to a greater efficiency in more static content while a higher one is better for motion.

I use qcomp 0.85 with a crf of 28-30 for kids shows but 0.75 for standard film content at crf 25.
abaxas is offline   Reply With Quote
Old 5th June 2018, 14:20   #11  |  Link
Gser
Registered User
 
Join Date: Apr 2008
Posts: 418
I noticed movement in high motion parts was getting too jerky at higher qcomps so now I'm sticking to 0.7.
Gser is offline   Reply With Quote
Old 5th June 2018, 17:33   #12  |  Link
abaxas
Registered User
 
Join Date: May 2018
Posts: 9
Quote:
Originally Posted by Gser View Post
I noticed movement in high motion parts was getting too jerky at higher qcomps so now I'm sticking to 0.7.
Are you sure that's not a psy visual issue.

At lower bitrates (<256kbps) I switch off all psy options as they cause more harm than good and make panning look like the cameraman has parkinsons.
abaxas is offline   Reply With Quote
Old 5th June 2018, 19:53   #13  |  Link
Gser
Registered User
 
Join Date: Apr 2008
Posts: 418
Quote:
Originally Posted by abaxas View Post
Are you sure that's not a psy visual issue.

At lower bitrates (<256kbps) I switch off all psy options as they cause more harm than good and make panning look like the cameraman has parkinsons.
I am averaging ~6000kbps at 1080p24. But it is possible that psy hurts, i would rather keep my psy settings and a lower qcomp.

Last edited by Gser; 5th June 2018 at 19:56.
Gser is offline   Reply With Quote
Old 5th August 2018, 11:40   #14  |  Link
Forteen88
Herr
 
Join Date: Apr 2009
Location: North Europe
Posts: 556
Quote:
Originally Posted by foxyshadis View Post
SAO becomes debatable around 2Mbps @ 1080p24 in my opinion, which is roughly crf 23, although there are always outliers. Below that, I always enable it, above that, I always disable it, but that's about the point where it's hard to pick one way or the other.
What, do you mean it's the opposite to what B.Waggoner thinks?
B.Waggoner wrote:
Quote:
Things like --no-sao can improve quality at high bitrates (although not nearly as much in more recent x265 builds) but can hurt quality at lower bitrates.
Or do you mean "Below that, I always enable --no-sao, above that, I always disable --no-sao" ?!

EDIT: Never mind, I misunderstood foxyshadis!

Last edited by Forteen88; 6th August 2018 at 07:33.
Forteen88 is offline   Reply With Quote
Old 5th August 2018, 23:12   #15  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
I am quite sure foxyshadis meant below 2Mbps they always enable SAO (do not use --no-sao) while above 2Mbps they always disable SAO (use --no-sao).

Personally I use SAO at even higher bitrates, it has improved a lot since its initial testing. But I also agree with the general consensus that at high bitrates --no-sao can improve quality. At bitrates where x264 would look very good --no-sao is almost always beneficial.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Old 6th August 2018, 07:32   #16  |  Link
Forteen88
Herr
 
Join Date: Apr 2009
Location: North Europe
Posts: 556
Quote:
Originally Posted by Asmodian View Post
I am quite sure foxyshadis meant below 2Mbps they always enable SAO (do not use --no-sao) while above 2Mbps they always disable SAO (use --no-sao).

Personally I use SAO at even higher bitrates, it has improved a lot since its initial testing. But I also agree with the general consensus that at high bitrates --no-sao can improve quality. At bitrates where x264 would look very good --no-sao is almost always beneficial.
Oh, yeah, I should've understood that foxyshadis meant Mbps and not CRF when he wrote: "Below that, I always enable it, above that, I always disable it". Thanks.

And yeah, I did a SSIM-test on a very short cartoon, SAO got slightly higher SSIM-score than --no-sao.

Last edited by Forteen88; 6th August 2018 at 07:38.
Forteen88 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:41.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.