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 23rd September 2023, 12:56   #9141  |  Link
sainome
Registered User
 
Join Date: Jun 2020
Posts: 3
Are you saying that there is no ideal optimal value?

Quote:
--merange <integer>
Motion search range. Default 57

The default is derived from the default CTU size (64) minus the luma interpolation half-length (4) minus maximum subpel distance (2) minus one extra pixel just in case the hex search method is used. If the search range were any larger than this, another CTU row of latency would be required for reference frames.
x265 docment says it like this, so if you specify "--ctu32", specify 25
sainome is offline   Reply With Quote
Old 24th September 2023, 01:26   #9142  |  Link
N'Cha
Registered User
 
Join Date: Sep 2023
Posts: 28
Hello,
What is the impact (quality of the output, compression efficiency, easiness to decode the encoded video or the 3 maybe?) of using --limit-refs 3 vs --limit-refs 1 and --subme 5 vs --subme 7 ?
I've noticed that using limit-refs 1 makes my encoding take 20-25 minutes longer for a 24 minute anime episode (1h20 vs roughly 56 minutes with limi-tefs 3). Same with --subme 7, it has a lesser impact but still like 3-4 minutes on the encoding and not sure it's worth it (if it gives like 10% more quality/details vs --subme 5 it is worth it)
N'Cha is offline   Reply With Quote
Old 24th September 2023, 19:16   #9143  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
Quote:
Originally Posted by sainome View Post
Are you saying that there is no ideal optimal value?



x265 docment says it like this, so if you specify "--ctu32", specify 25
Interesting. Thought 'default' merange gets adjusted automatically by the encoder to a lower value when ctu32 or ctu16 is specified.
LeXXuz is offline   Reply With Quote
Old 26th September 2023, 00:56   #9144  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,653
Quote:
Originally Posted by sainome View Post
Are you saying that there is no ideal optimal value?

x265 docment says it like this, so if you specify "--ctu32", specify 25
Limiting it to 25 would improve parallelization, but absolutely could reduce compression efficiency. Lowering CTU makes more WPP parallelism possible, but doesn't mitigate the potential quality hit from a too-small search range.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 26th September 2023, 13:03   #9145  |  Link
sainome
Registered User
 
Join Date: Jun 2020
Posts: 3
Sorry. I'm sorry for the afterthought of the information, but the source is SD size (720x480).
It seems that --cti 16 gives better results than --ctu 64/32 for SD size.

I have tried --merange values of 57/25/16, but I can't decide between them, so I wanted to ask if there is a mathematically/theoretically correct setting.
sainome is offline   Reply With Quote
Old 26th September 2023, 13:06   #9146  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,818
Quote:
Originally Posted by sainome View Post
Sorry. I'm sorry for the afterthought of the information, but the source is SD size (720x480).
It seems that --cti 16 gives better results than --ctu 64/32 for SD size.

I have tried --merange values of 57/25/16, but I can't decide between them, so I wanted to ask if there is a mathematically/theoretically correct setting.
If it's SD, then lower CTU is definitely better and recommended. As for me-range, I doubt you'll see the difference.
__________________
TV: Samsung QE50Q60T AVR: Denon AVR-X1700H CD: Yamaha CD-S300 Tuner: TechniSat 143v3 BD: Samsung UBD-M8500 Speakers: Klipsch Reference Phono: Audio-Technica AT-LP120X Amp: Marantz PM6007
microchip8 is offline   Reply With Quote
Old 26th September 2023, 20:26   #9147  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,653
Quote:
Originally Posted by sainome View Post
Are you saying that there is no ideal optimal value?
Parameters for which there is an ideal optimal value just have those values hard-coded . The parameters you can set are ones that you may need different values for sometimes.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 26th September 2023, 20:28   #9148  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,653
Quote:
Originally Posted by sainome View Post
Sorry. I'm sorry for the afterthought of the information, but the source is SD size (720x480).
It seems that --cti 16 gives better results than --ctu 64/32 for SD size.
Better in what sense?

