How to use nvv4l2camerasrc with nvcompositor

*@tegra-ubuntu:~$ gst-launch-1.0
nvcompositor name=comp
sink_0::xpos=0 sink_0::ypos=0 sink_0::width=960 sink_0::height=540
sink_1::xpos=960 sink_1::ypos=0 sink_1::width=960 sink_1::height=540
nvv4l2camerasrc device=/dev/video0 ! nvvidconv ! ‘video/x-raw(memory:NVMM)’ ! comp.sink_0
nvv4l2camerasrc device=/dev/video1 ! nvvidconv ! ‘video/x-raw(memory:NVMM)’ ! comp.sink_1
comp.src ! nvvidconv ! nvv4l2h264enc ! filesink location=test.h264
Setting pipeline to PAUSED …
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL …
Pipeline is PREROLLED …
Setting pipeline to PLAYING …
New clock: GstSystemClock
Redistribute latency…
NvMMLiteOpen : Block : BlockType = 4
===== NvVideo: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
Redistribute latency…
Caught SIGSEGV
Spinning. Please run ‘gdb gst-launch-1.0 6336’ to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^^\Quit (core dumped)

— 🤖 This is an automated AI response. I’m here to help, but please verify important details! —

To use nvv4l2camerasrc with nvcompositor, you can refer to the following pipeline:

gst-launch-1.0 nvcompositor name=comp sink_0::xpos=0 sink_0::ypos=0 sink_0::width=960 sink_0::height=540 sink_1::xpos=960 sink_1::ypos=0 sink_1::width=960 sink_1::height=540 nvv4l2camerasrc device=/dev/video0 ! nvvidconv ! video/x-raw(memory:NVMM) ! comp.sink_0 nvv4l2camerasrc device=/dev/video1 ! nvvidconv ! video/x-raw(memory:NVMM) ! comp.sink_1 comp.src ! nvvidconv ! nvv4l2h264enc ! filesink location=test.h264

This pipeline uses nvcompositor to composite two video streams from nvv4l2camerasrc and then encodes the composited stream using nvv4l2h264enc.

However, the provided context does not cover the specific error message you encountered. If you are experiencing issues with the pipeline, you may want to check the device nodes /dev/video0 and /dev/video1 to ensure they are correct and functional.

Additionally, you can try to run the pipeline with the GST_DEBUG environment variable set to a higher level (e.g., GST_DEBUG=3) to get more detailed debug output, which may help you identify the issue.

GST_DEBUG=3 gst-launch-1.0 ...

Please note that the provided context does not cover the specific error message you encountered, and you may need to refer to additional documentation or resources to resolve the issue.

— We support team will also look into your issue to have further suggestions soon. please stay tuned. —

gst-launch-1.0 nvcompositor name=comp sink_0::xpos=0 sink_0::ypos=0 sink_0::width=960 sink_0::height=540 sink_1::xpos=960 sink_1::ypos=0 sink_1::width=960 sink_1::height=540 nvv4l2camerasrc device=/dev/video0 ! nvvidconv ! “video/x-raw(memory:NVMM)” ! comp.sink_0 nvv4l2camerasrc device=/dev/video1 ! nvvidconv ! “video/x-raw(memory:NVMM)” ! comp.sink_1 comp.src ! nvvidconv ! nvv4l2h264enc ! filesink location=test.h264
Setting pipeline to PAUSED …
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL …
Pipeline is PREROLLED …
Setting pipeline to PLAYING …
New clock: GstSystemClock
Redistribute latency…
NvMMLiteOpen : Block : BlockType = 4
===== NvVideo: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
Redistribute latency…
Caught SIGSEGV
Spinning. Please run ‘gdb gst-launch-1.0 11127’ to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.

Have a try below command.

gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! \
  'video/x-raw(memory:NVMM),format=(string)UYVY,width=(int)1920,height=(int)1080,interlace-mode=progressive,framerate=(fraction)30/1' ! \
  nvvidconv ! 'video/x-raw(memory:NVMM),format=(string)NV12' ! \
  nv3dsink -e

