News:

--

Main Menu

NVENC HEVC problems

Started by Videograbber, April 28, 2022, 10:22:58 AM

Previous topic - Next topic

Videograbber

Hello developers!

There is no "reference frame" settings in NVENC HEVC , only B-Frame option exist. The other problem is the very low max bitrate settings in NVENC. NVENC NVIDIA cards can use from 200Mbit to 1200 Mbit bitrate, however in Avidemux only max 50 Mbit/s bitrate is allowed, which is too low for a 4K @ 60 FPS video.

Can you impelemnt frame number option and a much higher bitrate?

Thank you for your reply!
BEst regards!
Bye!

eumagga0x2a

Are you sure you have tried the latest available nightly build? Sure, the maximum bitrate for NVENC encoders wasn't increased (both https://www.nvidia.com/en-us/geforce/guides/broadcasting-guide/ and https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding_tiers_and_levels suggest that 50.000 kbps should be sufficient for 3840×2160@60 fps and Main profile), but the point is that one should use CQP rather than specifying bitrate.

Regarding hevc_nvenc FFmpeg encoder Avidemux wraps in its NVENC encoder plugin, it supports three reference frame modes for B-frames (none, each and middle) and Avidemux exposes all of them in the current NVENC HEVC encoder configuration GUI.

Videograbber

#2
Quote from: eumagga0x2a on April 28, 2022, 03:33:57 PMAre you sure you have tried the latest available nightly build? Sure, the maximum bitrate for NVENC encoders wasn't increased (both https://www.nvidia.com/en-us/geforce/guides/broadcasting-guide/ and https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding_tiers_and_levels suggest that 50.000 kbps should be sufficient for 3840×2160@60 fps and Main profile), but the point is that one should use CQP rather than specifying bitrate.

Regarding hevc_nvenc FFmpeg encoder Avidemux wraps in its NVENC encoder plugin, it supports three reference frame modes for B-frames (none, each and middle) and Avidemux exposes all of them in the current NVENC HEVC encoder configuration GUI.

50 Mbit/s is minimum for broadcast standard in HD 1080p. If you are a cameraman of TV company, they ask you to provide them the simple 1080p material in 50Mbit/s, when you handle the video to the studio. If a cameraman record in 1080p under 50Mbit/s, than she/he will be fired from the TV company, because it is under the standard....

In 4K resolution, 100 MBit HEVC is sufficient for 25/30 Fps but for studio quality you need minimum 200Mbit/s for 50/60P video.

I have never seen such low bitrate restriction in any other transcoder softwares.

Regarding to NVENC, all famous encoders (Staxrip, Hybrid etc..) provide ref frame option and b frame options. There is no reference frame option in Avidemux, Avidemux have only B-frame option. NVENC allows 7 Reference frames and 5 B-frames. B-frames are not the same as Reference Frames.

An example:

eumagga0x2a

Of course I know that the number of B-frames has nothing to do with the number of reference frames beyond the latter being greater than one. As I tried to explain, Avidemux uses (at best) what hevc_nvenc libavcodec encoder in the bundled FFmpeg libraries can offer*, we don't use the interfaces provided by the driver directly.

Increasing maximum bitrate in the configuration GUI code is not a problem, but if you need a higher bitrate than the GUI control allows right now, set the desired value via scritping and avoid opening the graphical configuration, e.g.

adm = Avidemux()
adm.videoCodec("ffNvEncHEVC", "preset=5", "profile=0", "rc_mode=5", "quality=10", "bitrate=100000", "max_bitrate=200000", "gopsize=60", "bframes=3", "b_ref_mode=2", "lookahead=8", "aq_strength=1", "spatial_aq=False", "temporal_aq=False"
, "weighted_pred=True")

You can pass these commands to the application manually (per copy and paste) via Avidemux scripting shell or by saving it as a text file with extension .py and placing it in %appdata%\avidemux\custom\ directory.

*) We need to switch to new presets, this is true. I plan to do this when FFmpeg gets upgraded to 5.x.


eumagga0x2a

Quote from: eumagga0x2a on April 28, 2022, 08:14:52 PMYou can pass these commands to the application manually (per copy and paste) via Avidemux scripting shell or by saving it as a text file with extension .py and placing it in %appdata%\avidemux\custom\ directory.

Not just by placing alone but by restarting Avidemux and selecting the entry matching the filename of the script from the "Custom" menu, of course.

Videograbber

Hello eumagga!%

Where/How can I write a mail/message to the developers of libavcodec ?

eumagga0x2a

Nevermind, NVENC API supports multiple ref frames since version 9.1 and official builds use almost for sure a version >= 9.1, probably 11.x something. The field we need to set is in AVCodecContext, not in encoder-specific parameters. Patch implementing customizable number of ref frames in NVENC-based encoder plugins inbound.

eumagga0x2a

Roughly implemented by [ffNvEnc] Add maximum number of reference frames to encoder configuration, please test a future nightly and report back as my NVIDIA graphics card doesn't support custom max. ref frames values and also cannot encode HEVC.

We'll probably get some angry support requests due to this change because in its current form, it invites the user to shoot oneself in the foot :-/

Videograbber

Yes, I will try it out, as soon as you will release the new version.

eumagga0x2a

I am not sure whether you clearly understand the difference between release and nightly, but without verification that it works as intended in nightlies, I will remove it prior to release. It won't be in the release then.

Refresh of nightly builds was requested, so please test when one becomes available.

Videograbber

https://www.avidemux.org/nightly/
Quote from: eumagga0x2a on April 30, 2022, 07:06:30 PMI am not sure whether you clearly understand the difference between release and nightly, but without verification that it works as intended in nightlies, I will remove it prior to release. It won't be in the release then.

Refresh of nightly builds was requested, so please test when one becomes available.


The latest nightly is from April 27, 2022.
https://www.avidemux.org/nightly/


eumagga0x2a

Yes, there is nothing to test at the moment, but a refresh has been requested. It will happen when the maintainer has time to do it, and it would be great if you provide feedback once a new build is uploaded.

(If nothing gets uploaded for too long, I can provide upon request a private ZIP-packaged build — i.e. without installer, just extract and run — via WeTransfer, if you are fine with that.)

eumagga0x2a


Videograbber

#14
Quote from: eumagga0x2a on May 01, 2022, 04:02:36 PMA fresh official MinGW build has been uploaded:

https://avidemux.org/nightly/win64/

Dear Eumagga!

I tested extensively the NVENC HEVC with the May 1st nightly version, and it worked well in much higher bitrates too.
 The only problem was when I set the "use B-frames as references" from middle to each. It resulted in errors. I  also noticed, when I selected MAIN10 to  activate 10 bit encoder, the result was only a 8bit file (according to mediainfo)

Can you implement the 10bit option too?


Thank you for your reply!
Best regards!

Bye!