VideoHelp Forum




+ Reply to Thread
Results 1 to 3 of 3
  1. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    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.
    Last edited by JN-; 24th Dec 2022 at 17:43.
    Quote Quote  
  2. 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.
    Quote Quote  
  3. Member
    Join Date
    Jun 2022
    Location
    Dublin
    Search Comp PM
    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.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!