RidgeRun / gstd-1.x

GStreamer Daemon is a GStreamer framework for controlling audio and video streaming using TCP messages. This version is based on GStreamer 1.x
https://developer.ridgerun.com/wiki/index.php?title=Gstd-1.0
GNU Lesser General Public License v2.1
169 stars 54 forks source link

RTSP camera not working with interpipe and gstd #321

Closed prabathdj closed 1 year ago

prabathdj commented 1 year ago

Hi,

I am trying to record a video stream using a usb camera source and a rtsp camera source by putting them side by side picture in picture mode in jetson nano. But the recording will not start. below are the pipelines

Scenario 1


presentation

gst-client pipeline_create p v4l2src device=/dev/video0 ! queue ! video/x-raw, width=1920, height=1080, framerate=60/1 ! videorate ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! "video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12" ! queue ! interpipesink name=psnt sync=false

cam1

gst-client pipeline_create c1 rtspsrc location=rtsp://172.16.65.30:554/stream/main latency=0 ! application/x-rtp, media=video, encoding-name=H264 ! rtph264depay ! queue ! h264parse ! queue ! nvv4l2decoder ! nvvidconv ! queue ! "video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12" ! videorate ! "video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12,framerate=30/1" ! queue ! interpipesink name=cam1 sync=false

background

gst-client pipeline_create bg videotestsrc pattern=black ! video/x-raw,width=1920,height=1080 ! interpipesink name=back sync=false

record

gst-client pipeline_create rec interpipesrc listen-to=back format=time stream-sync=restart-ts ! nvvidconv ! capsfilter caps="video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12" ! comppc.sink_0 interpipesrc listen-to=psnt format=time stream-sync=restart-ts ! nvvidconv ! capsfilter caps="video/x-raw(memory:NVMM),width=960,height=540,format=NV12" ! comppc.sink_1 interpipesrc listen-to=cam1 format=time stream-sync=restart-ts ! capsfilter caps="video/x-raw(memory:NVMM),width=960,height=540,format=NV12" ! comppc.sink_2 nvcompositor name=comppc sink_0::xpos=0 sink_0::ypos=0 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 ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! h264parse ! mpegtsmux ! filesink location="pip5050.ts" sync=false async=false

Scenario 2


But the below pipelines when using 2 usb cameras it is working below are the pipelines

presentation

gst-client pipeline_create p v4l2src device=/dev/video0 ! queue ! video/x-raw, width=1920, height=1080, framerate=60/1 ! videorate ! video/x-raw, width=1920, height=1080, framerate=30/1 ! nvvidconv ! "video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12" ! queue ! interpipesink name=psnt sync=false

usbcam1

gst-client pipeline_create u 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 ! jpegparse ! nvv4l2decoder mjpeg=1 ! nvvidconv ! queue ! capsfilter caps="video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12" ! queue ! interpipesink name=usbcam sync=false

background

gst-client pipeline_create bg videotestsrc pattern=black ! video/x-raw,width=1920,height=1080 ! interpipesink name=back sync=false

record

gst-client pipeline_create rec interpipesrc listen-to=back format=time stream-sync=restart-ts ! nvvidconv ! capsfilter caps="video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12" ! comppc.sink_0 interpipesrc listen-to=psnt format=time stream-sync=restart-ts ! nvvidconv ! capsfilter caps="video/x-raw(memory:NVMM),width=960,height=540,format=NV12" ! comppc.sink_1 interpipesrc listen-to=usbcam format=time stream-sync=restart-ts ! nvvidconv ! capsfilter caps="video/x-raw(memory:NVMM),width=960,height=540,format=NV12" ! comppc.sink_2 nvcompositor name=comppc sink_0::xpos=0 sink_0::ypos=0 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 ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! h264parse ! mpegtsmux ! filesink location="pipusb5050.ts" sync=false async=false

Scenario 3


and also when the rtsp camera is seperately recorded it is working

cam1

gst-client pipeline_create c1 rtspsrc location=rtsp://172.16.65.30:554/stream/main latency=0 ! application/x-rtp, media=video, encoding-name=H264 ! rtph264depay ! queue ! h264parse ! queue ! nvv4l2decoder ! nvvidconv ! queue ! "video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12" ! videorate ! "video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12,framerate=30/1" ! nvvidconv ! queue ! interpipesink name=cam1 sync=false

record cam1

gst-client pipeline_create c12 interpipesrc listen-to=cam1 format=time stream-sync=restart-ts ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! queue ! h264parse ! queue ! mpegtsmux ! filesink location="cam1.ts" sync=false

How to resolve this problem in Scenario 1

Thanks in advanced

prabathdj commented 1 year ago

Was able to resolve error was an element was missing in the pipeline

clogwog commented 1 year ago

please share the solution ?

prabathdj commented 1 year ago

@clogwog

nvvidconv

In this pipeline in Scenario 1 added the below element record

gst-client pipeline_create rec interpipesrc listen-to=back format=time stream-sync=restart-ts ! nvvidconv ! capsfilter caps="video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12" ! comppc.sink_0 interpipesrc listen-to=psnt format=time stream-sync=restart-ts ! nvvidconv ! capsfilter caps="video/x-raw(memory:NVMM),width=960,height=540,format=NV12" ! comppc.sink_1 interpipesrc listen-to=cam1 format=time stream-sync=restart-ts ! nvvidconv ! capsfilter caps="video/x-raw(memory:NVMM),width=960,height=540,format=NV12" ! comppc.sink_2 nvcompositor name=comppc sink_0::xpos=0 sink_0::ypos=0 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 ! nvv4l2h264enc maxperf-enable=1 bitrate=4000000 profile=4 ! h264parse ! mpegtsmux ! filesink location="pip5050.ts" sync=false async=false

clogwog commented 1 year ago

thank you !!