Quote:
I have tried --merange values of 57/25/16, but I can't decide between them, so I wanted to ask if there is a mathematically/theoretically correct setting.
Not really. If it is too small, it'll miss some motion matches that would be more efficient. If it's too big, it'll waste encoding time without making quality or bitrate significantly better.

57 is really a fine default unless there's a big need for more parallelism.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 27th September 2023, 10:33   #9149  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
I could use some pro advice about setting aq-strength. Again.
After reading some posts and comments, I can't decide if I should use 1.0 or 1.5 as a 'default' setting for my encodes.

I use jp's patman mod with a custom very-slow preset @ CRF17 for 1080p sources. My sources are mostly quite clean as I denoise them with a complex mv-based denoiser script before encoding.

my settings look like these:
Code:
--preset veryslow --crf 17.0 --qpfile "D:\WORK\test\chp.qpf" --repeat-headers --input-depth 16 --output-depth 10 --dither 
--profile main10 --high-tier --level-idc 4.1 --vbv-bufsize 50000 --vbv-maxrate 50000 --ctu 32 --limit-refs 1 --rd 6 --aq-mode 5 --aq-auto 10 
--aq-strength 1.5 --psy-rd 2 --psy-rdoq 4 --rskip 2 --rskip-edge-threshold 2 --no-sao --no-strong-intra-smoothing --deblock -1:-1 
--colorprim bt709 --transfer bt709 --colormatrix bt709
(I know some settings are obsolete as they are already part of the preset. But I always like to set them manually as mental reminder what is used with said preset.)

With aq-strength 1.5 file sizes increase, depending on source. So more bits are hopefully spend where it matters.

But is there a downside to a higher aq-strength I should keep in mind (besides bigger file sizes)?
LeXXuz is offline   Reply With Quote
Old 27th September 2023, 21:13   #9150  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,653
Quote:
Originally Posted by LeXXuz View Post
I could use some pro advice about setting aq-strength. Again.
After reading some posts and comments, I can't decide if I should use 1.0 or 1.5 as a 'default' setting for my encodes.

I use jp's patman mod with a custom very-slow preset @ CRF17 for 1080p sources. My sources are mostly quite clean as I denoise them with a complex mv-based denoiser script before encoding.

my settings look like these:
Code:
--preset veryslow --crf 17.0 --qpfile "D:\WORK\test\chp.qpf" --repeat-headers --input-depth 16 --output-depth 10 --dither 
--profile main10 --high-tier --level-idc 4.1 --vbv-bufsize 50000 --vbv-maxrate 50000 --ctu 32 --limit-refs 1 --rd 6 --aq-mode 5 --aq-auto 10 
--aq-strength 1.5 --psy-rd 2 --psy-rdoq 4 --rskip 2 --rskip-edge-threshold 2 --no-sao --no-strong-intra-smoothing --deblock -1:-1 
--colorprim bt709 --transfer bt709 --colormatrix bt709
(I know some settings are obsolete as they are already part of the preset. But I always like to set them manually as mental reminder what is used with said preset.)

With aq-strength 1.5 file sizes increase, depending on source. So more bits are hopefully spend where it matters.

But is there a downside to a higher aq-strength I should keep in mind (besides bigger file sizes)?
I've not used --aq-mode 5 myself, as it isn't in x265 mainline. The optimal --aq-strength can vary a lot depending on algorithm. For example --aq-mode 4 often has an optimal strength .1-.2 lower than for 1 or 2. That may be true for this mode 5 as well.

In a general sense, 1.0 is a rational default. I'd use a bit lower if I know the content is cel animation, a little bit higher if I knew it was professionally produced film or video. 1.5 isn't crazy high or anything. With high tier crf=17, I would expect the impact of AQ could be more in file size than perceptual quality. There aren't any good public metrics for AQ modes; PSNR and SSIM often show lower scores for better subjective quality, and VMAF is pretty blind to even pretty visible AQ impacts.

