我正在使用gstreamer 1.18(使用gst-build构建(。我正在尝试使用nvh265enc插件的无损预设。使用以下管道,我可以成功使用除无损预设(无损(6(和无损hp(7((之外的所有预设:
gst-launch-1.0 videotestsrc ! nvh265enc preset=6 ! h265parse ! nvh265dec ! glimagesink
每当我将preset
设置为6或7时,就会出现以下错误。
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Got context from element 'sink': gst.gl.GLDisplay=context, gst.gl.GLDisplay=(GstGLDisplay)"(GstGLDisplayX11) gldisplayx11-0";
Got context from element 'nvh265dec0': gst.cuda.context=context, gst.cuda.context=(GstCudaContext)"(GstCudaContext) cudacontext0", cuda-device-id=(int)0;
ERROR: from element /GstPipeline:pipeline0/GstNvH265Enc:nvh265enc0: Could not configure supporting library.
Additional debug info:
../subprojects/gst-plugins-bad/sys/nvcodec/gstnvbaseenc.c(1712): gst_nv_base_enc_set_format (): /GstPipeline:pipeline0/GstNvH265Enc:nvh265enc0:
Failed to init encoder: 8
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
ERROR: from element /GstPipeline:pipeline0/GstNvH265Enc:nvh265enc0: Could not configure supporting library.
Additional debug info:
../subprojects/gst-plugins-bad/sys/nvcodec/gstnvbaseenc.c(1712): gst_nv_base_enc_set_format (): /GstPipeline:pipeline0/GstNvH265Enc:nvh265enc0:
Failed to init encoder: 8
ERROR: pipeline doesn't want to preroll.
Freeing pipeline ...
更令人困惑的是,无损预设适用于英伟达视频编解码器SDK 9的样本。
我是否错过了任何其他配置?
编辑:最后我发现在nvh265enc中添加qp-const=0
或rc-mode=1
是有效的。
首先,无损和无损hp之间没有区别。
请参阅https://superuser.com/questions/1528215/what-is-the-difference-between-nvenc-hevc-lossless-and-losslesshp-presets
其次,Gstreamer并不是英伟达原生支持的应用程序。另一方面,FFmpeg是。例如,GS中不支持B帧作为参考模式及其两个子模式(中间和每个子模式(。请参阅:https://forum.videohelp.com/threads/387613-Nvidia-h-265-hevc-lossless#post2509093
ffmpeg -vsync 0 -r 60 -hwaccel cuda -hwaccel_output_format cuda -i "in.mp4" -c:v hevc_nvenc -preset lossless "out.mp4"
p.S.Gstreamer支持rc模式=1或qp const=0的无损。