nvv4l2h265enc: Device '/dev/nvhost-msenc' failed during initialization

While test driving DeepStream 4.0-ea, I ran into an error with the nvv4l2h265enc encoder. At first, I thought it replaced v4l2src and automatically took care of DMA and h265 encoding (which would be pretty nice). Anyway, the plugin documentation through gst-inspect-1.0 is a little hazy on the details, but I remembered a pipeline for the jetson nano and figured it would work similarly. It’s still pretty exciting to see an h265 encoder bundled with the SDK! It avoids me having to build gstreamer from source to get nvenc and nvdec elements.

DeepStream 3.0 pipeline (tegra):

gst-launch-1.0 -ve nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)3280, height=(int)2464, format=(string)NV12' ! nvv4l2h265enc ! h265parse ! qtmux ! filesink location=test.mp4

DeepStream 4.0 pipeline (tesla):

gst-launch-1.0 -ve v4l2src device=/dev/video0 ! 'video/x-raw, width=(int)4208, height=(int)3120, format=(string)UYVY' ! videoconvert ! 'video/x-raw, format=(string)I420' ! nvvideoconvert ! nvv4l2h265enc ! h265parse ! qtmux ! filesink location=test.mp4

Fails with the error:

ERROR: from element /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0: Device '/dev/nvhost-msenc' failed during initialization

Full output:

Setting pipeline to PAUSED ...

(gst-launch-1.0:18): GStreamer-CRITICAL **: 20:43:49.811: gst_value_set_fraction: assertion 'denominator != 0' failed
Pipeline is live and does not need PREROLL ...
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstFileSink:sink: async = false
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, width=(int)4208, height=(int)3120, format=(string)UYVY, framerate=(fraction)9/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt2020, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, width=(int)4208, height=(int)3120, format=(string)UYVY, framerate=(fraction)9/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt2020, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:src: caps = video/x-raw, width=(int)4208, height=(int)3120, framerate=(fraction)9/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, format=(string)I420
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:src: caps = video/x-raw, width=(int)4208, height=(int)3120, framerate=(fraction)9/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, format=(string)I420
in videoconvert caps = video/x-raw(memory:NVMM), width=(int)4208, height=(int)3120, framerate=(fraction)9/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420, interlace-mode=(string)progressive
/GstPipeline:pipeline0/Gstnvvideoconvert:nvvideoconvert0.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)4208, height=(int)3120, framerate=(fraction)9/1, pixel-aspect-ratio=(fraction)1/1, format=(string)I420, interlace-mode=(string)progressive
/GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0.GstPad:src: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, width=(int)4208, height=(int)3120, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)9/1, interlace-mode=(string)progressive, colorimetry=(string)bt2020, chroma-site=(string)mpeg2
/GstPipeline:pipeline0/GstH265Parse:h265parse0.GstPad:sink: caps = video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, width=(int)4208, height=(int)3120, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)9/1, interlace-mode=(string)progressive, colorimetry=(string)bt2020, chroma-site=(string)mpeg2
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0: Device '/dev/nvhost-msenc' failed during initialization
Additional debug info:
gstv4l2object.c(4073): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0:
Call to S_FMT failed for YM12 @ 4208x3120: Unknown error -1
EOS on shutdown enabled -- waiting for EOS after Error
Waiting for EOS...
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0: Device '/dev/nvhost-msenc' failed during initialization
Additional debug info:
gstv4l2object.c(4073): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0:
Call to S_FMT failed for YM12 @ 4208x3120: Unknown error -1
/GstPipeline:pipeline0/Gstnvvideoconvert:nvvideoconvert0.GstPad:sink: caps = video/x-raw, width=(int)4208, height=(int)3120, framerate=(fraction)9/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, format=(string)I420
/GstPipeline:pipeline0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-raw, width=(int)4208, height=(int)3120, framerate=(fraction)9/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, format=(string)I420
/GstPipeline:pipeline0/GstVideoConvert:videoconvert0.GstPad:sink: caps = video/x-raw, width=(int)4208, height=(int)3120, format=(string)UYVY, framerate=(fraction)9/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt2020, interlace-mode=(string)progressive
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, width=(int)4208, height=(int)3120, format=(string)UYVY, framerate=(fraction)9/1, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)bt2020, interlace-mode=(string)progressive
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0: Device '/dev/nvhost-msenc' failed during initialization
Additional debug info:
gstv4l2object.c(4073): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0:
Call to S_FMT failed for YM12 @ 4208x3120: Unknown error -1
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0: Device '/dev/nvhost-msenc' failed during initialization
Additional debug info:
gstv4l2object.c(4073): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0:
Call to S_FMT failed for YM12 @ 4208x3120: Unknown error -1
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0: Device '/dev/nvhost-msenc' failed during initialization
Additional debug info:
gstv4l2object.c(4073): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0:
Call to S_FMT failed for YM12 @ 4208x3120: Unknown error -1
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0: Device '/dev/nvhost-msenc' failed during initialization
Additional debug info:
gstv4l2object.c(4073): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0:
Call to S_FMT failed for YM12 @ 4208x3120: Unknown error -1
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0: Device '/dev/nvhost-msenc' failed during initialization
Additional debug info:
gstv4l2object.c(4073): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/nvv4l2h265enc:nvv4l2h265enc0:
Call to S_FMT failed for YM12 @ 4208x3120: Unknown error -1
/GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstMP4Mux:muxer.GstPad:src: caps = video/quicktime, variant=(string)iso
ERROR: from element /GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstMP4Mux:muxer: Downstream is not seekable - will not be able to create a playable file
Additional debug info:
gstqtmux.c(2780): gst_qt_mux_start_file (): /GstPipeline:pipeline0/GstSplitMuxSink:splitmuxsink0/GstMP4Mux:muxer
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Interrupt while waiting for EOS - stopping pipeline...
Execution ended after 0:00:02.540376774
Setting pipeline to PAUSED ...
Setting pipeline to READY ...