Finding your optimal value is really down to trying a few variants and picking what you like best with your eyeballs. Since you're using 1.5 already, trying 1.0 and 2.0 could give you a sense of the impact of different values in subjective quality and file size.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 28th September 2023, 19:31   #9151  |  Link
LeXXuz
21 years and counting...
 
LeXXuz's Avatar
 
Join Date: Oct 2002
Location: Germany
Posts: 716
Thanks Ben for your valued input.
LeXXuz is offline   Reply With Quote
Old 4th October 2023, 18:18   #9152  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,653
So, now that Apple is resuscitating stereoscopic 3D video, has anyone done any work getting MV-HEVC working with x265? It's basically left eye as a normal 2D stream and a right eye encoded using the left eye as reference, so not that theoretically hard to extend.

https://developer.apple.com/videos/p...0071/?time=320
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 22nd October 2023, 23:38   #9153  |  Link
Rainforrest
Registered User
 
Join Date: Oct 2023
Posts: 1
Hi,
Could smbd please share an example of using ZONES (e.g. to assign different CRF) for x265 encoding with FFMPEG? (as far as I know it may be via x265-params)

If no FFMPEG example, same example for direct command line x265 encoder would be helpful also, hopefully syntax isn't much different.
Thank you.
Rainforrest is offline   Reply With Quote
Old 23rd October 2023, 21:12   #9154  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,653
Quote:
Originally Posted by Rainforrest View Post
Hi,
Could smbd please share an example of using ZONES (e.g. to assign different CRF) for x265 encoding with FFMPEG? (as far as I know it may be via x265-params)

If no FFMPEG example, same example for direct command line x265 encoder would be helpful also, hopefully syntax isn't much different.
I've not used --zones myself that I can recall. I've used --qpfile for similar purposes.
The documentation lists --zonefile as a CLI-only feature; I don't know that it is implemented in ffmpeg.

Also, CRF isn't one of the parameters that can be specified. Only QP or a bitrate multiplier are listed.

From: https://x265.readthedocs.io/en/3.4/c...ortion-options
Quote:
--zones <zone0>/<zone1>/...
Tweak the bitrate of regions of the video. Each zone takes the form:

<start frame>,<end frame>,<option> where <option> is either q=<integer> (force QP) or b=<float> (bitrate multiplier).

If zones overlap, whichever comes later in the list takes precedence. Default none

--zonefile <filename>
Specify a text file which contains the boundaries of the zones where each of zones are configurable. The format of each line is:

<frame number> <options to be configured>

The frame number indicates the beginning of a zone. The options following this is applied until another zone begins. The reconfigurable options can be spcified as <feature name> <feature value>

CLI ONLY
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 24th October 2023, 18:33   #9155  |  Link
maroders2
Registered User
 
Join Date: Oct 2023
Posts: 3
Hello,
Please tell me the optimal settings for encoding movies (only 1080p BDRemux to h.265 10bit). I want to get good quality with a normal encoding speed. Avg QP should not be higher than 22!
I currently use the following settings:
Quote:
--crf 20 --preset slower --output-depth 10 --profile main10 --level-idc 4.1 --rd 4 --dynamic-rd 2 --limit-refs 3 --ctu 32 --limit-tu 1 --refine-mv 1 --no-b-intra --aq-mode 2 --vbv-bufsize 50000 --vbv-maxrate 50000 --no-cutree --subme 5 --bframes 16 --colorprim bt709 --colormatrix bt709 --transfer bt709 --range limited --sar 1:1 --deblock -3:-3 --no-sao --no-strong-intra-smoothing
Are these good settings or change something?

What settings can boost speed encoding with minimal quality loss?

Thanks!

Last edited by maroders2; 24th October 2023 at 18:53.
maroders2 is offline   Reply With Quote
Old 24th October 2023, 19:34   #9156  |  Link
RanmaCanada
Registered User
 
Join Date: May 2009
Posts: 326
Quote:
Originally Posted by maroders2 View Post
Hello,
Please tell me the optimal settings for encoding movies (only 1080p BDRemux to h.265 10bit). I want to get good quality with a normal encoding speed. Avg QP should not be higher than 22!
I currently use the following settings:

