Suggestions for AV1_NVENC and FFMPEG Improvements

  • Hey,

    Please excuse my somewhat limited knowledge, but I have a few thoughts and suggestions regarding AV1_NVENC and potential improvements in FFMPEG. I might be overlooking something, so feel free to correct me or expand on these points!

    1. ConstQP Rate Control in AV1_NVENC
      When using the constqp rate control mode in AV1_NVENC, I’ve noticed that the QP value can only be set between 0 and 51. However, according to the FFMPEG 7.0 documentation, this value should theoretically go up to 255.
      Is there a reason why this range is limited, or am I missing something here?
    2. VBR Rate Control and CQ Values
      Similarly, in the VBR rate control mode, the CQ values are also restricted to a range of 0 to 51, whereas they should actually be configurable between 0 and 63. Is this a bug or an intentional limitation?
    3. Setting B-Frames
      I might have overlooked this, but is it possible to configure certain general FFMPEG parameters like B-Frames in AV1_NVENC or other encoders? From what I understand, in FFMPEG, you would typically set B-Frames using the -bf <int> parameter, but I haven’t been able to figure out how to adjust this in Voukoder Pro.
    4. Split-Frame Encoding
      Since the release of NVIDIA SDK 12.1 (and I believe FFMPEG 7.0), there’s now support for split-frame encoding, which allows GPUs with multiple NVIDIA chips to encode in parallel by manually forcing this feature for any resolutions and presets instead of only the automatically selectet (I think it was above 4k and p1,p2 but not sure on that).


      In my tests, this significantly improved performance, almost doubling the encoding frame rate! For instance, with split-frame encoding enabled, I achieved around 250 FPS at 2560x1440 resolution using the P7 preset (Very Slow), compared to only 120 FPS without it.

      FFMPEG now supports this feature for both AV1_NVENC and HEVC_NVENC, and the command looks like this:

      Code
      -split_encode_mode <int>

      With the following options:

      • disabled: 15 – Disabled for all configurations
      • auto: 0 – Enabled or disabled based on the preset and tuning
      • forced: 1 – Enabled with horizontal strip selection by the driver
      • 2: 2 – Forces two horizontal strips when NVENCs > 1
      • 3: 3 – Forces three horizontal strips when NVENCs > 2

      For split-frame encoding to work properly and fully utilize the NVENC chip, it was crucial to set the following parameters in FFMPEG:

      Code
      -hwaccel cuda -hwaccel_output_format cuda
    5. Command Line Output in Voukoder Pro
      In the older versions of Voukoder, there was a feature that displayed the FFMPEG command line at the bottom, based on the selected options in the GUI. This was really useful for summarizing the settings in one simple line, especially given how many menu options there are for certain encoders.
      Would it be possible to reintroduce this as an optional feature? It helped a lot when working through complex configurations without needing to scroll through a ton of settings to see at one glance what you have configured.

    These are just some observations and suggestions based on my experience. I think Voukoder might already consider some of those things, but im not sure.

    3 Mal editiert, zuletzt von dream (14. Oktober 2024 um 19:45)

    • Offizieller Beitrag

    Thanks for your tests. I'll reply to it soon.


    1. For *_nvenc encoders I'm using this private parameters:
        -qp                <int>        E..V....... Constant quantization parameter rate control method (from -1 to 51) (default -1)
        -cq                <float>      E..V....... Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control (from 0 to 51) (default 0)

      But you're right! I've missed this for AV1, thanks!
        -qp                <int>        E..V....... Constant quantization parameter rate control method (from -1 to 255) (default -1)

      Fixed in the next build!
    2. Fixed.
    3. I've added "bf" and "g" to all h264, hevc and av1 encoders.
    4. This was introduced with FFmpeg 7.1. I've updated to FFmpeg 7.1 so that parameter appears.
    5. It's nice to check the encoder params with this view. I plan to add this as well.
      Edit: Done!

    Einmal editiert, zuletzt von Vouk (22. Oktober 2024 um 08:44) aus folgendem Grund: Ein Beitrag von Vouk mit diesem Beitrag zusammengefügt.