[Cin] Testing Nvidia Nvenc encoding

Terje J. Hanssen terjejhanssen at gmail.com
Sat Dec 21 13:41:45 CET 2024




Den 21.12.2024 03:17, skrev Andrew Randrianasulu:
>
>
> пт, 20 дек. 2024 г., 21:58 Terje J. Hanssen <terjejhanssen at gmail.com>:
>
>
>
>
>     Den 20.12.2024 17:40, skrev Andrew Randrianasulu:
>>
>>
>>     пт, 20 дек. 2024 г., 19:20 Terje J. Hanssen via Cin
>>     <cin at lists.cinelerra-gg.org>:
>>
>>         Continued and extracted from
>>         [Cin] Video accelerators support, builds and use
>>         https://lists.cinelerra-gg.org/pipermail/cin/2024-December/009226.html
>>
>>         Den 12.12.2024 00:54, skrev Terje J. Hanssen:
>>>
>>>         Den 11.12.2024 23:56, skrev Andrew Randrianasulu:
>>>>
>>>>         чт, 12 дек. 2024 г., 00:43 Terje J. Hanssen via Cin
>>>>         <cin at lists.cinelerra-gg.org>:
>>>>
>>>>             To clarify some pieces once again, I put up some basic
>>>>             statements or questions:
>>>>
>>         ..........snip
>>>>
>>>>
>>>>                 So what happened when adding oneVPL (qsv) support
>>>>                 to the build system; dynamic linked to system or
>>>>                 static added embedded into the build?
>>>>
>>>>
>>>>             dynamic
>>>>
>>>>             .....snip
>>>>
>>>>                 Could in principle similar methods be extended to
>>>>                 include broader video acceleration support for
>>>>                 AMD/amf and NVIDIA/nvenc?
>>>>
>>>>
>>>>             nvenc already supported, I think? At some point I tried
>>>>             it with GF710 on livedvd and it was working for me. try
>>>>             to test it if you have proprietary nvidia drivers.
>>>>
>>
>>         Apparently Cingg then should supports NVENC via some dynamic
>>         linked external Nvidia lib, equivalent to what we did for for
>>         QSV via oneVPL support.
>>         While h264_nvenc.mp4 rendering works, h265_nvenc.mp4 fails
>>         with the following errors, see detail below:
>>
>>         [hevc_nvenc @ 0x7ff79c015640] No capable devices found
>>         FFMPEG::open_encoder  err: Generic error in an external library
>>
>>
>>>
>>>         Yes, seemingly:
>>>         Cin/bin/ffmpeg/video> ls *nvenc*
>>>         h264_nvenc.mp4  h264_nvenc.qt h265_nvenc.mp4
>>
>>         NVENC Presets
>>
>>         cat h264_nvenc.mp4
>>         mp4 h264_nvenc
>>         # encode for nvidia graphics hw only
>>         preset medium
>>         profile main
>>
>>         cat h265_nvenc.mp4
>>         mp4 hevc_nvenc
>>         # encode for nvidia graphics hw only
>>         preset medium
>>         profile main
>>
>>>
>>>         Maybe I can do an attempt later, if I get life in the old
>>>         GeForce GTX 960 in my Skylake workstation.
>>>
>>
>>         Setup
>>         ----------
>>         Booted BIOS and checked that the integrated Intel gpu and
>>         multimonitor setup were enabled.
>>         Installed the suse-prime package for nvidia/intel gpu
>>         selection (for NVIDIA optimus laptops with bbswitch support)
>>         and could then run the command
>>
>>         prime-select on-demand
>>
>>         and verified that both the Intel and Nvidia drivers were
>>         available
>>
>>         inxi -G
>>         Graphics:
>>           Device-1: Intel HD Graphics 530 driver: i915 v: kernel
>>           Device-2: NVIDIA GM206 [GeForce GTX 960] driver: nvidia v:
>>         550.135
>>           Display: wayland server: X.org v: 1.21.1.14 with: Xwayland
>>         v: 24.1.4
>>             compositor: gnome-shell v: 47.2 driver: X: loaded:
>>         modesetting,nvidia
>>             unloaded: fbdev,vesa dri: iris gpu: i915 resolution:
>>         1920x1080~60Hz
>>           API: OpenGL v: 4.6 vendor: intel mesa v: 24.3.1 renderer:
>>         Mesa Intel HD
>>             Graphics 530 (SKL GT2)
>>           API: EGL Message: EGL data requires eglinfo. Check
>>         --recommends.
>>
>>         ==============
>>
>>
>>         Test h264_nvenc.mp4
>>         -------------------
>>         OK
>>
>>         ./CinGG-20241120-x86_64.AppImage
>>         Cinelerra Infinity - built: Nov 20 2024 22:06:05
>>
>>         Loads hdv09_04.m27
>>         Shift-R
>>         mp4
>>         h264_nvenc (video preset)
>>         pixels: yuv420p (default)
>>
>>         ** rendered 5972 frames in 27.391 secs, 218.028 fps
>>
>>         ffprobe -hide_banner hdv09_04_h264_nvenc_yuv420p.mp4
>>           Stream #0:0[0x1](und): Video: h264 (Main) (avc1 /
>>         0x31637661), yuvj420p(pc, smpte170m/unknown/unknown),
>>         1440x1080 [SAR 4:3 DAR 16:9], 2156 kb/s, 25 fps, 25 tbr,
>>         12800 tbn (default)
>>
>>         -------
>>
>>         Tried also h264_nvenc with
>>         pixels: nv12
>>         which for slowed down to 45% speed !?
>>
>>         Render::render_single: Session finished.
>>         ** rendered 5972 frames in 60.368 secs, 98.927 fps
>>
>>         ffprobe -hide_banner hdv09_04_h264_nvenc_nv12.mp4
>>           Stream #0:0[0x1](und): Video: h264 (Main) (avc1 /
>>         0x31637661), yuvj420p(pc, smpte170m/unknown/unknown),
>>         1440x1080 [SAR 4:3 DAR 16:9], 2154 kb/s, 25 fps, 25 tbr,
>>         12800 tbn (default)
>>
>>
>>     ======
>>
>>     for hevc nvenc test may be try to set mjpeg colorspace instead of
>>     jpeg?
>
>     Tried the other option MPEG, and also BT.709, which both works for
>     h264_nvenc, but has no effect with regards to the hevc errors.
>
>     Tried also to comment out each and both of the h265_nvenc preset's
>     preset medium
>     profile main
>
>     but with no effect.
>
>     So far it looks for me that there is something wrong with Cingg's
>     hevc_nvenc encoding.
>
>
>
> most likely our nv headers drifted from that ffmpeg-7.0/proprietary 
> driver assumes at runtime.
>
> you can try to install something like nv-codec-headers and then add
>
> --disable-ffnvcodec
>
> configure switch to cingg (disables our copy of nv headers from 2020) 
> and see if ffmpeg compilation picked up system's headers.
>
> BUT you also can test progressive (not interlaced) file, like you did 
> with qsv.

