ERROR from nvv4l2h264enc. Could not get/set settings from/on resource. Device is in streaming mode

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
A40 GPU

• DeepStream Version
Deepstream 6.2 from within the deepstream:6.2-devel Docker container

• NVIDIA GPU Driver Version (valid for GPU only)
Driver: 525.105.17
CUDA: 12.0

• Issue Type( questions, new requirements, bugs)
Bug?

• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
I’m trying to run the bodypose sample app from deepstream_tao_apps/apps/tao_others/deepstream-bodypose2d-app using the provided config file bodypose2d_app_config.yml.

The pipeline seems simple enough (I didn’t change anything from the sample):
filesrc ! streammux ! queue ! pgie ! queue ! nvtile ! queue ! nvvidconv ! queue ! nvosd ! nvv4l2h264enc ! filesink

Upon running, I get this:

ERROR from element nvvideo-h264enc: Could not get/set settings from/on resource.
Error details: gstv4l2object.c(3511): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline/nvv4l2h264enc:nvvideo-h264enc:
Device is in streaming mode
Returned, stopping playback
Average fps 0.000233
Totally 0 persons are inferred
Deleting pipeline

I understand that with some GPUs (eg A100), there is no hardware encoder, but the A40 has a hardware encoder.

As a standalone repro, use this gst-launch pipeline:
`

gst-launch-1.0 -e -v filesrc name=filesrc0 location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 ! qtdemux ! h264parse config-interval=-1 ! avdec_h264 ! nvvideoconvert ! mux.sink_0 nvstreammux name=mux width=1920 height=1080 batch-size=1 num-surfaces-per-frame=1 enable-padding=1 nvbuf-memory-type=0 ! nvdsosd name=nvdsosd0 process-mode=0 display-clock=1 clock-font-size=20 ! nvvideoconvert ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=./out.mp4

> Setting pipeline to PAUSED ...
> Pipeline is PREROLLING ...
> /GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4, profile=(string)high, codec_data=(buffer)01640028ffe1001a67640028acd940780227e584000003000400000300f03c60c65801000668ebe3cb22c0, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
> Redistribute latency...
> /GstPipeline:pipeline0/avdec_h264:avdec_h264-0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4, profile=(string)high, codec_data=(buffer)01640028ffe1001a67640028acd940780227e584000003000400000300f03c60c65801000668ebe3cb22c0, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
> /GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4, profile=(string)high, codec_data=(buffer)01640028ffe1001a67640028acd940780227e584000003000400000300f03c60c65801000668ebe3cb22c0, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1
> /GstPipeline:pipeline0/avdec_h264:avdec_h264-0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)30/1
> /GstPipeline:pipeline0/Gstnvvideoconvert:nvvideoconvert0.GstPad:src: caps = video/x-raw(memory:NVMM), multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, format=(string)RGBA, framerate=(fraction)30/1, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1, block-linear=(boolean)false
> /GstPipeline:pipeline0/GstNvStreamMux:mux.GstPad:src: caps = video/x-raw(memory:NVMM), multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, format=(string)RGBA, framerate=(fraction)30/1, width=(int)1920, height=(int)1080, block-linear=(boolean)false, batch-size=(int)1, num-surfaces-per-frame=(int)1
> /GstPipeline:pipeline0/GstNvDsOsd:nvdsosd0.GstPad:src: caps = video/x-raw(memory:NVMM), multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, format=(string)RGBA, framerate=(fraction)30/1, width=(int)1920, height=(int)1080, block-linear=(boolean)false, batch-size=(int)1, num-surfaces-per-frame=(int)1
> /GstPipeline:pipeline0/Gstnvvideoconvert:nvvideoconvert1.GstPad:src: caps = video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, framerate=(fraction)30/1, format=(string)I420, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, batch-size=(int)1, num-surfaces-per-frame=(int)1, block-linear=(boolean)false
> /GstPipeline:pipeline0/nvv4l2h264enc:nvv4l2h264enc0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, level=(string)NULL, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
> /GstPipeline:pipeline0/GstH264Parse:h264parse1.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)NULL, level=(string)NULL, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
> Redistribute latency...
> Redistribute latency...
> ERROR: from element /GstPipeline:pipeline0/nvv4l2h264enc:nvv4l2h264enc0: Could not get/set settings from/on resource.
> Additional debug info:
> gstv4l2object.c(3511): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/nvv4l2h264enc:nvv4l2h264enc0:
> Device is in streaming mode
> ERROR: pipeline doesn't want to preroll.
> Setting pipeline to NULL ...
> Freeing pipeline ...

Here is my nvidia-smi

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.105.17   Driver Version: 525.105.17   CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA A40          Off  | 00007202:00:00.0 Off |                    0 |
|  0%   39C    P0    72W / 300W |      0MiB / 46068MiB |      4%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

could you share the output of “gst-inspect-1.0 |grep nvv4l2h264enc” and “ldd /usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libgstnvvideo4linux2.so” ?

# gst-inspect-1.0 |grep nvv4l2h264enc
nvvideo4linux2:  nvv4l2h264enc: V4L2 H.264 Encoder

# ldd /usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libgstnvvideo4linux2.so
        linux-vdso.so.1 (0x00007ffebc74c000)
        libnvbufsurface.so => ///opt/nvidia/deepstream/deepstream-6.2/lib/libnvbufsurface.so (0x00007fda27c84000)
        libgstallocators-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstallocators-1.0.so.0 (0x00007fda27c68000)
        libgstnvdsseimeta.so => ///opt/nvidia/deepstream/deepstream-6.2/lib/libgstnvdsseimeta.so (0x00007fda27c63000)
        libgstreamer-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so.0 (0x00007fda27b1c000)
        libgstvideo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstvideo-1.0.so.0 (0x00007fda27a69000)
        libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fda27940000)
        libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007fda278e0000)
        libv4l2.so.0 => /usr/lib/x86_64-linux-gnu/libv4l2.so.0 (0x00007fda277db000)
        libc.so.6 => /usr/lib/x86_64-linux-gnu/libc.so.6 (0x00007fda275e9000)
        libcudart.so.11.0 => /usr/local/cuda-11.8/lib64/libcudart.so.11.0 (0x00007fda27342000)
        libnvbuf_fdmap.so => ///opt/nvidia/deepstream/deepstream-6.2/lib/libnvbuf_fdmap.so (0x00007fda2733a000)
        libpthread.so.0 => /usr/lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fda27317000)
        libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007fda27311000)
        libm.so.6 => /usr/lib/x86_64-linux-gnu/libm.so.6 (0x00007fda271c2000)
        libdl.so.2 => /usr/lib/x86_64-linux-gnu/libdl.so.2 (0x00007fda271bc000)
        libgstbase-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libgstbase-1.0.so.0 (0x00007fda2713c000)
        liborc-0.4.so.0 => /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0 (0x00007fda270b9000)
        libpcre.so.3 => /usr/lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fda27046000)
        libffi.so.7 => /usr/lib/x86_64-linux-gnu/libffi.so.7 (0x00007fda2703a000)
        libv4lconvert.so.0 => /usr/lib/x86_64-linux-gnu/libv4lconvert.so.0 (0x00007fda26fb3000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fda27cd8000)
        librt.so.1 => /usr/lib/x86_64-linux-gnu/librt.so.1 (0x00007fda26fa9000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fda26dc5000)
        libgcc_s.so.1 => /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fda26daa000)

  1. from this link support, A40 should supports HW encoding. this command can run fine on my T4 GPU.
  2. did you run many HW encoding tasks on the A40? “Could not get/set settings from/on resource.” should be related to GPU resource. please refer to this topic nvv4l2h264enc
  3. for simplicity, could you try these two commands?
    gst-launch-1.0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! fakesink
    gst-launch-1.0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvideoconvert ! video/x-raw\(memory:NVMM\),format=I420 ! nvv4l2h264enc bitrate=1000000 ! filesink location=test.264
  1. I have tried on all the GPUs I have here including A2, A100 (no HW encoder), and A40. Interestingly, in one A2 environment, the test succeeds; in another it fails. Perhaps examining these two environments could help? Here are the differences I see in those two systems:

A2. Nvidia 525.105.17. CUDA 12.0. DS 6.2 = FAILS
A2. Nvidia 510.47.03. CUDA 11.7. DS 6.1.1 = SUCCEEDS

I have tried installing various versions of the Nvidia drivers on the A40 system, but nothing works (470.182.03, 530.41.03, 515.105.01, 525.105.17). I’ve also tried DS 6.1.1 vs DS6.2 but see no differences.

  1. There is nothing else running on this A40 environment. From the nvidia-smi output, you can see “No running processes found”

  2. See below:

# gst-launch-1.0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! fakesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/nvv4l2decoder:nvv4l2decoder0: Device '/dev/nvidia0' failed during initialization
Additional debug info:
gstv4l2object.c(4134): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/nvv4l2decoder:nvv4l2decoder0:
Call to S_FMT failed for H264 @ 1280x720: Unknown error -1
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
# gst-launch-1.0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvideoconvert ! video/x-raw\(memory:NVMM\),format=I420 ! nvv4l2h264enc bitrate=1000000 ! filesink location=test.264
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
ERROR: from element /GstPipeline:pipeline0/nvv4l2decoder:nvv4l2decoder0: Device '/dev/nvidia0' failed during initialization
Additional debug info:
gstv4l2object.c(4134): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline0/nvv4l2decoder:nvv4l2decoder0:
Call to S_FMT failed for H264 @ 1280x720: Unknown error -1
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
  1. the all components need to meet this requirement requirement
  2. from the error, it is decoder error, HW decoding also has problems.

We found that the issue is in HOW the Nvidia drivers are installed, and not the specific version. I think.

If installed via:

apt-get install nvidia-headless-525-server

hardware encoding fails. However, if we download the installer from

https://us.download.nvidia.com/tesla/$DRIVER_VER/NVIDIA-Linux-x86_64-$DRIVER_VER.run

and run the file, it works.

I’m guessing that the installer includes some components that the headless driver does not?

thanks for the sharing, do you mean the encoding issue is fixed after reinstalling driver by this method? I noticed “sudo apt install nvidia-headless-525-server” dose not include libraries for NVDEC & NVENC, please refer to driver1,driver2, but currently I did see the official doc.
Is this still an DeepStream issue to support? Thanks!

Yes, the issue is fixed after installing the correct drivers, and the way I did that was with the download. I will investigate the other methods you linked to.

Perhaps adding this to the knowledge base would save time in the future - if encoding/decoding does not work when it should, check the drivers.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.