How about below command. Do you confirm the camera capture function by v4l2-ctl? v4l2-ctl --stream-mmap

gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! \
  'video/x-raw(memory:NVMM),format=(string)UYVY,width=(int)1920,height=(int)1080,interlace-mode=progressive,framerate=(fraction)30/1' ! \
  queue ! nvvidconv ! 'video/x-raw(memory:NVMM),format=(string)NV12' ! \
  queue ! nv3dsink processing-deadline=0 -e

use v4l2src is ok,use your command is black……,i not hdmi show , use x11

gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! ‘video/x-raw(memory:NVMM),format=(string)UYVY,width=(int)1920,height=(int)1536,interlace-mode=progressive,framerate=(fraction)30/1’ ! queue ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=(string)NV12’ ! queue ! nvv4l2h264enc ! filesink location=1.h264

Could someone please help me solve this problem?

Check this document to try.

Hello @Towe_Roll ,

Have you tried forcing explicit RGBA caps around nvcompositor and then converting the composed output to NV12 before nvv4l2h264enc?

Since the single-camera encode pipeline works, the issue seems to be related to the nvcompositor path, especially the caps/format negotiated between the compositor and the encoder.

As a first step, it would be useful to test one camera through the compositor:

gst-launch-1.0 -e \
  nvcompositor name=comp \
    sink_0::xpos=0 sink_0::ypos=0 sink_0::width=960 sink_0::height=540 \
  nvv4l2camerasrc device=/dev/video0 ! \
    'video/x-raw(memory:NVMM),format=UYVY,width=1920,height=1536,interlace-mode=progressive,framerate=30/1' ! \
    queue ! nvvidconv ! \
    'video/x-raw(memory:NVMM),format=RGBA,width=960,height=540' ! \
    queue ! comp.sink_0 \
  comp.src ! \
    'video/x-raw(memory:NVMM),format=RGBA,width=960,height=540' ! \
    queue ! nvvidconv ! \
    'video/x-raw(memory:NVMM),format=NV12' ! \
    queue ! nvv4l2h264enc ! h264parse ! \
    filesink location=test.h264

If this case works, then the next step would be to add the second camera and verify whether the issue is specific to the live multi-input compositor case.

It would also be useful to confirm the supported compositor caps with:

gst-inspect-1.0 nvcompositor

Please let me know if this helps!
Julian Camacho
Embedded SW Engineer at RidgeRun

Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

gst-launch-1.0 -e \

nvcompositor name=comp \

sink_0::xpos=0 sink_0::ypos=0 sink_0::width=1920 sink_0::height=1536 \

sink_1::xpos=1920 sink_1::ypos=0 sink_1::width=1920 sink_1::height=1536 \

nvv4l2camerasrc device=/dev/video0 ! \

‘video/x-raw(memory:NVMM),format=UYVY,width=1920,height=1536,interlace-mode=progressive,framerate=30/1’ ! \

queue ! nvvidconv ! \

‘video/x-raw(memory:NVMM),format=RGBA,width=1920,height=1536’ ! \

queue ! comp.sink_0 \

nvv4l2camerasrc device=/dev/video1 ! \

‘video/x-raw(memory:NVMM),format=UYVY,width=1920,height=1536,interlace-mode=progressive,framerate=30/1’ ! \

queue ! nvvidconv ! \

‘video/x-raw(memory:NVMM),format=RGBA,width=1920,height=1536’ ! \

queue ! comp.sink_1 comp.src ! \

‘video/x-raw(memory:NVMM),format=RGBA,width=3840,height=1536’ ! \

queue ! nvvidconv ! \

‘video/x-raw(memory:NVMM),format=NV12’ ! \

queue ! nvv4l2h264enc ! h264parse ! \

filesink location=test.h264

good, thank you