Question / Help NVENC HEVC Settings for local recording?

Yasaka

Member
So i wanted to switch from nvenc h264 to nvenc hevc for my local recordings but i need some help. i used cqp 23 for my nvenc h264 profile and when i recorded for like 2 hours the file size was about 3gb. but i cant directly set cqp in the hevc encoder so i used the custom parameter "-preset slow -rc 23 constqp" and bitrate = 0. i recorded 2 hours again but the file size was about 10gb with an average bitrate of 9mbit. so i did something wrong i assume. what do i need to do to use cqp with hevc like i did with h264? log: https://hastebin.com/iyibirezen
 

JaiBubwan

New Member
I assume I figured out how to use ffmpeg output mode to record hevc with constant quality mode:
https://obsproject.com/forum/thread...etter-for-my-pc-need-advice.95665/post-375280

I just tried these settings. They work. But what I found is that there's absolutely no file size savings between the suggested "FFMPEG HEVC - qp=26"...& the simpler "NVIDIA NVENC H264 (new) - cq=18".

I recorded the same sample using both methods. Virtually identical overall bit rates of 20 Mb/s. And the file sizes were roughly the same at 200 mb for a one minute clip.

I edit these captures in an external program. Typically "lossless" cutting software have an easier time handling H264 videos than HEVC. So without the file size savings...I personally don't see any benefit to using HEVC (in this context).
 

koala

Active Member
You can raise the qp= value from 26 to qp=30 or even higher values. This will reduce file size (and quality). Raise it as high as long as you don't see any visual degradation of quality. I didn't do any tuning, I just provided a parameter set that makes ffmpeg output constant quality hevc recordings instead of constant bitrate. Finding an appropriate value for the qp= parameter is a thing you have to do. The community doesn't have an appropriate value yet.

It is said that hevc will produce 40%-50% smaller files with the same quality in comparison to h.264. So you should take some kind of reference video and first encode it with nvenc (h.264) with a cqp value that produces the quality you want. Take note of the file size. Now use my parameter set to encode with hevc. Record the same reference video with a range of qp= parameters. Again take notes of the resulting file sizes and the corresponding qp= values. In the end, take the file that has 40%-50% of the size of the nvenc (h.264)-encoded video and use the qp= value that you used to produce that file. This one probably has about the same quality as the nvenc file.

If you want it even more accurate, you need to compute mse and psnr values for resulting nvenc and hevc videos. Commandline ffmpeg has parameters for this, not OBS. These values are a measurement of how different a video is in comparison to the original. With lossy encoding methods like h.264 or h.265, the lower these values, the more equal they are to the original, so the better the quality. So you need to do a test series and find the qp= value for hevc that produces about the same mse and psnr as some cqp= value does for nvenc. Such a test series will produce a table that shows for every cqp= value of nvenc a corresponding qp= value of hevc that both create about the same quality.
 
Top