Jetson Nano USB camera error

Hi

I am running the below pipeline to capture while previewing a USB 1080p source and a USB logitec camera source. Below I have shown the pipeline and the error encountered.

gst-launch-1.0 -e mp4mux name=mux ! filesink location=feed1mp1080HW.mp4 v4l2src device=/dev/video1 ! tee name=t1 t1. ! queue ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mux.video_0 audiomixer name=mixer ! audioconvert ! voaacenc ! aacparse ! mux.audio_0 pulsesrc device="alsa_input.usb-VXIS_Inc_ezcap_U3_capture-02.analog-stereo" ! queue ! audio/x-raw,width=16,depth=16,rate=44100,channel=1 ! queue ! mixer.sink_0 pulsesrc device="alsa_input.usb-C-Media_Electronics_Inc._USB_Advanced_Audio_Device-00.analog-stereo" ! queue ! audio/x-raw,width=16,depth=16,rate=44100,channel=1 ! queue ! mixer.sink_1 t1. ! queue ! video/x-raw, width=1920, height=1080, framerate=30/1 !  nvvidconv ! queue ! "video/x-raw(memory:NVMM),width=503,height=250,framerate=30/1,format=NV12" ! queue ! nvoverlaysink overlay-x=0 overlay-y=50 overlay-w=503 overlay-h=250 overlay=1 v4l2src device=/dev/video0 io-mode=2 do-timestamp=true ! tee name=t2 t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvjpegdec ! video/x-raw,width=1920,height=1080,framerate=30/1 !  nvvidconv ! queue ! 'video/x-raw(memory:NVMM),framerate=30/1,format=NV12' ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mp4mux ! filesink location=feed2mp1080HW.mp4 t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvjpegdec ! queue ! video/x-raw,framerate=30/1 ! nvvidconv ! queue ! 'video/x-raw(memory:NVMM),framerate=30/1,format=NV12' ! queue ! nvoverlaysink overlay-x=504 overlay-y=50 overlay-w=504 overlay-h=250 overlay=2

Setting pipeline to PAUSED …
Opening in BLOCKING MODE
Opening in BLOCKING MODE
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL …
Redistribute latency…
Setting pipeline to PLAYING …
New clock: GstPulseSrcClock
Redistribute latency…
Redistribute latency…
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
H264: Profile = 100, Level = 0

** (gst-launch-1.0:14288): CRITICAL **: 16:47:39.161: gst_adapter_push: assertion ‘GST_IS_BUFFER (buf)’ failed

** (gst-launch-1.0:14288): CRITICAL **: 16:47:39.161: gst_adapter_push: assertion ‘GST_IS_BUFFER (buf)’ failed
Caught SIGSEGV
Segmentation fault (core dumped)

This error always appear in the first attempt of pipeline call. After that in other calls the error is not consistent sometimes the pipeline works fine and sometimes the error appear.

What can be the issue for this?

Thanks in advance

Hi,
Please break down the pipeline to video only and check if it works. And you may try qtmux instead of mp4mux.

Hi @DaneLLL,

I tried using the qtmux and removing audio and also tried the pipeline only with the camera as below still I get the error.

gst-launch-1.0 -e v4l2src device=/dev/video0 io-mode=2 do-timestamp=true ! tee name=t2 t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvjpegdec ! video/x-raw,width=1920,height=1080,framerate=30/1 !  nvvidconv ! queue ! 'video/x-raw(memory:NVMM),framerate=30/1,format=NV12' ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mp4mux ! filesink location=feed2mp1080HW.mp4 t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvjpegdec ! queue ! video/x-raw,framerate=30/1 ! nvvidconv ! queue ! 'video/x-raw(memory:NVMM),framerate=30/1,format=NV12' ! queue ! nvoverlaysink overlay-x=0 overlay-y=270 overlay-w=960 overlay-h=540 overlay=1

Hi,
Please try the pipeline:

gst-launch-1.0 -e v4l2src device=/dev/video0 io-mode=2 do-timestamp=true ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvv4l2decoder mjpeg=1 ! tee name=t2 t2. ! queue ! nvoverlaysink

And check if you can see video preview.

Thank you for the reply.

Now the pipeline is starting without errors and the encoding with preview is a happening but the preview and the encoded video is distorted the colors are not properly captured, the feed is distorted. Even if I run the preview pipeline you mentioned same thing happens

Hi,
Please check
Jetson/L4T/r32.4.x patches - eLinux.org
[GSTREAMER]Prebuilt lib for decoding YUV422 MJPEG through nvv4l2decoder

The prebuilt lib is in

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

Please replace it and try again.

Thank you very much for the help. The pipeline is now working properly.

There is a small issue the Frame-Rate (FPS) of the camera encoded file is 15 FPS even though in the pipeline I have stated to get 30 FPS

Hi,
You can run with fpsdisplaysink to check if the source outputs in 30fps:

gst-launch-1.0 -v v4l2src device=/dev/video0 io-mode=2 do-timestamp=true ! image/jpeg,width=1920,height=1080,framerate=30/1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink

Hi @DaneLLL

Thank you very much for the help. I tried the above command to check the FPS. It seems to be the camera fps starts to reduce with time. I was able to fix it using the below method. adding “videorate” element

gst-launch-1.0 -v v4l2src device=/dev/video0 io-mode=2 do-timestamp=true ! image/jpeg,width=1920,height=1080,framerate=30/1 ! videorate ! image/jpeg,width=1920,height=1080,framerate=30/1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink 

The logitech cam I am currently using is c930e.

Will this solution also work with logitech c920 camera?

Thank You

Hi,
It should work if C920 has the mode listed:

        Type        : Video Capture
        Pixel Format: 'MJPG' (compressed)
        Name        : Motion-JPEG
                Size: Discrete 1920x1080
                        Interval: Discrete 0.033s (30.000 fps)
1 Like