Are these good settings or change something?

What settings can boost speed encoding with minimal quality loss?

Thanks!
At preset slower, the only way to increase speed is to buy new hardware. Settings would maybe get you a fraction of a frame increase in speed. Real speed increases can only be done by sheer horsepower.

What is your current processor?
RanmaCanada is offline   Reply With Quote
Old 24th October 2023, 20:45   #9157  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,653
Quote:
Originally Posted by maroders2 View Post
Hello,
Please tell me the optimal settings for encoding movies (only 1080p BDRemux to h.265 10bit). I want to get good quality with a normal encoding speed. Avg QP should not be higher than 22!
I currently use the following settings:

Are these good settings or change something?

What settings can boost speed encoding with minimal quality loss?
You're setting a lot of things you probably don't want to be setting. --bframes 16 will slow things down a lot for little gain. --deblock -3:-3 is going to raise bitrate and thus lower speed for little or no benefit. If the source is 8-bit, encoding at 10-bit gives a speed hit without much quality gain (unless you're doing some >8-bit preprocessing on the source). 1080p24 isn't going to hit 50 Mbps.

I'd start with just --preset slower --level-idc 4.1 --ctu 32 --crf 20 --selective-sao 2 and see how it goes quality and speed wise. If it's way too slow, try --preset slow. If it doesn't look good enough, try --crf 18. It looks like you're way overrunning for detail, which you shouldn't start with. That's something to do only if there's visible detail loss during playback. Don't sweat how a zoomed in screen shot looks unless you're going to be watching the video as a zoomed-in screen shots.

I don't know what a "normal" encoding speed is to you, but --preset slower with the settings I give above approaches real-time on a recent desktop processor with 12+ cores. If you are doing preprocessing along with encoding, check that preprocessing isn't using up lots of your CPU, or is serialized in a way that gates x265 performance. A good share of "why is my encoding so slow" problems have little to do with the encoder.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 24th October 2023, 20:47   #9158  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,653
Quote:
Originally Posted by RanmaCanada View Post
At preset slower, the only way to increase speed is to buy new hardware. Settings would maybe get you a fraction of a frame increase in speed. Real speed increases can only be done by sheer horsepower.
Oh, going from --preset slower to --preset fast will speed up encoding by a pretty good multiple, if encoding speed is the limiting factor. I wouldn't do it myself other than for scratch quality or when I didn't care about bitrate, but there are absolutely ways to get huge speed increases through settings. Just not free ways in terms of quality or bitrate.

Edit: --selective-sao 2 is effectively free. And --ctu 32 for 1080p and below is a nice boost if you have the cores to take advantage of the extra WPP row of parallelism.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 25th October 2023, 06:46   #9159  |  Link
maroders2
Registered User
 
Join Date: Oct 2023
Posts: 3
Quote:
Originally Posted by RanmaCanada View Post
At preset slower, the only way to increase speed is to buy new hardware. Settings would maybe get you a fraction of a frame increase in speed. Real speed increases can only be done by sheer horsepower.

What is your current processor?
I have a cheap r5 3600 and i will change it in the future.
I want to have a good quality of the picture, which would not lose much x264. The speed is in second place, but I would like to have at least 2 fps so as not to encode 20 hours for one movie


Quote:
Originally Posted by benwaggoner View Post
--bframes 16
I read in the documentation that in the case of -bframes 16, the encoder itself chooses the one it needs. I also found other settings here on the forum, although I admit that I don't quite understand how to use them.
I heard the advice to start with a slow preset many times, I started with this, but then I started randomly adding other settings
maroders2 is offline   Reply With Quote
Old 25th October 2023, 15:39   #9160  |  Link
maroders2
Registered User
 
Join Date: Oct 2023
Posts: 3
What do you think about the QxR team's BDRips?
I know that BDRips are not the best of quality, but they are ready for use. My PC doesn't meet my needs right now, so I might start building a home movie collection of their BDRips.
maroders2 is offline   Reply With Quote
Reply

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 22:21.


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