Gstreamer is failing while setting stop pipeline

Hi,
Gstreamer start giving error when we try to set stop pipeline to stop the recording. Please find below error logs and do the needful

CsiProducer.start_pipeline(“Ere”)
Opening in BLOCKING MODE
Opening in BLOCKING MODE
0:00:17.462740245 8429 0x34ec580 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0x3465c00 Failed to determine interlace mode
0:00:17.462827854 8429 0x34ec580 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0x3465c00 Failed to determine interlace mode
0:00:17.462886868 8429 0x34ec580 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0x3465c00 Failed to determine interlace mode
0:00:17.462981874 8429 0x34ec580 WARN v4l2 gstv4l2object.c:4434:gst_v4l2_object_probe_caps:<nvv4l2h264_enc:src> Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
True
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
0:00:17.609461601 8429 0x34ec370 WARN v4l2bufferpool gstv4l2bufferpool.c:1065:gst_v4l2_buffer_pool_start:<nvv4l2h264_enc:pool:src> Uncertain or not enough buffers, enabling copy threshold
0:00:17.615563073 8429 0x34ec370 WARN v4l2bufferpool gstv4l2bufferpool.c:790:gst_v4l2_buffer_pool_start:<csi_source:pool:src> Uncertain or not enough buffers, enabling copy threshold
H264: Profile = 66, Level = 0
NVMEDIA_ENC: bBlitMode is set to TRUE
0:00:17.718951112 8429 0x3500f20 WARN v4l2bufferpool gstv4l2bufferpool.c:1512:gst_v4l2_buffer_pool_dqbuf:<nvv4l2h264_enc:pool:src> Driver should never set v4l2_buffer.field to ANY
0:00:17.719723347 8429 0x3500f20 FIXME basesink gstbasesink.c:3145:gst_base_sink_default_event: stream-start event without group-id. Consider implementing group-id handling in the upstream elements
CsiProducer.stop_pipeline()
0:00:37.868229773 8429 0x3500f20 WARN v4l2allocator gstv4l2allocator.c:1511:gst_v4l2_allocator_dqbuf:<nvv4l2h264_enc:pool:src:allocator> V4L2 provided buffer has bytesused 0 which is too small to include data_offset 0
True
CsiProducer.start_pipeline(“Ere1”)
Opening in BLOCKING MODE
Opening in BLOCKING MODE
0:00:48.674439283 8429 0x34ec580 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0x34cc8e0 Failed to determine interlace mode
0:00:48.674512829 8429 0x34ec580 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0x34cc8e0 Failed to determine interlace mode
0:00:48.674567103 8429 0x34ec580 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0x34cc8e0 Failed to determine interlace mode
0:00:48.674695653 8429 0x34ec580 WARN v4l2 gstv4l2object.c:4434:gst_v4l2_object_probe_caps:<nvv4l2h264_enc:src> Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
Opening in BLOCKING MODE
Segmentation fault

Code to stop pipeline is

bus = pipeline.get_bus()
pipeline.send_event(Gst.Event.new_eos())
bus.timed_pop_filtered(Gst.CLOCK_TIME_NONE, Gst.MessageType.EOS)
pipeline.set_state(Gst.State.NULL)
return True

Gstreamer command is
gst-launch-1.0 -e v4l2src device=/dev/video0 ! “video/x-raw, format=(string)UYVY, width=(int)1280, height=(int)720” ! nvvidconv ! “video/x-raw(memory:NVMM), format=(string)I420” ! nvv4l2h264enc bitrate=6000000 control-rate=1 vbv-size=750000 ! h264parse ! matroskamux ! queue ! filesink location=2.mkv

Hi,
Please apply the command to this sample:
Nvoverlaysink ignores properties when pipeline is restarted - #6 by DaneLLL
And check if the issue is present.

Please also share your release version ($ cat /etc/nv_tegra_release)

Hi @DaneLLL
Thanks for quick response. I followed the mentioned steps, but still giving the same error. Very first time, its generating the video file correctly, but start giving error once we stop and restart pipeline. Please find below logs message

Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

