Simultaneous camera capture and file saving

Hi,

I have been using this pipeline to display an image stream from the onboard camera with no trouble:

gst-launch-1.0 nvcamerasrc fpsRange=“30.0 30.0” ! ‘video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1’ ! nvtee ! nvvidconv flip-method=2 ! ‘video/x-raw(memory:NVMM), format=(string)I420’ ! nvoverlaysink -e

and this stream for saving the stream to a file:

gst-launch-1.0 nvcamerasrc fpsRange=“30.0 30.0” ! ‘video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1’ ! nvtee ! nvvidconv flip-method=2 ! ‘video/x-raw(memory:NVMM), format=(string)I420’ ! omxh264enc ! ‘video/x-h264,
stream-format=(string)byte-stream’ ! h264parse ! qtmux ! filesink location=test.mp4 -e

Both work as expected. But when I try to combine them I get an empty file and the stream is stuck. I have tried several variations of this pipeline with no success. This is the pipeline I tried to use:

gst-launch-1.0 nvcamerasrc fpsRange=“30.0 30.0” ! ‘video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1’ ! nvtee name=‘t’ ! queue ! nvvidconv flip-method=2 ! ‘video/x-raw(memory:NVMM), format=(string)I420’ ! nvoverlaysink t. ! queue ! omxh264enc ! ‘video/x-h264,
stream-format=(string)byte-stream’ ! h264parse ! qtmux ! filesink location=test.mp4 -e

Any ideas why this does not work. Thanks in advance.

Hi piperak,

Use “tee” instead of “nvtee”. nvtee requires some signals to be emitted which is not possible with gst-launch.

Thanks
Shaunak

Is there any documentation on the nvtee gstreamer element available?

Are there any performance benefits of using nvtee vs tee?

Does it require to be used w/ nvcamerasrc? Or can it work after a nvvidconv?

inspecting it i see the signals (start-capture, etc), but still am curious about more information on nvtee.

I currently am using ‘tee’ which works fine for 2 streams, but trying to get more than 2 reduces the framerate since tee is a software implementation and am wondering if nvtee would provide any performance benefits.

Thanks!

Hello,
“nvtee” was specifically developed for the nvgstcapture type of use cases. It can only be used in a gstreamer application and not in a gst-launch pipeline,

“tee” does not add any overhead (even if it is a software implementation). There will be no performance benefit of “nvtee” over “tee”.

For the performance issue, would you please provide the detailed pipeline you are using, and point out what KPI expected?

br
ChenJian

I can’t get tee to work with nvoverlaysink. Is there some magic required?

gst-launch-1.0 -v -e \
   nvcamerasrc 'fpsRange='

Removing the queue element from line 5 results in a different WARNING:


WARNING: erroneous pipeline: could not link t to nvoverlaysink-nvoverlaysink0

'1.0' '120.0'

Removing the queue element from line 5 results in a different WARNING:


WARNING: erroneous pipeline: could not link t to nvoverlaysink-nvoverlaysink0

'' auto-exposure=1 exposure-time=0.0006 sensor-id=0 wbmode=5 scene-mode=12 \
   '!' 'video/x-raw(memory:NVMM),' 'width=(int)1920,height=(int)1080,' 'format=(string)I420,framerate=(fraction)60/1' \
   '!' omxh264enc '!' 'video/x-h264,stream-format=(string)avc,' 'width=(int)1920,height=(int)1080,' 'framerate=(fraction)60/1' 
   '!' tee name=t '!' queue '!' nvoverlaysink t. \
   '!' h264parse '!' queue \
   '!' mux. alsasrc device=plughw:CARD=Mic do-timestamp=true '!' audio/x-raw,rate=44100 \
   '!' volume volume=4 '!' queue '!' voaacenc '!' aacparse '!' audio/mpeg,mpegversion=4,stream-format=raw '!' queue \
   '!' flvmux streamable=true name=mux '!' queue 
   '!' rtmpsink location=rtmp://a.rtmp.youtube.com/live2/escy-rt48-kch1-3dby
WARNING: erroneous pipeline: could not link queue0 to nvoverlaysink-nvoverlaysink0

Removing the queue element from line 5 results in a different WARNING:

WARNING: erroneous pipeline: could not link t to nvoverlaysink-nvoverlaysink0

Hi sperok, please try nvtee

So is the answer “no there isn’t any more information on the nvtee element”?

You can see examples in user guide
https://developer.nvidia.com/embedded/dlc/l4t-accelerated-gstreamer-guide-28-1

And sample code in nvgstcapture-1.0 at
https://developer.nvidia.com/embedded/dlc/l4t-sources-28-1

Hi Danell,

I’m currently on Jetson TX2.

I managed to record CSI camera video to filesink :

gst-launch-1.0 nvcamerasrc fpsRange="30.0 30.0" sensor-id=0 aeLock=true intent=3 ! 'video/x-raw(memory:NVMM),width=1920,height=1080,format=I420,framerate=30/1' ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM),format=I420,width=1920,height=1080,framerate=30/1' ! omxh264enc ! 'video/x-h264,stream-format=byte-stream' ! h264parse ! matroskamux ! filesink location=ch264.mp4

And seperately, I managed to send the video stream using udpsink :

gst-launch-1.0 nvcamerasrc fpsRange="30.0 30.0" sensor-id=0 aeLock=true intent=3 ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM),width=800,height=600,format=I420,framerate=30/1' ! omxh264enc ! 'video/x-h264,stream-format=byte-stream' ! h264parse ! rtph264pay pt=96 ! udpsink host=192.168.x.x port=5000 sync=false async=false

But, I didn’t managed to combine both even using tee :

gst-launch-1.0 nvcamerasrc fpsRange='30.0 30.0' sensor-id=0 aeLock=true intent=3 ! <b>tee name=t t.</b> ! \
'video/x-raw(memory:NVMM),width=1920,height=1080,format=I420,framerate=30/1' ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM),format=I420,width=1920,height=1080,framerate=30/1' ! omxh264enc ! 'video/x-h264,stream-format=byte-stream' ! h264parse ! matroskamux ! filesink location=ch264.mp4 <b>t.</b> ! \
'video/x-raw(memory:NVMM),width=800,height=600,format=I420,framerate=30/1' ! omxh264enc ! 'video/x-h264,stream-format=byte-stream' ! h264parse ! rtph264pay pt=96 ! udpsink host=192.168.x.x port=7001

I need the caps to resize the video image size before sending it to the client. S, I prefer not to take it out from the pipeline.

Do you know how to make this combination of two pipeline works?

Thanks you in advance !

Hi akmalhisyam36,
Please refer to https://devtalk.nvidia.com/default/topic/1024927/jetson-tx1/gstreamer-quot-tee-quot-plugin-for-tx1/post/5213579/#5213579

Thanks a lot Danelll!