Record 2 video streams while capturing snapshots at a given interval

Hi
I am using the below pipeline to record and preview 2 1080p streams. I need to include a method to capture images at a given interval (3s) in this pipeline from the 2 sources.

gst-launch-1.0 -e v4l2src device=/dev/video0 ! tee name=t1 t1. ! queue ! video/x-raw, width=1920,height=1080, framerate=60/1 ! videorate ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! queue ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mux. alsasrc device=“hw:2,0” ! tee name=a1 ! queue ! audio/x-raw ! queue ! audioresample ! “audio/x-raw,rate=44100” ! queue ! voaacenc ! queue ! mp4mux name=mux ! filesink location=eed1mp1080HWNA.mp4 v4l2src device=/dev/video1 io-mode=2 do-timestamp=true ! tee name=t2 t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! videorate ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,width=1920,height=1080,framerate=30/1 ! nvvidconv ! queue ! “video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12” ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mp4mux ! filesink location=eed2mp1080HWNA.mp4 videotestsrc pattern=black ! video/x-raw,width=320,height=240 ! nvvidconv ! queue ! comp.sink_0 t1. ! queue ! video/x-raw, width=1920,height=1080, framerate=60/1 ! videorate ! video/x-raw, width=1920,height=1080, framerate=30/1 ! nvvidconv ! queue ! “video/x-raw(memory:NVMM),width=960,height=540,format=NV12” ! queue ! comp.sink_1 t2. ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,framerate=30/1 ! nvvidconv ! queue ! “video/x-raw(memory:NVMM),width=960,height=540,format=NV12” ! queue ! comp.sink_2 nvcompositor name=comp sink_0::width=1920 sink_0::height=1080 sink_1::xpos=0 sink_1::ypos=270 sink_1::width=960 sink_1::height=540 sink_2::xpos=960 sink_2::ypos=270 sink_2::width=960 sink_2::height=540 ! nvvidconv ! nvoverlaysink display-id=1 a1. ! queue ! audio/x-raw ! queue ! audioconvert ! alsasink device=“hw:0,3”

Thanks in advanced

Hi,
It may not be supported in running gst-launch-1.0 command. Would need other experienced users to provide suggestion.

For running a C sample, it looks possible by using appsink. Please take a look at this sample:
Starvation (?) of gstreamer threads - #12 by DaneLLL

Hi @DaneLLL ,

I found the below pipeline to stream, record, preview. But the capture only works for a single stream

gst-launch-1.0 -e v4l2src device=/dev/video2 ! queue ! video/x-raw, width=1920, height=1080, framerate=30/1 ! videorate ! video/x-raw, width=1920, height=1080, framerate=30/1 ! tee name=t1 ! nvvidconv ! queue ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mux. alsasrc device=“hw:4,0” ! queue ! audio/x-raw ! queue ! audioresample ! “audio/x-raw,rate=48000” ! tee name=a1 ! queue ! voaacenc ! queue ! mp4mux name=mux ! filesink location=file1.mp4 v4l2src device=/dev/video1 io-mode=2 ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! videorate ! image/jpeg,width=1920,height=1080,framerate=30/1 ! tee name=t2 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! queue ! “video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12” ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mux2. alsasrc device=“hw:3,0” ! queue ! audio/x-raw ! queue ! audioresample ! “audio/x-raw,rate=48000” ! tee name=a2 ! queue ! voaacenc ! queue ! mp4mux name=mux2 ! filesink location=file2.mp4 videotestsrc pattern=black ! video/x-raw,width=320,height=240 ! nvvidconv ! queue ! comp.sink_0 t1. ! queue ! nvvidconv ! queue ! “video/x-raw(memory:NVMM),width=960,height=540,format=NV12” ! queue ! comp.sink_1 t2. ! nvv4l2decoder mjpeg=1 ! nvvidconv ! queue ! “video/x-raw(memory:NVMM),width=960,height=540,format=NV12” ! queue ! comp.sink_2 nvcompositor name=comp sink_0::width=1920 sink_0::height=1080 sink_1::xpos=0 sink_1::ypos=270 sink_1::width=960 sink_1::height=540 sink_2::xpos=960 sink_2::ypos=270 sink_2::width=960 sink_2::height=540 ! tee name=t3 ! queue ! nvvidconv ! queue ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mux3. audiomixer name=mixer ! voaacenc ! queue ! mux3. a1. ! queue ! mixer.sink_0 a2. ! queue ! mixer.sink_1 flvmux name=mux3 ! rtmpsink location=“rtmp://localhost/live” t3. ! nvvidconv ! nvoverlaysink display-id=1 audiomixer name=mix ! queue ! audioconvert ! alsasink device=“hw:0,3” a1. ! queue ! mix.sink_0 a2. ! queue ! mix.sink_1 t1. ! videorate ! video/x-raw, width=1920, height=1080, framerate=1/1 ! jpegenc ! multifilesink location=p1.jpg t2. ! videorate ! image/jpeg,width=1920,height=1080,framerate=1/1 ! multifilesink location=p2.jpg

But the below pipeline works fine and capture images

gst-launch-1.0 -e v4l2src device=/dev/video1 io-mode=2 ! queue ! image/jpeg,width=1920,height=1080,framerate=30/1 ! videorate ! image/jpeg,width=1920,height=1080,framerate=30/1 ! videorate ! image/jpeg,width=1920,height=1080,framerate=1/1 ! multifilesink location=p2.jpg

Other video source in Italic works fine an captures images.

What is the method to solve this?

Thank You

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.