Yeah, hevc_nvenc turns out to have just the same tff interlace issue as 
we experienced with qsv.
At first I just tried to change Cingg Setting | Fomat Video to "Not 
interlaced" and the interlaced hdv file rendered OK.
Tested also that a deinterlaced (progressive) version also rendered ok.

Loaded also a bff interlaced SD.dv file that Cingg Setting recognized as 
"Unknown", did render ok without manual change.

Maybe also h265_nvenc preset at opportunity also better should be 
renamed to hevc_nvenc in accordance with ffmpeg's use.








>
>
>
>
>
>
>
>
>>
>>
>>         ===================
>>
>>         Test h265_nvenc.mp4
>>         -------------------
>>
>>         Did not render, neither with pixels yuv420p nor nv12:
>>         FFMPEG::open_encoder err: Generic error in an external library
>>
>>         [hevc_nvenc @ 0x7ff79c015640] No capable devices found
>>         FFMPEG::open_encoder  err: Generic error in an external library
>>         int FFMPEG::open_encoder(const char*, const char*):
>>         open failed
>>         hevc_nvenc:/run/media/terje/video/hdv09_04_h265_nvenc_yuv420p.mp4
>>         Render::render_single: Session finished.
>>
>>         ===================
>>
>>         GeForce GTX 960 (GM206) should be capable to manage NVENC
>>         h265/hevc YUV 420 encoding
>>         https://en.wikipedia.org/wiki/Nvidia_NVENC#Third_generation,_Maxwell_GM20x
>>         https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new
>>
>>         Tested hevc_nvenc full transcoding with FFmpeg 7.1
>>
>>         ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda
>>         -i hdv09_04.m2t -c:v hevc_nvenc hdv09_04_ff_hevc_nvenc.mp4
>>
>>         frame= 5963 fps=270 q=34.0 Lsize= 64316KiB time=00:03:58.77
>>         bitrate=2206.6kbits/s speed=10.8x
>>         [aac @ 0x55a38d4c4d40] Qavg: 488.890
>>
>>         ------------------
>>
>>         ffprobe -hide_banner hdv09_04_ff_hevc_nvenc.mp4
>>         Stream #0:0[0x1](und): Video: hevc (Main) (hev1 /
>>         0x31766568), yuv420p(tv, bt709, top coded first (swapped)),
>>         1440x1080 [SAR 4:3 DAR 16:9], 2074 kb/s, 24.99 fps, 25 tbr,
>>         12800 tbn (default)
>>
>>
>>
>>
>>
>>
>>         -- 
>>         Cin mailing list
>>         Cin at lists.cinelerra-gg.org
>>         https://lists.cinelerra-gg.org/mailman/listinfo/cin
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20241221/7bd3939e/attachment-0001.htm>


More information about the Cin mailing list