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)

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th September 2017, 00:49   #1  |  Link
Merlin93
Media Enthusiast
 
Join Date: Jul 2017
Location: San Francisco, CA
Posts: 10
What are your baseline x265 encoding settings?

Hey folks,

I've been searching these forums and the web and have come to the conclusion that there isn't really a good collection of baseline encoding settings or proposed tunes for x265 that cover various types of media. Given x265 doesn't really provide much in the way of content specific tunes (aside from grain), this seems like something that would be useful to the enthusiast community, and would give people a good starting point for their own content-specific tweaks.

So I am proposing establishing a sticky thread (or using this one) as a place where people can share their settings and discuss what works (or doesn't work) and why. Assuming others are interested, of course.

Obviously, I have my own agenda since I'm in process of converting a large collection of DVD & BR media to digital format, and I'd like to use HEVC for at least some of it, so getting some good advice to tackle some of that would be handy.

As a starting point, I found the following as the most recent proposed tunes for animation and film in the HEVC discussion forum (crf 18 @ 1080p). However, they were posted more than a year ago, and may no longer be relevant based on the changes that have been made to x265 in that time...

animation:

Code:
--ctu 32 --ref 4 --bframes 6 --pbratio 1.2 --cbqpoffs -3
--crqpoffs -3 --no-sao --subme 3 --b-intra --no-amp --weightb 
--aq-mode 3 --aq-strength 0.8 --rd 4 --psy-rd 1.8 --psy-rdoq 1.5
--rdoq-level 2 --rc-lookahead 80 --qcomp 0.65
--no-strong-intra-smoothing --limit-modes
film:

Code:
--ctu 32 --pbratio 1.2 --cbqpoffs -3 --crqpoffs -3
--no-sao --subme 3 --b-intra --no-amp --weightb --aq-mode 3
--aq-strength 0.9 --rd 4 --psy-rd 2.5 --psy-rdoq 4.0
--rdoq-level 2 --rc-lookahead 80 --qcomp 0.65
--no-strong-intra-smoothing --limit-modes
I'm curious what people are using now, and whether these settings still make sense?

Personally, I use the following for animation/anime (non-CGI 1080p BR transfers), but I suspect it can be improved...

Code:
--aq-mode 3 --aq-motion --aq-strength 0.9
--rc-lookahead 80 --deblock -3:-3 --tskip --tskip-fast
--tu-inter-depth 4 --tu-intra-depth 4 --limit-tu 4 --no-sao
Still looking for good settings for general films (low action, low-to-medium grain), action films (live-action martial arts, car chases, giant robots), and CGI (3d animation, Pixar, etc.) I'd also like to see what folks use for animation/anime.

What do you use for your own content, and why?

Last edited by Merlin93; 28th September 2017 at 01:04.
Merlin93 is offline   Reply With Quote
Old 28th September 2017, 12:26   #2  |  Link
jd17
Registered User
 
Join Date: Jun 2017
Posts: 89
I got a lot of help/advice here, so these conclusions are not just my own:
https://docs.google.com/spreadsheets...it?usp=sharing

Maybe it helps.

Essentially, especially since x265 2.4, not too much alteration is needed in my experience to get transparent encodes from Blu-rays:

main10
CRF: 16-20
Tune: none
Preset: slow, slower or veryslow
Custom: --no-sao

That's basically it.
In my opinion, --no-sao is all the deviation from x265 2.4+ standards that is needed.


However, my experiences are just with regular film or 3D animation / CGI, no anime / 2D animation stuff.

If I encounter sources with extreme grain, I either use x264 or don't bother at all and just remux.
I also just remux, if a Blu-ray is already highly compressed, more than usual (=low bitrate).


I got help in these two threads:
https://forum.doom9.org/showthread.php?t=174679
https://forum.doom9.org/showthread.php?t=174491
Those were mainly about UHD, but I got some input for regular 1080p stuff as well.


YMMV.
jd17 is offline   Reply With Quote
Old 1st October 2017, 00:39   #3  |  Link
RanmaCanada
Registered User
 
Join Date: May 2009
Posts: 328
I still use
pmode:rd=4:tu-intra-depth=3:rdoq-level=2:early-skip:b-intra:limit-modes:aq-mode=2:qg-size=16:ipratio=1.38bratio=1.28:me=3:max-merge=3:weightb:bframes=6:rc-lookahead=50:ref=6sy-rdoq=1.38:no-sao for anime. Works wonders in handbrake.
RanmaCanada is offline   Reply With Quote
Old 1st October 2017, 09:37   #4  |  Link
Merlin93
Media Enthusiast
 
Join Date: Jul 2017
Location: San Francisco, CA
Posts: 10
Quote:
Originally Posted by Wolfberry View Post
I use the following setting:
--crf 14~16 --preset placebo --limit-refs 1 --limit-tu 1 --psy-rdoq 2~4 (--tskip-fast) --limit-modes --rd-refine (--ssim-rd) --splitrd-skip --qg-size 8 --aq-strength 0.8~0.9 --qcomp 0.65~0.75 (--cbqpoffs -3 --crqpoffs -3) --pbratio 1.2 --rc-lookahead 80 --pmode --limit-sao --no-strong-intra-smoothing
() are optional
Using StaxRip on Threadripper 1950X
Is that for Animation or just in general?
Merlin93 is offline   Reply With Quote
Old 3rd October 2017, 05:15   #5  |  Link
Merlin93
Media Enthusiast
 
Join Date: Jul 2017
Location: San Francisco, CA
Posts: 10
Quote:
Originally Posted by Wolfberry View Post
Most of my content is anime/animation, so you could take it as a anime setting.
But my setting prioritizes quality over size/speed, so it may not be suitable for a "baseline setting".
And there does not exist universal setting parameters for every content, you can even tweak your parameters by episode if you want.
No parameters are perfect, but I think that it still has its reference value.
Got it.

Yeah, I realize that settings will always need to be tweaked depending on the specific content and how well/poorly it was mastered. So when I say baseline, I mean the starting point before making any tweaks.
Merlin93 is offline   Reply With Quote
Old 3rd October 2017, 08:40   #6  |  Link
excellentswordfight
Lost my old account :(
 
Join Date: Jul 2017
Posts: 322
Quote:
Originally Posted by Merlin93 View Post
Got it.

Yeah, I realize that settings will always need to be tweaked depending on the specific content and how well/poorly it was mastered. So when I say baseline, I mean the starting point before making any tweaks.
The presets are already tweaked for general/baseline usage so when talking about non content specific scenarios you might as well just start there. I would say that --preset slow --no-sao is a pretty good baseline when quality is prioritized. SAO is in my experience only usefull for high CRF-values/low bitrates.


Personally the only other parameters I set are: --keyint fps*10 --min-keyint fps --rc-lookahead fps*2 and --bframes 8 for 50/60p material. + ofc VUI flags for color info etc.

Last edited by excellentswordfight; 3rd October 2017 at 09:02.
excellentswordfight is offline   Reply With Quote
Old 3rd October 2017, 08:57   #7  |  Link
Merlin93
Media Enthusiast
 
Join Date: Jul 2017
Location: San Francisco, CA
Posts: 10
Quote:
Originally Posted by excellentswordfight View Post
The presets are already tweaked for genereal/baseline usage so when talking about non content specific scenarios you might as well just start there. I would say that --preset slow --no-sao is a pretty good baseline when quality is prioritized. SAO is in my experience only usefull for high CRF-values/low bitrates.
I appreciate that, and as an extremely low-level baseline, yeah that does make sense. However, it cannot really be a great baseline tune for all types of media. But currently, x265 only supplies a tune for high grain content.

As mentioned in my first post, my personal interest is to find x265 equivalents to tunes for animation, CGI, low action film, and fast action film content. Though ultimately I think it would be helpful to use this thread as a good place to discuss tuning in general and what people like for various types of content. Of course, it would be more useful if we can explore why various settings work best for different types of content, but since activity on this thread is fairly slow, I'd be happy to see any submissions.

I've found that my experience with x264 tuning doesn't really apply directly for x265. Or at least, using similar settings doesn't get the same results that I would expect. So I'd really like to understand what others use (and why) to help inform my own choices as I move more of my library to x265.

Thanks for the feedback.
Merlin93 is offline   Reply With Quote
Old 3rd October 2017, 19:52   #8  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,406
I have been testing sao with the new builds of x265. It does not seem to smooth the way it used to.

For 1080p anime I have had good results with:
--crf 18 -p 8 -F 1 --pools "5" --lookahead-slices 0 --rd-refine --tskip --tskip-fast --tu-inter 4 --tu-intra 4 --limit-tu 4 --rect --amp --limit-modes --no-strong-intra-smoothing

Adding --no-sao hurt quality and did not improve sharpness. This was not the case the last time I tested sao (probably about 6 months ago).

Does this match anyone else's experience?
__________________
madVR options explained

Last edited by Asmodian; 3rd October 2017 at 19:55.
Asmodian is offline   Reply With Quote
Old 19th October 2017, 09:44   #9  |  Link
Arhu
Registered User
 
Join Date: Nov 2003
Posts: 12
Quote:
Originally Posted by Asmodian View Post
Adding --no-sao hurt quality and did not improve sharpness. This was not the case the last time I tested sao (probably about 6 months ago).
I only started testing with x265 2.5, don't know what it was before. I thought --no-sao made faces look dirty and prefer --sao.

As for the OP's question -- after lots of testing I came to the conclusion that I don't really like film grain. I don't like plastic faces either, however, so I'm trying to find a balance between the two for a more "natural" look. I also endlessly tried to decide which presets and settings I want to use, with no final result. After even more testing I decided to go for relatively simple presets.

1.
Apply slight digital noise reduction:
Code:
clip = core.fmtc.bitdepth(clip, bits=16)
clip = core.knlm.KNLMeansCL(clip, d = 4, s = 4, a = 4, h = 0.5)
Low values for h like 0.5 or 0.6 are usually good enough to mostly get rid of fine background noise in conjunction with x265's smoothing parameters (strong intra smoothing and sao). I also tried using BM3D and a refined combination of the two but it was just too slow.

2.
- Video parameters:
Bit depth: 10. Haven't experimented too much with 12.
Speed preset: Very slow (as others have already found out: at least Slow)
Custom parameters:
  • -- aq-mode 3. I think this is necessary to get rid of artifacts in dark scenes that can appear even with CRF 16. It might be too strong by default and I tried with aq-strength 0.9 too, like others, but couldn't make up my mind.
  • --sao (default). --no-sao made faces look dirty
  • --strong-intra-smoothing (default). I think it's a must for CRF >= 20, but even for lower CRF values I thought the picture looked more accurate with this enabled.
- Audio parameters (Opus):
Code:
-mapping_family 1
... for 5.1+ encoding, to make sure the Opus library uses its multi-channel improvements from version 1.1. (At least in Staxrip 1.6 this needs to be set explicitly.)

3.
I use these quality presets as a guideline for video and audio. I also choose depending on how much I like a movie.
Note that these values are for noise reduced sources -- see step 1. Without the slight DNR I'd probably go 1 CRF higher for everything.

Code:
          Video                      Audio
 Q     ||  CRF  || Opus 2.0 | Opus 5.1 | Opus 6.1 | Opus 7.1  || Source Quality
-------++-------++----------+----------+----------+-----------++----------------
 Q0    ||  16   || 160 kbps | 400 kbps | 480 kbps | 560 kbps  || T0 Blu    movies (reference)
 Q0.5  ||  16.5 || 152 kbps | 380 kbps | 456 kbps | 532 kbps  || T0 Blu    movies (reference)
 Q1    ||  17   || 144 kbps | 360 kbps | 432 kbps | 504 kbps  || T1 Gold   movies
 Q1.25 ||  17.5 || 136 kbps | 340 kbps | 408 kbps | 476 kbps  || 
 Q1.5  ||  18   || 128 kbps | 320 kbps | 384 kbps | 448 kbps  ||
 Q1.75 ||  18.5 || 120 kbps | 300 kbps | 360 kbps | 420 kbps  || 
 Q2    ||  19   || 112 kbps | 280 kbps | 336 kbps | 392 kbps  || T2 Silver movies | T1 Gold series
 Q2.25 ||  19.5 || 104 kbps | 260 kbps | 312 kbps | 364 kbps  || 
 Q2.5  ||  20   ||  96 kbps | 240 kbps | 288 kbps | 336 kbps  ||
 Q2.75 ||  20.5 ||  88 kbps | 220 kbps | 264 kbps | 308 kbps  || 
 Q3    ||  21   ||  80 kbps | 200 kbps | 240 kbps | 280 kbps  || T3 Bronze movies | T2 Silver series
 Q3.25 ||  21.5 ||  76 kbps | 190 kbps | 228 kbps | 266 kbps  || 
 Q3.5  ||  22   ||  72 kbps | 180 kbps | 216 kbps | 252 kbps  ||
 Q3.75 ||  22.5 ||  68 kbps | 170 kbps | 204 kbps | 238 kbps  || 
 Q4    ||  23   ||  64 kbps | 160 kbps | 192 kbps | 224 kbps  || T4 Copper movies | T3 Bronze series
 Q4.5  ||  23.5 ||  60 kbps | 150 kbps | 180 kbps | 210 kbps  ||
 Q5    ||  24   ||  56 kbps | 140 kbps | 168 kbps | 196 kbps  || T5 Coal   movies | T4 Copper series
The tier ratings for movies and series I take from Blu-ray UHD Picture Quality Rankings PQ Tiers July 2017 at avsforum. For series I usually choose 2 CRF higher or go by the amount of episodes they have per season as a rough guideline -- and by how much I like them.

Without noise reduction I'd increase CRF by 1. With noise reduction I figure CRF needs to be one step lower to compensate for an increased chance of artifacts, but on the plus side the bitrate is used for detail that actually matters to me. Sound bitrates should be more or less proportional to the video bitrates between presets.

Regarding Atmos / DTS-X, I'm not sure if or when I'd keep it, especially if the tracks are lossless, which I think is overkill. I'd very much prefer their lossy variants, but there's no readily available encoder for that, is there?

In general I suppose the presets I'd use most often are Q2 (CRF=18 for movies) or Q3 (CRF=20 for TV shows).


I also like JD17's spreadsheet for presets, although I guess those are more for grain keeping.

Last edited by Arhu; 30th December 2017 at 22:57.
Arhu is offline   Reply With Quote
Old 20th October 2017, 19:10   #10  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,750
Quote:
Originally Posted by Asmodian View Post
For 1080p anime I have had good results with:
--crf 18 -p 8 -F 1 --pools "5" --lookahead-slices 0 --rd-refine --tskip --tskip-fast --tu-inter 4 --tu-intra 4 --limit-tu 4 --rect --amp --limit-modes --no-strong-intra-smoothing
Why --pools "5"? Are you running on a NUMA system? I would think that explicitly setting --frame-threads would control quality and perf better. If you're running on a NUMA system, you can then set --pools "+,-" or whatever.

The number of frame threads is what impacts quality in multithreaded encoding, so better to set that directly and let x265 figure out how many cores and threads it can productively use for that encode.

using --pool 5 would map to --frame-threads 3.

Or is this about something else entirely?
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 4th November 2017, 12:32   #11  |  Link
Toku
Registered User
 
Join Date: Jan 2012
Posts: 14
For anime I'm using the below on CRF 19-20 depending on the source (Ripped from BD using makeMKV)

Code:
–profile main10 –output-depth 10 –tune grain –aq-mode 3 –preset veryslow –aq-strength 0.8 –ctu 32 –qcomp 0.8 –psy-rd 1 –tu-intra 4 –tu-inter 4 –limit-tu 1 –psy-rdoq 5.0 –rdoq-level 1 –deblock -2:-2 –qg-size 32 –merange 44 –me 3 –subme 5 –no-rect –no-amp
Quote:
Originally Posted by Asmodian View Post
I have been testing sao with the new builds of x265. It does not seem to smooth the way it used to.

For 1080p anime I have had good results with:
--crf 18 -p 8 -F 1 --pools "5" --lookahead-slices 0 --rd-refine --tskip --tskip-fast --tu-inter 4 --tu-intra 4 --limit-tu 4 --rect --amp --limit-modes --no-strong-intra-smoothing

Adding --no-sao hurt quality and did not improve sharpness. This was not the case the last time I tested sao (probably about 6 months ago).

Does this match anyone else's experience?
I've experienced the exact same results, --no-sao now has a negative effect on animated content. (Haven't done much testing on real life content) I actually didn't like --no-strong-intra-smoothing on my tests either.
__________________
I5 3570k OC @4.5Ghz, EVGA GTX 1080 FTW Oced, Asrock Z77 Extreme4, 8GB DDR3 @ 1600Mhz

Last edited by Toku; 4th November 2017 at 12:51.
Toku is offline   Reply With Quote
Old 5th November 2017, 05:31   #12  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,406
Quote:
Originally Posted by benwaggoner View Post
Why --pools "5"? Are you running on a NUMA system? I would think that explicitly setting --frame-threads would control quality and perf better.
I was limiting the number of threads while running four encodes at once. -F is a shortcut for --frame-threads so I was limiting each encode to one frame thread.

I only included the thread limits to be complete with my reporting because I hadn't tested too many variations of the command line.

Quote:
Originally Posted by Toku View Post
I actually didn't like --no-strong-intra-smoothing on my tests either.
Interesting, I wonder if that is animation style dependent or if it is simply your slightly higher crf value. I definitely thought strong-intra-smoothing created something like that slightly smoothed look that I used to associate with sao.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Old 7th November 2017, 19:13   #13  |  Link
Gser
Registered User
 
Join Date: Apr 2008
Posts: 418
This is what I use for 1080p live action content with medium preset, I haven't heard about limit sao before, have to run some trials with that
Code:
--crf 24.0 --ref=4 --ctu 32 --max-tu-size 16 --deblock=-2:-2 --no-strong-intra-smoothing --profile main10  
--psy-rd=1.80 --psy-rdoq=5.00 --qcomp 0.7 --rdoq-level 1 --ipratio=1.30 --pbratio=1.20 --qg-size 16 --merange 44 --splitrd-skip --no-sao
Gser is offline   Reply With Quote
Old 10th November 2017, 14:37   #14  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,406
If I understand correctly limit-sao is a speed up for sao, not really meant to reduce the impact of sao.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Old 11th November 2017, 20:07   #15  |  Link
x265_Project
Guest
 
Posts: n/a
Quote:
Originally Posted by Asmodian View Post
If I understand correctly limit-sao is a speed up for sao, not really meant to reduce the impact of sao.
You understand correctly.
  Reply With Quote
Old 6th January 2018, 07:22   #16  |  Link
DotJun
Registered User
 
Join Date: Aug 2014
Posts: 28
If I’m getting an error when I use —hdr-opt, is the most likely reason due to my source not being hdr?
DotJun is offline   Reply With Quote
Old 6th January 2018, 12:14   #17  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Is your input 10 bit 4:2:0? Post the error message.
sneaker_ger is offline   Reply With Quote
Old 7th January 2018, 05:52   #18  |  Link
DotJun
Registered User
 
Join Date: Aug 2014
Posts: 28
Quote:
Originally Posted by sneaker_ger View Post
Is your input 10 bit 4:2:0? Post the error message.

Sorry, on mobile right now so I can’t post logs. Yes it’s 4:2:0. It works fine if my source does in fact have hdr. When it doesn’t though, the encode will go all the way to the end and finish up with an error. This is using megui.
DotJun is offline   Reply With Quote
Old 18th August 2018, 11:18   #19  |  Link
Forteen88
Herr
 
Join Date: Apr 2009
Location: North Europe
Posts: 556
I'm unfortunately opening an old thread
@Arhu. Why don't you use AAC instead of Opus? Opus takes much more decoding time.
I did a test in foobar2000 v1.4 (with component "Decoding speed test"), testing the song "Ennio Morricone Conducts Morricone His Greatest Hits - The Good, the Bad and the Ugly: The Ecstasy of Gold".
"High priority: yes
Buffer entire file into memory: yes
Warm-up: yes"

Apple AAC@144kbps (using latest version with qaac_2.67, default setting),
"Decoding time: 0:00.174"

Opus@144kbps (using opus-tools-0.1.10-win64, default setting),
"Decoding time: 0:00.990"

Last edited by Forteen88; 18th August 2018 at 11:31.
Forteen88 is offline   Reply With Quote
Old 18th August 2018, 15:59   #20  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,406
Opus is higher quality than AAC, isn't that a reason to use it? Audio decode time is usually not a concern, it is really fast and can be done on another CPU/thread. HEVC takes a lot longer to decode than AVC too.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Reply

Tags
settings, tunes, x265

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 16:57.


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