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. |
30th September 2018, 21:55 | #1 | Link |
Registered User
Join Date: Jun 2017
Posts: 18
|
2 Pass min quality settings?
I do many encodes of seasons of shows for my archive. I have long favored hour 2 pass balances quality in a given budget. I also find that 2 pass pleases my eyes with vs CRF as to do with balancing movement vs dialog scenes. That's all my taste, now to my question.
Is there a way to encode x265 in two pass with a minimum effective CRF quality for the entire encode or any given scene? That is to say, if I set an encode for 2 pass 1500kbs but never want worse quality than CRF 26, for the total encode or any give scene, at which I am willing to let the encode exceed the 1500kbs setting. I have tried the --crf-max setting any I tried encodes of a sitcom. I started with --crf-max 30 and did encodes lowering the --crf-max 29, 28, 27, 26 each time. All of which came out to my exact bitrate setting with no change. I then tried --crf-max 25 and that encode came out 4334kbs! These tests where entire episodes not just 1 minute test clips or anything. I feel that I am not understanding something about how this works and am asking for help. My idea, is. I do an entire season, and I say two pass 1500kbs... .But we know there are always those few episodes that could use a bit more..... so I would be cool if a few came out 1645kbs, or 1721kbs, but most stuck to 1500kbs. I am looking for an escape clause to break the bitrate budget in an emergency to keep a minimum quality. To be clear, no I don't want to do CRF. |
1st October 2018, 09:12 | #2 | Link | |
Registered User
Join Date: May 2009
Posts: 184
|
Quote:
If 1500kbps is a target bitrate that you're generally happy with then I'd suggest cutting a couple of 5 min clips from each planned encode that ideally contain a mixture of high and low motion and light and dark scenes, and run test encodes at 1500kbps. Then look at the average QP's they've come out on the logs and give them a going over with your eyes to see if you're happy with them. And if they look to need a bit more bitrate then bump them up to 1700 or 1800kbps. Or if they look like they could get away with an even lower bitrate then bump it down and run a repeat of one of the 5 mins clips to be sure. Another idea might be to use CRF but lower qcomp to say 0.5 or even 0.4 which will decrease bits allocated to motion/grain and increase bitrate in low motion scenes. Might also give you that balance you prefer. You can also turn off cutree which will give a more balanced bitrate allocation without over allocating to grain and often under allocating to low motion frames like cutree does. |
|
1st October 2018, 14:41 | #3 | Link | |
Cary Knoop
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
|
Quote:
Do you need the video file to be of a given average bitrate? Because that is the only reason one ever would need two-pass. Some people have a false impression that two-pass encoding is somehow better than single pass encoding. After all, two is more than one! But all the first pass of the two-pass stage is doing is to record the relative 'need' for each frame so that the second pass can spread out this 'need' by giving the needy frames some extra bitrate while reducing it for the less needy frames. |
|
2nd October 2018, 03:11 | #4 | Link | |||
Registered User
Join Date: Jun 2017
Posts: 18
|
Thank you for taking time to respond.
Quote:
As for why 2 pass isn't just wasting time, and is in fact truly different than if one just guessed CRF and got the same final bitrates. Quote:
Quote:
This is what I like; There is no guess-work when using 2-pass. In this example not wasting bits on the fade-in and using them later where they are useful. CRF has the --vbv-maxrate as an limiter for out of control bit-rates. It would make sense that ABR and 2 Pass ABR would have stops for maintaining a minimum and maximum quality. If such options are lacking then they should be looked into by the developers of the codec. Last edited by JoyBell; 2nd October 2018 at 03:53. |
|||
2nd October 2018, 03:17 | #5 | Link | |
Cary Knoop
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
|
Quote:
I could not possibly watch that! Do you seriously call that archive level? Last edited by Cary Knoop; 2nd October 2018 at 03:19. |
|
2nd October 2018, 03:31 | #6 | Link | ||
Registered User
Join Date: Sep 2007
Posts: 5,374
|
Quote:
Quote:
What you're saying about going over the target bitrate doesn't really make any sense - because that's the entire point of using 2 pass rate control - a target bitrate. If you set it at 1500kbps, you're going to get something close to that. |
||
2nd October 2018, 05:25 | #7 | Link | ||
Registered User
Join Date: Jun 2017
Posts: 18
|
Quote:
Quote:
Let's looks at the stats of my most recent encode: Code:
x265 [info]: frame I: 354, Avg QP:21.07 kb/s: 12049.65 SSIM Mean: 0.995182 (23.171dB) x265 [info]: frame P: 9795, Avg QP:28.84 kb/s: 1682.65 SSIM Mean: 0.993233 (21.696dB) x265 [info]: frame B: 22303, Avg QP:33.45 kb/s: 379.25 SSIM Mean: 0.992825 (21.442dB) x265 [info]: Weighted P-Frames: Y:3.2% UV:1.4% x265 [info]: consecutive B-frames: 21.6% 11.6% 14.5% 29.8% 22.4% x265 [info]: RPS in SPS: 26676 frames (82.20%), RPS not in SPS: 5776 frames (17.80%) encoded 32452 frames in 3800.70s (8.54 fps), 899.96 kb/s, Avg QP:31.92, SSIM Mean Y: 0.9929739 (21.533 dB) Video Compression Testing: x264 vs x265 CRF in Handbrake 0.10.5 (labeled with the matching names in Stax) https://goughlui.com/2016/08/27/vide...dbrake-0-10-5/ Code:
x265 - Average Case CRF Bitrate SSIM SSIM (dB) PSNR (avg) PSNR (min) fps 8 37545 0.995211 23.197804 51.363782 46.213167 0.40533746 12 18834 0.991562 20.737413 48.847675 43.550076 0.571760862 16 8407 0.987726 19.110261 47.004687 39.892563 0.847564601 Super High 20 4315 0.983769 17.896507 45.373892 36.558467 1.094531205 Medium 24 2504 0.978525 16.680696 43.635386 33.687427 1.289760018 Super Low I do have two labor intensive ideas on how to accomplish my original goal. Idea #1: Do each episode in the series first using CRF, doesn't matter which settings. Find the episode with the mean bitrate- call that the base. Then match up any episodes with above average CRF bitrates and bump them up by he ratio. Or use the ratio on all the episodes both higher and lower and the total for the season would match the intended bitrate. Idea #2: Mux the entire season into a single file. Encode using 2 pass ABR. Mux apart the encoded season file. I am trying this right now. Idea #2 could be automated by software. |
||
2nd October 2018, 17:11 | #8 | Link |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,770
|
Actually, syntactically the request can be done, using x265's (rarely used) crf-max and crf-min parameters.
Code:
x265.exe --pass 1 --crf-max 28 --bitrate 1500 x265.exe --pass 2 --crf-max 28 --bitrate 1500 I don't know that the results would be significantly better than just doing a normal crf encode where rc-lookahead=keyint, ala. Code:
x265.exe --crf 28 --vbv-maxrate 1500 --vbv-buffsize <foo> |
2nd October 2018, 17:15 | #9 | Link | |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,770
|
Quote:
https://forum.doom9.org/showthread.php?t=175776 |
|
2nd October 2018, 19:43 | #10 | Link | |
Registered User
Join Date: Jun 2017
Posts: 18
|
Quote:
I wrote that I tried --crf-max settings and nothing happened until --crf-max 25 where the file size tripled. Are you saying that I have had those settings backwards the whole time? Last edited by JoyBell; 2nd October 2018 at 19:54. Reason: added example image |
|
3rd October 2018, 02:17 | #11 | Link |
Registered User
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
|
Try very fine changes for --crf-max, e.g. 25.2, 25.2, 25.15, etc. Small changes in crf can result in large changes in bitrate.
To make sure I understand what you want: Maximum compression is what would be achieved by twopass 1500 Kbps, quality can go above this point but not below. Because 2pass and crf rate control is so similar a crf-max will not change the output until you use a value below the crf that would give you the same average bitrate as 2pass. To give harder scenes more bits lower qcomp. To avoid lowering the quality for easy scenes too much when hard scenes take more bits use crf. If you then worry about crf compressing an entire video too much use 2pass and a crf-max value, 2pass gives a minimum average bitrate and crf-max gives a minimum quality. All these options will increase the file size.
__________________
madVR options explained |
3rd October 2018, 08:54 | #12 | Link |
Angel of Night
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
|
Have you even tried qcomp? This whole thread is premised on the idea that 2-pass allocates bits a little more to your liking, but ideally, at the same bitrate crf and 2-pass are supposed to be identical, and updates do shift this around. Qcomp, on the other hand, is literally the knob you turn to allocate bits between hard scenes and easy scenes. Since adjusting that all along is what you wanted, you should be testing qcomp, like RainyDog mentioned in the first reply!
|
3rd October 2018, 18:47 | #13 | Link |
Registered User
Join Date: Jun 2017
Posts: 18
|
I started the thread with: I do not want to do CRF. I was looking for a knob for 2 pass, to exceed the chosen bitrate when a minimum quality was not reached.
I am not saying I won't fry Qcomp, just the thread has gotten side tracked. |
3rd October 2018, 23:51 | #14 | Link | |
Registered User
Join Date: Jun 2017
Posts: 18
|
I have completed my encode of an entire season using 2 pass, as a way of matching up the needs of the episodes better. I did this as I mentioned by muxing all the episodes of the season into one large file, encoding using my normal two pass settings, muxing apart the episodes. This gave the season my target bitrate/size while allowing the episodes that needed more bits do so.
Quote:
|
|
4th October 2018, 06:10 | #16 | Link | |
Registered User
Join Date: Jun 2017
Posts: 18
|
I always read --crf-min as the best quality CRF it will attempt. That is --crf-min 26 would never apply CRF 20 to a frame even if it had plenty of bit-rate available.
So, if I want a 1500kbs two pass string that would never provide worst image quality than CRF 26, I would: Quote:
|
|
4th October 2018, 08:33 | #17 | Link | |
Registered User
Join Date: Jun 2017
Posts: 18
|
Quote:
Code:
x265.exe" --pass 1 --bitrate 1200 --preset slow --profile main10 --qcomp 0.4 Code:
x265.exe" --pass 2 --bitrate 1200 --preset slow Code:
x265.exe" --pass 2 --bitrate 1200 --preset slow --crf-min 26 Code:
x265.exe" --pass 2 --bitrate 1200 --preset slow --crf-min 22 Code:
x265.exe" --crf 26 --preset slow |
|
4th October 2018, 10:51 | #18 | Link | |
Lost my old account :(
Join Date: Jul 2017
Posts: 324
|
Quote:
Anyway, Isnt what you wanna do pretty simple? Just script it, analyze the stat file between passes and redo them with a higher bitrate if not within criteria. |
|
4th October 2018, 19:15 | #19 | Link |
Registered User
Join Date: Jun 2017
Posts: 18
|
The --crf-min doesn't seem to be doing anything. The tip that CRF points at the P frames is helpful. But my listed stats from the encodes still suggests that setting crf-min isn't working.
Please give me a few lines to try test encodes with. Thank you. |
4th October 2018, 20:22 | #20 | Link |
Registered User
Join Date: Jun 2018
Posts: 56
|
--ipratio 1.0 There seems to be too much bits in I-frame to support the QP. --bframes 5~8 Reduce the appearance of P-frame. --pbratio 1.5 or default. --no-open-gop and --qpfile Insert specific I-frames positions in the concatenated file for accurately segmented files.
|
Tags |
--crf-max min quality |
Thread Tools | Search this Thread |
Display Modes | |
|
|