from parent.gstreamer_ecam_csi import CsiProducer
[‘09-10’, ‘09-14’]
CsiProducer.start_pipeline(“asd111”)
Opening in BLOCKING MODE
Opening in BLOCKING MODE
0:00:05.114337027 8345 0xe4220a0 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0xe3ad000 Failed to determine interlace mode
0:00:05.114425362 8345 0xe4220a0 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0xe3ad000 Failed to determine interlace mode
0:00:05.114488331 8345 0xe4220a0 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0xe3ad000 Failed to determine interlace mode
0:00:05.114577968 8345 0xe4220a0 WARN v4l2 gstv4l2object.c:4434:gst_v4l2_object_probe_caps:<nvv4l2h264_enc:src> Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
True
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
0:00:05.257816146 8345 0xe44c400 WARN v4l2bufferpool gstv4l2bufferpool.c:1065:gst_v4l2_buffer_pool_start:<nvv4l2h264_enc:pool:src> Uncertain or not enough buffers, enabling copy threshold
0:00:05.263945925 8345 0xe44c400 WARN v4l2bufferpool gstv4l2bufferpool.c:790:gst_v4l2_buffer_pool_start:<csi_source:pool:src> Uncertain or not enough buffers, enabling copy threshold
H264: Profile = 66, Level = 0
NVMEDIA_ENC: bBlitMode is set to TRUE
0:00:05.376069524 8345 0xe447720 WARN v4l2bufferpool gstv4l2bufferpool.c:1512:gst_v4l2_buffer_pool_dqbuf:<nvv4l2h264_enc:pool:src> Driver should never set v4l2_buffer.field to ANY
0:00:05.376907609 8345 0xe432720 FIXME basesink gstbasesink.c:3145:gst_base_sink_default_event: stream-start event without group-id. Consider implementing group-id handling in the upstream elements
CsiProducer.stop_pipeline()
0:00:27.534829897 8345 0xe447720 WARN v4l2allocator gstv4l2allocator.c:1511:gst_v4l2_allocator_dqbuf:<nvv4l2h264_enc:pool:src:allocator> V4L2 provided buffer has bytesused 0 which is too small to include data_offset 0
Switch to NULL state
True
CsiProducer.start_pipeline(“asd1112”)
Opening in BLOCKING MODE
Opening in BLOCKING MODE
0:00:40.056426857 8345 0xe4220a0 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0xe412f10 Failed to determine interlace mode
0:00:40.056505140 8345 0xe4220a0 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0xe412f10 Failed to determine interlace mode
0:00:40.056563370 8345 0xe4220a0 WARN v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0xe412f10 Failed to determine interlace mode
0:00:40.056654881 8345 0xe4220a0 WARN v4l2 gstv4l2object.c:4434:gst_v4l2_object_probe_caps:<nvv4l2h264_enc:src> Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
Opening in BLOCKING MODE
Segmentation fault

Regarding Tegra release, please find below outcome.

cat /etc/nv_tegra_releas

R32 (release), REVISION: 5.1, GCID: 26202423, BOARD: t210ref, EABI: aarch64, DATE: Fri Feb 19 16:45:52 UTC 2021

Hi,
For r32.5.1, please apply this prebuilt lib:
Jetson/L4T/r32.5.x patches - eLinux.org
[camera] 3rdparty application fails to open with USB camera

And give it a try.

Hi @DaneLLL

Thanks a ton. The issue is resolved now and I can able to restart pipe and stop. However, I am seeing below errors/warnigns. Hope that won’t have any impact. Please confirm

Opening in BLOCKING MODE

Opening in BLOCKING MODE

ArgusV4L2_Open failed: No such file or directory

Opening in BLOCKING MODE

192.168.0.102 - - [15/Sep/2021 11:04:10] “GET /start/asd123456 HTTP/1.1” 200 -

NvMMLiteOpen : Block : BlockType = 4

===== NVMEDIA: NVENC =====

NvMMLiteBlockCreate : Block : BlockType = 4

H264: Profile = 66, Level = 0

NVMEDIA_ENC: bBlitMode is set to TRUE

message <Gst.Message object at 0x7fa1f4cc48 (GstMessage at 0x7f9c325930)>

Switch to NULL state

after null state

Hi,
We don’t see the error on Jetson Nano + Logitech BRIO 4K usbcam:

nvidia@nano:~$ gst-launch-1.0 -e v4l2src device=/dev/video0 ! "video/x-raw, format=(string)YUY2, width=(int)1280, height=(int)720" ! nvvidconv ! "video/x-raw(memory:NVMM), format=(string)I420" ! nvv4l2h264enc bitrate=6000000 control-rate=1 vbv-size=750000 ! h264parse ! matroskamux ! queue ! filesink location=2.mkv
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
H264: Profile = 66, Level = 0
NVMEDIA_ENC: bBlitMode is set to TRUE
^Chandling interrupt.
Interrupt: Stopping pipeline ...
EOS on shutdown enabled -- Forcing EOS on the pipeline
Waiting for EOS...
Got EOS from element "pipeline0".
EOS received - stopping pipeline...
Execution ended after 0:00:11.353317949
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

But it probably is harmless. You may confirm again if you apply to correct path:

/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so

Yes. It is applied in the same folder location mentioned. It looks to be not high severity issue and not harmful.

Thanks a lot @DaneLLL

Hi @DaneLLL,
When we started running using command multiple times, we are observing below warnings. But we dont see any issue with starting and stoping of recording.

