Jetson Nano saving two seperate video files

Hi,

I have below two pipelines working properly but separately. I need to run them together but the sources are same

gst-launch-1.0 -e v4l2src device=/dev/video1 ! queue ! ‘video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, framerate=(fraction)30/1’ ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=RGBA’ ! comp.sink_0 v4l2src device=/dev/video0 ! queue ! ‘video/x-raw, framerate=(fraction)30/1’ ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=RGBA’ ! comp.sink_1 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 ! nvvidconv ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! h264parse ! mux. pulsesrc device=“alsa_input.usb-VXIS_Inc_ezcap_U3_capture-02.analog-stereo” ! ‘audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=44100, channels=(int)2’ ! queue ! audioconvert ! voaacenc ! aacparse ! mpegtsmux name=mux ! filesink location=“pip3.ts”

gst-launch-1.0 -e v4l2src device=/dev/video1 ! queue ! ‘video/x-raw, format=(string)YUY2, width=(int)1920, height=(int)1080, framerate=(fraction)30/1’ ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=RGBA’ ! comp.sink_0 v4l2src device=/dev/video0 ! queue ! ‘video/x-raw, framerate=(fraction)30/1’ ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=RGBA’ ! comp.sink_1 nvcompositor name=comp sink_0::xpos=0 sink_0::ypos=0 sink_1::xpos=1500 sink_1::ypos=800 sink_1::width=320 sink_1::height=240 ! nvvidconv ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! h264parse ! mux. pulsesrc device=“alsa_input.usb-VXIS_Inc_ezcap_U3_capture-02.analog-stereo” ! ‘audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=44100, channels=(int)2’ ! queue ! audioconvert ! voaacenc ! aacparse ! mpegtsmux name=mux ! filesink location=“pip2.ts”

Now I need to run these two pipelines at the same time ans make 2 different files. How can I combine these using the tee element.

Or is there any other method using the nvcompositor and save 2 files separately?
One file must have the videos picture in picture
Other file must have the videos side by side

You may try using tee for forking your streams. You would add queue in front of each sub pipeline.

gst-launch-1.0 -ev videotestsrc is-live=true ! video/x-raw, format=YUY2, width=1920, height=1080, framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! tee name=cap1    videotestsrc is-live=true ! queue ! video/x-raw, framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! tee name=cap2    cap1. ! queue ! comp1.sink_0    cap2. ! queue ! comp1.sink_1    nvcompositor name=comp1 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 ! nvvidconv ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! h264parse ! mux1.    cap1. ! queue ! comp2.sink_0   cap2. ! queue ! comp2.sink_1   nvcompositor name=comp2 sink_0::xpos=0 sink_0::ypos=0 sink_1::xpos=1500 sink_1::ypos=800 sink_1::width=320 sink_1::height=240 ! nvvidconv ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! h264parse ! queue ! mux2.   audiotestsrc ! audio/x-raw, format=S16LE, layout=interleaved, rate=44100, channels=2 ! queue ! audioconvert ! voaacenc ! aacparse ! queue ! mux1.   audiotestsrc ! audio/x-raw, format=S16LE, layout=interleaved, rate=44100, channels=2 ! queue ! audioconvert ! voaacenc ! aacparse ! queue ! mux2.   mpegtsmux name=mux1 ! filesink location=test1.ts    mpegtsmux name=mux2 ! filesink location=test2.ts
1 Like

Thank you I will try this method