Hi, this is a ffmpeg syntax related question with respect to the Nvenc HW encoding using -cq in combination with -b:v. Basically the -b:v option is now having no effect with the last two builds.
I have the latest Nvidia driver installed, using rtx 2080 ti.
Note that theres no problem with when using -b:v in combination with intel qsv hw encoding, it continues to perform as expected. Everything also works ok with Nvenc with previous to the ffmpeg 19th-December version.
If I knew how or where within the ffmpeg community to put this, I would, but I cannot see how.
My question:
In full static build from version 19th-December-2022 onwards I notice that the "Average bit rate" has no longer any effect, output is not linear, in the NVENC HW encoding example below, the file size and data rate doesn’t get much bigger as the cq values gets lower. If the avg. bit rate was working it would have an approximate linear increase in file output size. In a previous version of ffmpeg (24th-Nov-2022) it worked fine, a lower cq value produced a higher data rate and file size.
In the Nvenc syntax below the -b:v 100M is necessary using h264 so that as the -cq values gets lower, = higher quality, the data rate and file size increases accordingly. This no longer works in the last two builds.
I would typically use a value of 100M for h264 and 400M for hevc. No need to use any avg bit rate if it's CPU encoding, (using -crf instead) not Nvenc.
ffmpeg -i "InputFile.mp4" -cq %_QUALITY% -c:v h264_nvenc -b:v 100M "OutPutFile.mp4"
%_QUALITY% variable is integer, 1 to 51.
+ Reply to Thread
Results 1 to 3 of 3
-
Last edited by JN-; 24th Dec 2022 at 17:43.
-
This may be related to changes introduced not by ffmpeg but by NVidia in NVENC... Try to verify recommended settings in NVidia documents such as https://docs.nvidia.com/video-technologies/video-codec-sdk/pdf/Using_FFmpeg_with_NVIDI...celeration.pdf
If i recall correctly NVidia recently changed some settings in NVEnc and as such ffmpeg is obligated to follow NVidia. You can use also rigaya NVEnc as indirect reference how to use NVidia NVEnc in ffmpeg. -
Hi pandy, thank you for that. I did find that ffmpeg required a Nvidia Driver update before I could use it, that ties in with what you said there. I'm no expert on ffmpeg, I get by with a little (a lot) help from the inet.
I spent a lot of time on this today, testing, and definitely confirmed that the above mentioned snippet does work (in Nvenc) on the November build but not on the December builds.
A few hours ago I found a solution. I'm guessing that the piece I was using was previously getting internally expanded to what's below either by ffmpeg or Nvenc, but now is no longer ? I probably should have been all along using the fuller way of doing it, below.
This now works ... ffmpeg -i "InputFile.mp4" -cq %_QUALITY% -c:v h264_nvenc -b:v 0 -maxrate %_AVGBITRATE% "OutPutFile.mp4" Where as previously mentioned I typically use 100M for h264 or 400M for hevc, i.e. = %_AVGBITRATE%
The recommendation is to also use -buffsize but leaving it out works ok also. example ffmpeg -i "InputFile.mp4" -cq %_QUALITY% -c:v h264_nvenc -b:v 0 -maxrate %_AVGBITRATE% -bufsize 600 "OutPutFile.mp4"Last edited by JN-; 24th Dec 2022 at 17:42.
Similar Threads
-
VBR Bit Rate
By Anakin in forum Video ConversionReplies: 35Last Post: 30th Jun 2022, 17:39 -
how to do average bitrate h264 encoding with ffmpeg?
By Anonymous543 in forum Newbie / General discussionsReplies: 38Last Post: 15th Feb 2022, 07:02 -
Broadcast Bit Rate
By chris319 in forum Newbie / General discussionsReplies: 45Last Post: 1st Sep 2018, 02:22 -
converting to 24 bit DTS using ffmpeg, but the getting 16 bit
By jbiribi in forum AudioReplies: 12Last Post: 17th Mar 2018, 22:34 -
ffmpeg to convert 4k/hdr10 to (i) h.264/10-bit/.mp4 (ii) h.265/10-bit/.mp4
By hydra3333 in forum Video ConversionReplies: 2Last Post: 10th Feb 2018, 19:49