aspect ratio with VIDIOC_CROPCAP: Unknown error -1
ArgusV4L2_Open failed: No such file or directory
Opening in BLOCKING MODE
Opening in BLOCKING MODE
10.42.0.86 - - [16/Sep/2021 21:23:42] “GET /start/3003 HTTP/1.1” 200 -
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
0:07:46.465295083 e[335m 6916e[00m 0x7f88004590 e[33;01mWARN e[00m e[00m v4l2bufferpool gstv4l2bufferpool.c:1065:gst_v4l2_buffer_pool_start:<nvv4l2h264_enc:pool:src>e[00m Uncertain or not enough buffers, enabling copy threshold
0:07:46.472213520 e[335m 6916e[00m 0x7f88004590 e[33;01mWARN e[00m e[00m v4l2bufferpool gstv4l2bufferpool.c:790:gst_v4l2_buffer_pool_start:<csi_source:pool:src>e[00m Uncertain or not enough buffers, enabling copy threshold
H264: Profile = 66, Level = 0
NVMEDIA_ENC: bBlitMode is set to TRUE
0:07:46.582223624 e[335m 6916e[00m 0x7f88004cf0 e[33;01mWARN e[00m e[00m v4l2bufferpool gstv4l2bufferpool.c:1512:gst_v4l2_buffer_pool_dqbuf:<nvv4l2h264_enc:pool:src>e[00m Driver should never set v4l2_buffer.field to ANY
0:07:46.583139197 e[335m 6916e[00m 0x7f880044f0 e[32;01mFIXME e[00m e[00m basesink gstbasesink.c:3145:gst_base_sink_default_event:e[00m stream-start event without group-id. Consider implementing group-id handling in the upstream elements
10.42.0.86 - - [16/Sep/2021 21:23:52] “GET /start/3003 HTTP/1.1” 200 -
0:07:53.180768622 e[335m 6916e[00m 0x7f88004cf0 e[33;01mWARN e[00m e[00m v4l2allocator gstv4l2allocator.c:1511:gst_v4l2_allocator_dqbuf:<nvv4l2h264_enc:pool:src:allocator>e[00m V4L2 provided buffer has bytesused 0 which is too small to include data_offset 0
10.42.0.86 - - [16/Sep/2021 21:23:57] “GET /stop HTTP/1.1” 200 -
Opening in BLOCKING MODE
0:08:17.198826217 e[335m 6916e[00m 0x7fa803c230 e[33;01mWARN e[00m e[00m v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0x7f98004b70e[00m Failed to determine interlace mode
0:08:17.198906790 e[335m 6916e[00m 0x7fa803c230 e[33;01mWARN e[00m e[00m v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0x7f98004b70e[00m Failed to determine interlace mode
0:08:17.199029238 e[335m 6916e[00m 0x7fa803c230 e[33;01mWARN e[00m e[00m v4l2 gstv4l2object.c:2375:gst_v4l2_object_add_interlace_mode:0x7f98004b70e[00m Failed to determine interlace mode
0:08:17.199122050 e[335m 6916e[00m 0x7fa803c230 e[33;01mWARN e[00m e[00m v4l2 gstv4l2object.c:4434:gst_v4l2_object_probe_caps:<nvv4l2h264_enc:src>e[00m Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
ArgusV4L2_Open failed: No such file or directory
Opening in BLOCKING MODE
Opening in BLOCKING MODE
10.42.0.86 - - [16/Sep/2021 21:24:16] “GET /start/3003 HTTP/1.1” 200 -
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
0:08:20.473386424 e[335m 6916e[00m 0x7fa8014370 e[33;01mWARN e[00m e[00m v4l2bufferpool gstv4l2bufferpool.c:1065:gst_v4l2_buffer_pool_start:<nvv4l2h264_enc:pool:src>e[00m Uncertain or not enough buffers, enabling copy threshold
0:08:20.480658299 e[335m 6916e[00m 0x7fa8014370 e[33;01mWARN e[00m e[00m v4l2bufferpool gstv4l2bufferpool.c:790:gst_v4l2_buffer_pool_start:<csi_source:pool:src>e[00m Uncertain or not enough buffers, enabling copy threshold
H264: Profile = 66, Level = 0
NVMEDIA_ENC: bBlitMode is set to TRUE
0:08:20.589600434 e[335m 6916e[00m 0x7fa8013800 e[33;01mWARN e[00m e[00m v4l2bufferpool gstv4l2bufferpool.c:1512:gst_v4l2_buffer_pool_dqbuf:<nvv4l2h264_enc:pool:src>e[00m Driver should never set v4l2_buffer.field to ANY
0:08:20.590390330 e[335m 6916e[00m 0x7fa8025000 e[32;01mFIXME e[00m e[00m basesink gstbasesink.c:3145:gst_base_sink_default_event:e[00m stream-start event without group-id. Consider implementing group-id handling in the upstream elements
10.42.0.86 - - [16/Sep/2021 21:24:28] “GET /start/3003 HTTP/1.1” 200 -
0:08:29.606830066 e[335m 6916e[00m 0x7fa8013800 e[33;01mWARN e[00m e[00m v4l2allocator gstv4l2allocator.c:1511:gst_v4l2_allocator_dqbuf:<nvv4l2h264_enc:pool:src:allocator>e[00m V4L2 provided buffer has bytesused 0 which is too small to include data_offset 0

Do you see any issue here? or these can be ignored

Hi,
These prints are harmless. You may confirm if recorded mkv files are playable. If the files are valid, it should work well.

Thanks @DaneLLL. Videos are playable and are correctly generating in terms of FPS and resolution