Reconfigure nvvideoconvert on the fly but nvv4l2h264enc not support this

Hello,
Initially , i have open this first issue : Reconfigure nvvideoconvert on the fly but pipeline freezing

But in fact, i have always crash

For reproduce this :
use this docker image : nvcr.io/nvidia/deepstream:6.0-devel on RTX 3070 or another with this driver version ( 470.161.03 )

For reproduce this crash, you can use this source code for debug
bug_rescale_udp_change_caps.cpp and you must be set WITH_NVVL4_GPU flag to true.
build it, Stream a video, 1920 *1080 at 60fps in h264 with rtp protocol on this port 9024

with WITH_NVVL4_GPU flag to false, it works fine

bug_rescale_udp_change_caps.cpp (9.2 KB)

there are many custom code, can you simplify the code to reproduce? for example,

  1. use filesrc because we don’t have that TS source.
  2. link fakesink after nvv4l2h264enc.

GStreamer 1.17.90 for nvh264enc plugin

Step for reproduce :

Firstly, you must be use this pipeline for ts source :

gst-launch-1.0 videotestsrc pattern=18 is-live=true num-buffers=-1 ! capsfilter caps=“video/x-raw,format=I420,width=1920,height=1080,framerate=60/1” ! nvh264enc ! queue ! h264parse ! mpegtsmux ! tsparse set-timestamps=true ! rtpmp2tpay ! udpsink host=x.x.x.x port=9024

Secondly, build it with WITH_NVVL4_GPU flag to false and launch this pipeline, it works perfectly

For output display, you can use this player (Official download of VLC media player, the best Open Source player - VideoLAN ) ( vlc media player in gui mode ) and open (Media / Open network Stream / rtp://@:5000 )

For reproduce nvv4l2h264enc crash,

build it with WITH_NVVL4_GPU flag to true and launch this pipeline, it does not work when I use the plugins ( nvv4l2decoder and nvv4l2h264enc ) after setting WITH_NVVL4_GPU to true (see in source file)

root@6dd77084ea05:/opt/nvidia/deepstream/deepstream-6.0/sources/apps/sample_apps/deepstream-3d-action-recognition# gst-inspect-1.0 nvv4l2h264enc
Factory Details:
Rank primary + 1 (257)
Long-name V4L2 H.264 Encoder
Klass Codec/Encoder/Video
Description Encode H.264 video streams via V4L2 API
Author ayaka ayaka@soulik.info

Plugin Details:
Name nvvideo4linux2
Description Nvidia elements for Video 4 Linux
Filename /usr/lib/x86_64-linux-gnu/gstreamer-1.0/deepstream/libgstnvvideo4linux2.so
Version 1.14.0
License LGPL
Source module nvvideo4linux2
Binary package nvvideo4linux2
Origin URL http://nvidia.com/

deepstream_test1_app.c (12.6 KB)
please use this file to reprodcue the issue, it includes hardware decoding and encoding, I can’t reproduce this issue after setting the same encoding parameters.

bug_nvidia.tar.xz (4.7 KB)
I took the time to recode a simple binary to reproduce this problem every time.

see in attachement :

dockerfile + source for rebuild bin for reproduce it. Dont forget to open udp port…

there is no simpler way to reproduce the crash of the encoder after launch bug_rescale_udp_change_caps bin

after setting WITH_NVVL4_GPU to true (see in source file) , launch “make install” for new build.
and
enabling logs “export GST_DEBUG=2”

0:00:01.332421056 4086 0x5563a12136d0 WARN v4l2bufferpool gstv4l2bufferpool.c:1065:gst_v4l2_buffer_pool_start:enc-debug:pool:src Uncertain or not enough buffers, enabling copy threshold
0:00:01.332542188 4086 0x5563a12136d0 WARN v4l2videodec gstv4l2videodec.c:1685:gst_v4l2_video_dec_decide_allocation: Duration invalid, not setting latency
0:00:01.332559133 4086 0x5563a12136d0 WARN v4l2bufferpool gstv4l2bufferpool.c:1065:gst_v4l2_buffer_pool_start:dec-debug:pool:src Uncertain or not enough buffers, enabling copy threshold
0:00:01.332948789 4086 0x5563a1213590 WARN v4l2bufferpool gstv4l2bufferpool.c:1512:gst_v4l2_buffer_pool_dqbuf:dec-debug:pool:src Driver should never set v4l2_buffer.field to ANY
nvbufsurface: NvBufSurfaceCopy: buffer size mismatch
nvbufsurface: NvBufSurfaceCopy: failed to copy
ERROR in BufSurfacecopy
0:00:01.333731889 4086 0x5563a1213590 ERROR v4l2bufferpool gstv4l2bufferpool.c:2349:gst_v4l2_buffer_pool_process:enc-debug:pool:sink failed to prepare data
0:00:01.333742060 4086 0x5563a1213590 WARN v4l2videoenc gstv4l2videoenc.c:1343:gst_v4l2_video_enc_handle_frame: error: Failed to process frame.
0:00:01.333746455 4086 0x5563a1213590 WARN v4l2videoenc gstv4l2videoenc.c:1343:gst_v4l2_video_enc_handle_frame: error: Maybe be due to not enough memory or failing driver
ERROR from element enc-debug: Failed to process frame.
Error details: gstv4l2videoenc.c(1343): gst_v4l2_video_enc_handle_frame (): /GstPipeline:debug-pipeline/nvv4l2h264enc:enc-debug:
Maybe be due to not enough memory or failing driver
0:00:01.338482697 4086 0x5563a1238010 WARN v4l2bufferpool gstv4l2bufferpool.c:1214:gst_v4l2_buffer_pool_stop:dec-debug:pool:src some buffers are still outstanding
0:00:01.338493105 4086 0x5563a1238010 WARN bufferpool gstbufferpool.c:570:gst_buffer_pool_set_active:dec-debug:pool:src stop failed
0:00:01.338500656 4086 0x5563a1238010 WARN v4l2bufferpool gstv4l2bufferpool.c:1214:gst_v4l2_buffer_pool_stop:dec-debug:pool:src some buffers are still outstanding
0:00:01.338504507 4086 0x5563a1238010 WARN bufferpool gstbufferpool.c:570:gst_buffer_pool_set_active:dec-debug:pool:src stop failed

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks

from the description, the issue seemed to be related to encoding, but why ts input, ts output are neceessary? to find the root cause, please simplify the code, from example, use file source, faksink, remove some code to find which line code will cause the error.
or deepstream_test1_app.c posted above is from nvidia official sample deepstream-test1, It can run successfully, we recommend to reproduce the issue based on this basical sample.

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