Gstreamer get 2 4k usb cameras simultaneously and put them side by side

Hello! I have to say that there are an error with Gst for merging 4 webcams sometimes works, and sometimes it doesn't

The patch doesn’t work. There are no errors, but the filesink file is not filled.

I managed to get it to work with a change in the code:

gst-launch-1.0 nvcompositor background-w=2560  background-h=1440 name=comp sink_0::xpos=0  sink_0::ypos=0    sink_0::width=1280 sink_0::height=720 \
                       sink_1::xpos=1280 sink_1::ypos=0    sink_1::width=1280 sink_1::height=720 \
                       sink_2::xpos=0    sink_2::ypos=720 sink_2::width=1280 sink_2::height=720 \
                       sink_3::xpos=1280 sink_3::ypos=720 sink_3::width=1280 sink_3::height=720 \
! nvvidconv ! 'video/x-raw(memory:NVMM), width=2560, height=1440, framerate=60/1, format=RGBA' \
! nvvidconv ! omxh264enc control-rate=2 bitrate=20000000 ! queue ! mux. alsasrc device='hw:2,0' ! audio/x-raw,width=16,depth=16,rate=32000,channels=2 ! queue ! audioconvert ! audioresample ! voaacenc ! aacparse ! qtmux name=mux ! filesink location=/home/ances/0.mp4  -e \
v4l2src device=/dev/video0 ! image/jpeg,format=MJPG,width=1280,height=720,framerate=60/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! comp.sink_0 \
v4l2src device=/dev/video1 ! image/jpeg,format=MJPG,width=1280,height=720,framerate=60/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! comp.sink_1 \
v4l2src device=/dev/video2 ! image/jpeg,format=MJPG,width=1280,height=720,framerate=60/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! comp.sink_2 \
v4l2src device=/dev/video3 ! image/jpeg,format=MJPG,width=1280,height=720,framerate=60/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! comp.sink_3

The part that says that is important:

'video/x-raw(memory:NVMM), width=2560, height=1440, framerate=60/1, format=RGBA' 

The intermittent bug happend if you use this:

'...format=NV12'

I wish I could correct it in the original post.

1 Like