(gst-launch-1.0:18): GStreamer-CRITICAL **: 20:43:52.452: gst_object_unref: assertion '((GObject *) object)->ref_count > 0' failed
Setting pipeline to NULL ...
Freeing pipeline ...

Hi timl6bbz,

Please try below pipeline:

gst-launch-1.0 -ve v4l2src device=/dev/video0 ! videoconvert ! nvvideoconvert ! nvv4l2h265enc bufapi-version=true ! h265parse ! qtmux ! filesink location=test.mp4

We’re confirmed this is working on Jetson-Xavier.

I’m trying to run this pipeline on Deepstream for Tesla (4.0-ea). I tried the pipeline you recommended but bufapi-version is not a known property of nvv4l2h265enc. Without that property, I get the same error as before.

Hi timl6bbz,

For dGPU, please run below pipeline:

gst-launch-1.0 -ve v4l2src device=/dev/video0 ! videoscale ! 'video/x-raw, width=(int)4208, height=(int)3120, format=(string)UYVY' ! videoconvert ! 'video/x-raw, format=(string)I420' ! nvvideoconvert ! nvv4l2h265enc ! h265parse ! qtmux ! filesink location=test.mp4

That’s the same pipeline as my first post without videoscale because my camera can output 4208x3120. I still get the same error ‘Device ‘/dev/nvhost-msenc’ failed during initialization’.

Hi timl6bbz,

We can’t reproduce your issue on both 2080 RTX and Tesla T4.
Could you list your system requirement?
ex: Ubuntu version, cuda version, TensorRT version and Linux x86_64 Nvidia Driver Version…

GPUs tested: 1080Ti, 2080Ti
Driver versions tested: 418.67, 430.14
Cuda versions tested: 10.0, 10.1, 10.2
Docker image: deepstream:4.0-ea

I just pull the docker image:

docker pull nvcr.io/nvdeepstream/deepstream:4.0-ea

run it:

docker run --runtime=nvidia -it --rm --device /dev/video0 -v /mnt/data:/data nvcr.io/nvdeepstream/deepstream:4.0-ea

and then execute:

gst-launch-1.0 -ve v4l2src device=/dev/video0 ! 'video/x-raw, width=(int)4208, height=(int)3120, format=(string)UYVY' ! videoconvert ! 'video/x-raw, format=(string)I420' ! nvvideoconvert ! nvv4l2h265enc ! h265parse ! qtmux ! filesink location=test.mp4

which fails with the output from my second post.

Hi timl6bbz,

in the docker image is there device node /dev/nvidia0 ?
OR is there /dev/nvidia1 node ?

Hi timl6bbz,

Is this still an issue in your side?
Any result can be shared?

Thanks

Hi timl6bbz,

We have released the DeepSteam SDK 4.0 at last week, please move to this new version for more features and supports, see https://devtalk.nvidia.com/default/topic/1057879/announcements/announcing-deepstream-sdk-4-0-/

Thanks