recording event with Xavier

With TX2 I would use :

[ Use case II-b-1: noaudio]  
$ 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' ! omxh264enc ! qtmux ! filesink location=test1.mp4 -e
[ Use case II-b-2: noaudio]   
$ gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! omxh264enc ! 'video/x-h264,stream-format=(string)byte-stream' ! filesink location="test.h264" -e

and that would record video with onboard CSI camera.
How the sequence will look like for Xavier?

With Xavier and R31, you would use nvarguscamerasrc instead of nvcamerasrc and NV12 format instead of I420, such as:

gst-launch-1.0 <b>nvarguscamerasrc</b> ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)<b>NV12</b>, framerate=(fraction)30/1' ! omxh264enc ! 'video/x-h264,stream-format=(string)byte-stream' ! filesink location="test.h264" -e

yes, thank you.
And how to add voice to it?
something like below?

! queue ! mux. alsasrc num-buffers=1000 device="hw:2,0" ! voaacenc ! queue ! qtmux name=mux !

The following should work:

gst-launch-1.0 -e nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1920, height=1080,format=NV12,framerate=30/1' ! omxh264enc ! 'video/x-h264,stream-format=byte-stream' ! h264parse ! queue ! muxer.video_0           alsasrc device="hw:2,0" ! voaacenc ! queue ! muxer.audio_0    qtmux name=muxer ! filesink

Note if you want to record a given amount of time that num-buffers for nvarguscamerasrc is frames number, while for alsasrc the unit is 10ms, so for recording 10s you would try:

gst-launch-1.0 -e nvarguscamerasrc num-buffers=300 ! 'video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12, framerate=30/1' ! omxh264enc ! 'video/x-h264,stream-format=byte-stream' ! h264parse ! queue ! muxer.video_0           alsasrc num-buffers=1000 device="hw:2,0" ! voaacenc ! queue ! muxer.audio_0    qtmux name=muxer ! filesink

Thank you Honey_Patouceul,
With your help and Xavier I will take the niche of recording of events consequently. 2 hours of recording take approximately 3GB [ 1920x1080 resulution] ov5693

upon checking it seems that maximum is width=2592,height=1944 resolution mode

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)2592, height=(int)1944, format=(string)NV12, framerate=(fraction)30/1' ! omxh264enc ! 'video/x-h264,stream-format=(string)byte-stream' ! filesink location="test.h264" -e

May be you could help with another concern?
A remote colleague who has PI asked to approach figuring out if the sequence that they are using could bring better quality with it.
It turned out that they are using :

gst-launch-1.0 -v v4l2src ! video/x-h264, framerate = 15/1, width=1280, height=800 ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host= port=900

I never used PI, before, but I managed to assemble test-launch at it with a purpose of approaching rtsp streaming with it as I done with jetsons before, but it seems a challenge to start it in a workeable way.

sudo apt-get install libgstrtspserver-1.0 libgstreamer1.0-dev
tar -xvf gst-rtsp-server-1.14.1.tar.xz
cd  gst-rtsp-server-1.14.1
cd examples
gcc test-launch.c -o test-launch $(pkg-config --cflags --libs gstreamer-1.0 gstreamer-rtsp-server-1.0)

loading kernel module

sudo rpi-update # to make sure the v4L2 drive is available.
sudo modprobe bcm2835-v4l2 # to load it and create /dev/video0

at two terminals of that one is sending and one approaches receiving
it seems that works at rpi is

raspivid -o - -t 0 -w 1280 -h 720  -fps 25 -b 1000000 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264

and that can be played from the very same device with

cvlc rtsp://

Testing the latter stream via recording it at receiver side with:

/usr/bin/vlc -vvv rtsp:// --sout=file/ts:/media/path/to/save/location/recording-$(date +"%Y%m%d%H%M%S").ts -I dummy --stop-time=480 vlc://quit

improved resolution

/usr/bin/vlc -vvv rtsp:// --sout=file/ts:/home/nvidia/recording-$(date +"%Y%m%d%H%M%S").ts -I dummy --stop-time=4800 vlc://quit

passing test screen works:

./test-launch "videotestsrc ! videoscale ! "video/x-raw,width=720,height=576,format=I420" ! rtpvrawpay name=pay0 pt=96 "
stream ready at rtsp://


gst-launch-1.0 rtspsrc latency=50 location=rtsp:// !  rtpvrawdepay ! videoconvert ! ximagesink -v


raspivid -t 0 -w 1280 -h 720 -fps 25 -g 5 -b 4000000 -vf -n -o - | gst-launch-1.0 -v fdsrc ! h264parse ! gdppay ! tcpserversink host= port=5000


./test-launch "( tcpclientsrc host= port=5000 ! gdpdepay ! rtph264pay name=pay0 pt=96 )"

seems to provide a readable output at
Will try to get the rtsp stream to integrate into deepstream xavier

May be you know to capture an single image from CSI camera at Xavier? I should have asked the question in the past, but seems that either I have forgotten how to do that or never got a response at forum.
If I want to take an image captured from a stream, what shall I do?
At TX2 there were keys that worked for recording of something while gstreamer dialog window is open as far as I remember.
As for now I have to use PrintScreen, but that obviously reduces resolution and adds border like in the attached image.
Then I am trying to apply Neural style, and I am just wondering how it would look like without borders.


stylized 2


You may try:

gst-launch-1.0 nvarguscamerasrc num-buffers=1 ! nvvidconv ! jpegenc ! filesink location=camerashot.jpg

It takes persistent practice to have in memory all these variables.

with higher resolution it will probably be:

gst-launch-1.0 nvarguscamerasrc num-buffers=1 ! 'video/x-raw(memory:NVMM), width=(int)2592, height=(int)1944' ! nvvidconv ! jpegenc ! filesink location=camerashot.jpg

Is it the best the camera can do e.g. for a portrait?