<p>With hevc_nvenc, if <code>cq:v</code> is set, <code>b:v</code> is ignored. Change <code>-cq:v</code> in conjunction with <code>-maxrate:v</code> instead.</p>

CC BY-SA 4.0
2020-12-19T23:51:22.367Z
Thank you, now I know! After I read your solution, I tried different settings, and found out that the problem is that I was using `m` instead of `M`, resulting in those options basically getting ignored... Shouldn't this be raised as en error by ffmpeg? It certainly throws an error if I only give it a string... I managed to find the default `maxrate` and `bufsize` settings, which were `4.8M` and `4M` respectively, and I just increased the bufsize, the bitrate seems good. Thank you again!
Boba0514
CC BY-SA 4.0
2020-12-19T18:45:15.170Z
2020-12-19T18:45:15.170Z
Gyan
<p>My input is an uncompressed video captured from old Hi8 cassettes, mediainfo:</p>
<pre><code>Format                                   : RGB
Codec ID                                 : V_UNCOMPRESSED
Codec ID/Info                            : Raw uncompressed video frames
Duration                                 : 1 h 32 min
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 5:4
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL
</code></pre>
<p>I have looked at the sources I could find and tried to come up with the optimal settings for my encoding needs, while also trying out a few dozen combinations, and the best I could come up with looks like this:</p>
<pre><code>ffmpeg -i in.mkv -vf yadif -c:v hevc_nvenc -preset slow -rc:v vbr_hq -cq:v 19 -b:v 2m -maxrate:v 3m -bufsize:v 1m -c:a copy out.mp4
</code></pre>
<p>The output's mediainfo is:</p>
<pre><code>Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Format Range@L3@Main
Codec ID                                 : hev1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 20 s 0 ms
Bit rate                                 : 5 142 kb/s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 5:4
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL
Chroma subsampling                       : 4:4:4
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.496
Stream size                              : 12.3 MiB (97%)
Codec configuration box                  : hvcC
</code></pre>
<p>What I have found is that I can increase the <code>-b:v 2m -maxrate:v 3m -bufsize:v 1m</code> options tenfold, and the output still stays the same. How can this be the case? I am thinking I messed up the settings gravely, in this case, could you please correct me and set me to the right ballpark? First I tried without the bitrate options and only <code>-rc:v vbr_hq -cq:v 19</code>, but that resulted in terrible quality and smaller size, and then I found that I need to set the bitrate as well, unlike just the <code>-crf</code> like I used to do with <code>libx265</code>.</p>
<p>Abandoning <code>-preset slow</code> also doesn't change the result.</p>
<p>I have also tried <code>libx265</code>, which I have used beforehand, but that's a 10-20x speed decrease, so I wouldn't want to use it for this 15+ hour project. One thing I see is that with that the chroma subsamplig is <code>4:2:2</code>, instead of <code>4:4:4</code>. Setting it to <code>4:2:0</code> actually increases the file size, what should I do with this?</p>
<p>Thank you in advance for any help, and please let me know if I should give more information in order to get the help I need.</p>

<ffmpeg><bitrate><hevc>
ffmpeg produces the same output file with different bitrate settings
Boba0514
# ffmpeg produces the same output file with different bitrate settings

(Asked by: username_0 on 2020-12-19)

My input is an uncompressed video captured from old Hi8 cassettes, mediainfo:
Format                                   : RGB
Codec ID                                 : V_UNCOMPRESSED
Codec ID/Info                            : Raw uncompressed video frames
Duration                                 : 1 h 32 min
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 5:4
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL

I have looked at the sources I could find and tried to come up with the optimal settings for my encoding needs, while also trying out a few dozen combinations, and the best I could come up with looks like this:
ffmpeg -i in.mkv -vf yadif -c:v hevc_nvenc -preset slow -rc:v vbr_hq -cq:v 19 -b:v 2m -maxrate:v 3m -bufsize:v 1m -c:a copy out.mp4

The output's mediainfo is:
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Format Range@L3@Main
Codec ID                                 : hev1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 20 s 0 ms
Bit rate                                 : 5 142 kb/s
Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 5:4
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Standard                                 : PAL
Chroma subsampling                       : 4:4:4
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.496
Stream size                              : 12.3 MiB (97%)
Codec configuration box                  : hvcC

What I have found is that I can increase the -b:v 2m -maxrate:v 3m -bufsize:v 1m options tenfold, and the output still stays the same. How can this be the case? I am thinking I messed up the settings gravely, in this case, could you please correct me and set me to the right ballpark? First I tried without the bitrate options and only -rc:v vbr_hq -cq:v 19, but that resulted in terrible quality and smaller size, and then I found that I need to set the bitrate as well, unlike just the -crf like I used to do with libx265.
Abandoning -preset slow also doesn't change the result.
I have also tried libx265, which I have used beforehand, but that's a 10-20x speed decrease, so I wouldn't want to use it for this 15+ hour project. One thing I see is that with that the chroma subsamplig is 4:2:2, instead of 4:4:4. Setting it to 4:2:0 actually increases the file size, what should I do with this?
Thank you in advance for any help, and please let me know if I should give more information in order to get the help I need.

**Tags:** ffmpeg, bitrate, hevc


---

## 1 answers

### Answer by username_1 on 2020-12-19. Score: 0 | Accepted answer

With hevc\_nvenc, if `cq:v` is set, `b:v` is ignored. Change `-cq:v` in conjunction with `-maxrate:v` instead.

> **Comments:**
> **username_0**: Thank you, now I know! After I read your solution, I tried different settings, and found out that the problem is that I was using `m` instead of `M`, resulting in those options basically getting ignored... Shouldn't this be raised as en error by ffmpeg? It certainly throws an error if I only give it a string... I managed to find the default `maxrate` and `bufsize` settings, which were `4.8M` and `4M` respectively, and I just increased the bufsize, the bitrate seems good. Thank you again!  

---

