20,290
edits
mNo edit summary |
|||
Line 19: | Line 19: | ||
Recall that this board is a quad core A57 with some hardware units dedicated to encode/decode. Plugins accelerated by Hardware available: | Recall that this board is a quad core A57 with some hardware units dedicated to encode/decode. Plugins accelerated by Hardware available: | ||
< | <syntaxhighlight lang='bash'> | ||
gst-inspect-1.0 | grep omx | gst-inspect-1.0 | grep omx | ||
omx: nvoverlaysink: OpenMax Video Sink | omx: nvoverlaysink: OpenMax Video Sink | ||
Line 34: | Line 34: | ||
omx: omxh264dec: OpenMAX H.264 Video Decoder | omx: omxh264dec: OpenMAX H.264 Video Decoder | ||
omx: omxmpeg4videodec: OpenMAX MPEG4 Video Decoder | omx: omxmpeg4videodec: OpenMAX MPEG4 Video Decoder | ||
</ | </syntaxhighlight> | ||
Nvidia plugins: | Nvidia plugins: | ||
< | <syntaxhighlight lang='bash'> | ||
gst-inspect-1.0 | grep nv | gst-inspect-1.0 | grep nv | ||
omx: nvoverlaysink: OpenMax Video Sink | omx: nvoverlaysink: OpenMax Video Sink | ||
Line 52: | Line 52: | ||
nvvidconv: nvvidconv: NvVidConv Plugin | nvvidconv: nvvidconv: NvVidConv Plugin | ||
nvivafilter: nvivafilter: NvIVAFilter Plugin | nvivafilter: nvivafilter: NvIVAFilter Plugin | ||
</ | </syntaxhighlight> | ||
== Measure ARM load == | == Measure ARM load == | ||
Line 109: | Line 109: | ||
In order to test some of the videos or incoming streams produced by the pipelines below you might need VLC installed in your Jetson module, there is a known issue with VLC version 2.2 and you need to download and install VLC 2.4 or newer, in order to do it please follow these steps: | In order to test some of the videos or incoming streams produced by the pipelines below you might need VLC installed in your Jetson module, there is a known issue with VLC version 2.2 and you need to download and install VLC 2.4 or newer, in order to do it please follow these steps: | ||
< | <syntaxhighlight lang='bash'> | ||
sudo apt-get build-dep vlc && sudo apt-get install libtool build-essential | sudo apt-get build-dep vlc && sudo apt-get install libtool build-essential | ||
wget http://download.videolan.org/pub/videolan/vlc/2.2.6/vlc-2.2.6.tar.xz | wget http://download.videolan.org/pub/videolan/vlc/2.2.6/vlc-2.2.6.tar.xz | ||
Line 117: | Line 117: | ||
make | make | ||
#you can also try: make install | #you can also try: make install | ||
</ | </syntaxhighlight> | ||
It takes around 10min to build. Once you have built the new vlc, you can run this to open a plain UDP stream for instance | It takes around 10min to build. Once you have built the new vlc, you can run this to open a plain UDP stream for instance | ||
Line 133: | Line 133: | ||
This plugin was created by nvidia and it has access to the ISP that helps converting from bayer to yuv suitable for the video encoders. However, it seems that its usage is limited to the ov5693 sensor until NVIDIA releases its source code or until it adds support to v4l2 to use the ISP. | This plugin was created by nvidia and it has access to the ISP that helps converting from bayer to yuv suitable for the video encoders. However, it seems that its usage is limited to the ov5693 sensor until NVIDIA releases its source code or until it adds support to v4l2 to use the ISP. | ||
< | <syntaxhighlight lang='bash'> | ||
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' ! \ | 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' ! \ | ||
nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! fakesink silent=false -v | nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! fakesink silent=false -v | ||
</ | </syntaxhighlight> | ||
When the pipeline is launched a daemon appears on top nvcamera-daemon, one question about the daemon was posted on the [https://devtalk.nvidia.com/default/topic/926578/jetson-tx1/nvcamera-daemon/ Nvidia Embedded Computing Forum] | When the pipeline is launched a daemon appears on top nvcamera-daemon, one question about the daemon was posted on the [https://devtalk.nvidia.com/default/topic/926578/jetson-tx1/nvcamera-daemon/ Nvidia Embedded Computing Forum] | ||
Line 142: | Line 142: | ||
ARM consumption: 45.7% of one core (4 cores available 400% - this means something like 11.25% of total) | ARM consumption: 45.7% of one core (4 cores available 400% - this means something like 11.25% of total) | ||
< | <syntaxhighlight lang='bash'> | ||
RAM 1119/7853MB (lfb 1258x4MB) cpu [0%@1267,off,off,0%@1267,0%@1267,0%@1267] | RAM 1119/7853MB (lfb 1258x4MB) cpu [0%@1267,off,off,0%@1267,0%@1267,0%@1267] | ||
RAM 1119/7853MB (lfb 1258x4MB) cpu [28%@345,off,off,7%@345,3%@345,16%@345] | RAM 1119/7853MB (lfb 1258x4MB) cpu [28%@345,off,off,7%@345,3%@345,16%@345] | ||
Line 161: | Line 161: | ||
RAM 1119/7853MB (lfb 1257x4MB) cpu [14%@345,off,off,10%@345,13%@345,17%@345] | RAM 1119/7853MB (lfb 1257x4MB) cpu [14%@345,off,off,10%@345,13%@345,17%@345] | ||
RAM 1119/7853MB (lfb 1257x4MB) cpu [10%@345,off,off,12%@345,14%@345,13%@345] | RAM 1119/7853MB (lfb 1257x4MB) cpu [10%@345,off,off,12%@345,14%@345,13%@345] | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang='bash'> | ||
1574 root 20 0 9.917g 116260 37488 S 45.7 1.4 1:24.81 nvcamera-daemon | 1574 root 20 0 9.917g 116260 37488 S 45.7 1.4 1:24.81 nvcamera-daemon | ||
11085 nvidia 20 0 331488 9492 6004 S 3.3 0.1 0:06.98 gst-launch-1.0 | 11085 nvidia 20 0 331488 9492 6004 S 3.3 0.1 0:06.98 gst-launch-1.0 | ||
</ | </syntaxhighlight> | ||
The nvvidconv is required normally to convert the memory type, however, on this case it is used to flip the image. Removing the flip from the pipeline saves like 5% of ARM load. | The nvvidconv is required normally to convert the memory type, however, on this case it is used to flip the image. Removing the flip from the pipeline saves like 5% of ARM load. | ||
Line 172: | Line 172: | ||
nvcamerasrc exposes several properties to control the ISP | nvcamerasrc exposes several properties to control the ISP | ||
< | <syntaxhighlight lang='bash'> | ||
wbmode : White balance affects the color temperature of the photo | wbmode : White balance affects the color temperature of the photo | ||
flags: readable, writable | flags: readable, writable | ||
Line 343: | Line 343: | ||
Integer. Range: 0 - 360 Default: -1 | Integer. Range: 0 - 360 Default: -1 | ||
</ | </syntaxhighlight> | ||
=== v4l2src === | === v4l2src === | ||
Line 349: | Line 349: | ||
Starting on L4T R23.2 there is a /dev/video0 node to capture, however, this node will give you frames in bayer which are NOT suitable to encode because it grabs frames directly from the [https://www.ovt.com/sensors/OV5693 ov5693 camera] without using the ISP. | Starting on L4T R23.2 there is a /dev/video0 node to capture, however, this node will give you frames in bayer which are NOT suitable to encode because it grabs frames directly from the [https://www.ovt.com/sensors/OV5693 ov5693 camera] without using the ISP. | ||
< | <syntaxhighlight lang='bash'> | ||
https://devtalk.nvidia.com/default/topic/923984/ov5693-through-v4l2-interface-not-working-in-23-2/ | https://devtalk.nvidia.com/default/topic/923984/ov5693-through-v4l2-interface-not-working-in-23-2/ | ||
</ | </syntaxhighlight> | ||
It works also with the UVC driver. | It works also with the UVC driver. | ||
Line 360: | Line 360: | ||
=== nvcamerasrc === | === nvcamerasrc === | ||
< | <syntaxhighlight lang='bash'> | ||
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' ! \ | 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' ! \ | ||
nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! nvoverlaysink -e | nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! nvoverlaysink -e | ||
</ | </syntaxhighlight> | ||
ARM consumption: 46.1% of one core (4 cores available 400% - this means something like 14% of total). However, only the capture is 11.25% so the display consumes '''2.75%'''. For other camera you can find in our wiki latency numbers for [https://developer.ridgerun.com/wiki/index.php?title=Jetson_glass_to_glass_latency#Introduction glass to glass measurements] | ARM consumption: 46.1% of one core (4 cores available 400% - this means something like 14% of total). However, only the capture is 11.25% so the display consumes '''2.75%'''. For other camera you can find in our wiki latency numbers for [https://developer.ridgerun.com/wiki/index.php?title=Jetson_glass_to_glass_latency#Introduction glass to glass measurements] | ||
< | <syntaxhighlight lang='bash'> | ||
RAM 1184/7853MB (lfb 1246x4MB) cpu [2%@345,off,off,0%@345,0%@345,0%@345] | RAM 1184/7853MB (lfb 1246x4MB) cpu [2%@345,off,off,0%@345,0%@345,0%@345] | ||
Line 387: | Line 387: | ||
RAM 1194/7853MB (lfb 1246x4MB) cpu [0%@345,off,off,0%@345,2%@345,0%@345] | RAM 1194/7853MB (lfb 1246x4MB) cpu [0%@345,off,off,0%@345,2%@345,0%@345] | ||
RAM 1194/7853MB (lfb 1246x4MB) cpu [0%@345,off,off,0%@345,1%@345,0%@345] | RAM 1194/7853MB (lfb 1246x4MB) cpu [0%@345,off,off,0%@345,1%@345,0%@345] | ||
</syntaxhighlight> | |||
< | <syntaxhighlight lang='bash'> | ||
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND | PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND | ||
1574 root 20 0 9.979g 208932 44656 S 46.2 2.6 5:18.85 nvcamera-daemon | 1574 root 20 0 9.979g 208932 44656 S 46.2 2.6 5:18.85 nvcamera-daemon | ||
11507 nvidia 20 0 423932 11508 8796 S 3.6 0.1 0:00.66 gst-launch-1.0 | 11507 nvidia 20 0 423932 11508 8796 S 3.6 0.1 0:00.66 gst-launch-1.0 | ||
</ | </syntaxhighlight> | ||
== H264 encoding == | == H264 encoding == | ||
Line 402: | Line 401: | ||
ARM load: 157% but only videotestsrc consumes 100%. According to the NVIDIA forum when using videotestsrc the system is also doing memory copies to feed the encoder with NVMM memory buffers so that loads more the ARM. | ARM load: 157% but only videotestsrc consumes 100%. According to the NVIDIA forum when using videotestsrc the system is also doing memory copies to feed the encoder with NVMM memory buffers so that loads more the ARM. | ||
< | <syntaxhighlight lang='bash'> | ||
gst-launch-1.0 videotestsrc num-buffers=150 ! 'video/x-raw, format=(string)I420,width=(int)640, height=(int)480' ! omxh264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=test.h264 -e | gst-launch-1.0 videotestsrc num-buffers=150 ! 'video/x-raw, format=(string)I420,width=(int)640, height=(int)480' ! omxh264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=test.h264 -e | ||
</ | </syntaxhighlight> | ||
VLC can play the file correctly at 30fps and reports as codec: H264-MPEG-4 AVC (part 10) (h264). The fan on top of the SoC didn't turn on. | VLC can play the file correctly at 30fps and reports as codec: H264-MPEG-4 AVC (part 10) (h264). The fan on top of the SoC didn't turn on. | ||
Line 410: | Line 409: | ||
=== nvcamerasrc === | === nvcamerasrc === | ||
< | <syntaxhighlight lang='bash'> | ||
gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | ||
nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! omxh264enc bitrate=8000000 \ | nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! omxh264enc bitrate=8000000 \ | ||
! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=test.h264 -e | ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=test.h264 -e | ||
</ | </syntaxhighlight> | ||
Codecvisa reports bitrate on 7.96Mbps when variable mode is selected on the encoder. | Codecvisa reports bitrate on 7.96Mbps when variable mode is selected on the encoder. | ||
Line 420: | Line 419: | ||
ARM consumption 45.4% of one core (4 cores available 400% - this means something like 16.75% of total). However, only the capture is 11.25% so the h264 consumes '''5.5%''' | ARM consumption 45.4% of one core (4 cores available 400% - this means something like 16.75% of total). However, only the capture is 11.25% so the h264 consumes '''5.5%''' | ||
< | <syntaxhighlight lang='bash'> | ||
RAM 1279/7853MB (lfb 1237x4MB) cpu [0%@1267,off,off,0%@1267,0%@1267,0%@1267] | RAM 1279/7853MB (lfb 1237x4MB) cpu [0%@1267,off,off,0%@1267,0%@1267,0%@1267] | ||
RAM 1280/7853MB (lfb 1237x4MB) cpu [8%@345,off,off,19%@345,10%@345,12%@345] | RAM 1280/7853MB (lfb 1237x4MB) cpu [8%@345,off,off,19%@345,10%@345,12%@345] | ||
Line 439: | Line 438: | ||
RAM 1234/7853MB (lfb 1235x4MB) cpu [0%@345,off,off,1%@345,0%@345,0%@345] | RAM 1234/7853MB (lfb 1235x4MB) cpu [0%@345,off,off,1%@345,0%@345,0%@345] | ||
RAM 1234/7853MB (lfb 1235x4MB) cpu [0%@345,off,off,3%@345,0%@345,0%@345] | RAM 1234/7853MB (lfb 1235x4MB) cpu [0%@345,off,off,3%@345,0%@345,0%@345] | ||
</syntaxhighlight> | |||
< | <syntaxhighlight lang='bash'> | ||
1574 root 20 0 9.979g 214836 44684 S 45.4 2.7 7:10.27 nvcamera-daemon | 1574 root 20 0 9.979g 214836 44684 S 45.4 2.7 7:10.27 nvcamera-daemon | ||
11614 nvidia 20 0 700192 12800 9236 S 8.6 0.2 0:00.88 gst-launch-1.0 | 11614 nvidia 20 0 700192 12800 9236 S 8.6 0.2 0:00.88 gst-launch-1.0 | ||
</ | </syntaxhighlight> | ||
The encoder exposes the following parameters | The encoder exposes the following parameters | ||
< | <syntaxhighlight lang='bash'> | ||
control-rate : Bitrate control method | control-rate : Bitrate control method | ||
flags: readable, writable, changeable only in NULL or READY state | flags: readable, writable, changeable only in NULL or READY state | ||
Line 531: | Line 529: | ||
</ | </syntaxhighlight> | ||
== Dual H264 encoding == | == Dual H264 encoding == | ||
< | <syntaxhighlight lang='bash'> | ||
gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | ||
nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! tee name=streams \ | nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! tee name=streams \ | ||
streams. ! omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=testA.h264 \ | streams. ! omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=testA.h264 \ | ||
streams. ! omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=testB.h264 | streams. ! omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=testB.h264 | ||
</ | </syntaxhighlight> | ||
ARM consumption ~44.1% of one core (4 cores available 400% - this means something like 16.5% of total). However, only the capture is 11.25% so the dual h264 consumes '''5.25%''' | ARM consumption ~44.1% of one core (4 cores available 400% - this means something like 16.5% of total). However, only the capture is 11.25% so the dual h264 consumes '''5.25%''' | ||
< | <syntaxhighlight lang='bash'> | ||
RAM 1320/7853MB (lfb 1221x4MB) cpu [0%@1420,off,off,0%@1420,0%@1420,0%@1420] | RAM 1320/7853MB (lfb 1221x4MB) cpu [0%@1420,off,off,0%@1420,0%@1420,0%@1420] | ||
RAM 1320/7853MB (lfb 1221x4MB) cpu [19%@345,off,off,16%@345,10%@345,9%@345] | RAM 1320/7853MB (lfb 1221x4MB) cpu [19%@345,off,off,16%@345,10%@345,9%@345] | ||
Line 566: | Line 564: | ||
RAM 1275/7853MB (lfb 1216x4MB) cpu [0%@345,off,off,2%@345,0%@345,0%@345] | RAM 1275/7853MB (lfb 1216x4MB) cpu [0%@345,off,off,2%@345,0%@345,0%@345] | ||
RAM 1275/7853MB (lfb 1216x4MB) cpu [0%@345,off,off,1%@345,0%@345,0%@345] | RAM 1275/7853MB (lfb 1216x4MB) cpu [0%@345,off,off,1%@345,0%@345,0%@345] | ||
</syntaxhighlight> | |||
</ | |||
== H264 UDP Streaming == | == H264 UDP Streaming == | ||
server: | server: | ||
< | <syntaxhighlight lang='bash'> | ||
CLIENT_IP=<IP_ADDRESS> | CLIENT_IP=<IP_ADDRESS> | ||
gst-launch-1.0 nvcamerasrc fpsRange="30 30" intent=3 ! nvvidconv flip-method=6 \ | gst-launch-1.0 nvcamerasrc fpsRange="30 30" intent=3 ! nvvidconv flip-method=6 \ | ||
Line 578: | Line 575: | ||
omxh264enc control-rate=2 bitrate=4000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! \ | omxh264enc control-rate=2 bitrate=4000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! \ | ||
h264parse ! rtph264pay mtu=1400 ! udpsink host=$CLIENT_IP port=5000 sync=false async=false | h264parse ! rtph264pay mtu=1400 ! udpsink host=$CLIENT_IP port=5000 sync=false async=false | ||
</ | </syntaxhighlight> | ||
PC client: | PC client: | ||
< | <syntaxhighlight lang='bash'> | ||
gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue ! avdec_h264 ! xvimagesink sync=false async=false -e | gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! queue ! avdec_h264 ! xvimagesink sync=false async=false -e | ||
</ | </syntaxhighlight> | ||
Using VLC | Using VLC | ||
Line 589: | Line 586: | ||
*Server: | *Server: | ||
< | <syntaxhighlight lang='bash'> | ||
CLIENT_IP=<IP_ADDRESS> | CLIENT_IP=<IP_ADDRESS> | ||
gst-launch-1.0 nvcamerasrc fpsRange="30 30" intent=3 ! nvvidconv flip-method=6 \ | gst-launch-1.0 nvcamerasrc fpsRange="30 30" intent=3 ! nvvidconv flip-method=6 \ | ||
Line 595: | Line 592: | ||
omxh264enc control-rate=2 bitrate=4000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! \ | omxh264enc control-rate=2 bitrate=4000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! \ | ||
h264parse ! rtph264pay mtu=1400 ! udpsink host=$CLIENT_IP port=5000 sync=false async=false | h264parse ! rtph264pay mtu=1400 ! udpsink host=$CLIENT_IP port=5000 sync=false async=false | ||
</ | </syntaxhighlight> | ||
*Client: | *Client: | ||
< | <syntaxhighlight lang='bash'> | ||
vlc -vv --demux h264 --h264-fps 60 udp://@:5000 | vlc -vv --demux h264 --h264-fps 60 udp://@:5000 | ||
</ | </syntaxhighlight> | ||
=== h264 parse missing=== | === h264 parse missing=== | ||
In case gstreamer complains when running the pipeline for missing the h264parse plugin, run the following command to install it: | In case gstreamer complains when running the pipeline for missing the h264parse plugin, run the following command to install it: | ||
< | <syntaxhighlight lang='bash'> | ||
sudo apt-get install gstreamer1.0-plugins-bad | sudo apt-get install gstreamer1.0-plugins-bad | ||
</ | </syntaxhighlight> | ||
=== Latency === | === Latency === | ||
Line 620: | Line 617: | ||
ARM load: 156% but only videotestsrc consumes 100%. According to the NVIDIA forum when using videotestsrc the system is also doing memory copies to feed the encoder with NVMM memory buffers so that loads more the ARM. | ARM load: 156% but only videotestsrc consumes 100%. According to the NVIDIA forum when using videotestsrc the system is also doing memory copies to feed the encoder with NVMM memory buffers so that loads more the ARM. | ||
< | <syntaxhighlight lang='bash'> | ||
gst-launch-1.0 videotestsrc num-buffers=150 ! 'video/x-raw, format=(string)I420,width=(int)640, height=(int)480' ! omxvp8enc ! qtmux ! filesink location=test.mp4 -e | gst-launch-1.0 videotestsrc num-buffers=150 ! 'video/x-raw, format=(string)I420,width=(int)640, height=(int)480' ! omxvp8enc ! qtmux ! filesink location=test.mp4 -e | ||
</ | </syntaxhighlight> | ||
VLC can play the file correctly at 30fps and reports as codec: Google/On2's VP8 Video (VP80). The fan on top of the SoC didn't turn on. | VLC can play the file correctly at 30fps and reports as codec: Google/On2's VP8 Video (VP80). The fan on top of the SoC didn't turn on. | ||
Line 628: | Line 625: | ||
=== nvcamerasrc === | === nvcamerasrc === | ||
< | <syntaxhighlight lang='bash'> | ||
gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | ||
nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! omxvp8enc bitrate=8000000 ! qtmux ! filesink location=test.mp4 -e | nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! omxvp8enc bitrate=8000000 ! qtmux ! filesink location=test.mp4 -e | ||
</ | </syntaxhighlight> | ||
VLC reports bitrate on ~8Mbps. | VLC reports bitrate on ~8Mbps. | ||
Line 639: | Line 636: | ||
ARM consumption ~50% of one core (4 cores available 400% - this means something like 15.5% of total). However, only the capture is 11.25% so the VP8 consumes '''4.25%''' | ARM consumption ~50% of one core (4 cores available 400% - this means something like 15.5% of total). However, only the capture is 11.25% so the VP8 consumes '''4.25%''' | ||
< | <syntaxhighlight lang='bash'> | ||
RAM 1442/7853MB (lfb 1134x4MB) cpu [0%@1267,off,off,0%@1267,0%@1267,0%@1267] | RAM 1442/7853MB (lfb 1134x4MB) cpu [0%@1267,off,off,0%@1267,0%@1267,0%@1267] | ||
RAM 1442/7853MB (lfb 1134x4MB) cpu [16%@345,off,off,12%@345,15%@345,14%@345] | RAM 1442/7853MB (lfb 1134x4MB) cpu [16%@345,off,off,12%@345,15%@345,14%@345] | ||
Line 654: | Line 651: | ||
RAM 1443/7853MB (lfb 1134x4MB) cpu [14%@345,off,off,20%@345,8%@345,12%@345] | RAM 1443/7853MB (lfb 1134x4MB) cpu [14%@345,off,off,20%@345,8%@345,12%@345] | ||
RAM 1443/7853MB (lfb 1134x4MB) cpu [15%@345,off,off,21%@345,6%@345,10%@345] | RAM 1443/7853MB (lfb 1134x4MB) cpu [15%@345,off,off,21%@345,6%@345,10%@345] | ||
</syntaxhighlight> | |||
< | <syntaxhighlight lang='bash'> | ||
1574 root 20 0 9.979g 264008 44716 S 45.7 3.3 14:43.58 nvcamera-daemon | 1574 root 20 0 9.979g 264008 44716 S 45.7 3.3 14:43.58 nvcamera-daemon | ||
13065 nvidia 20 0 719944 14140 9996 S 9.2 0.2 0:09.34 gst-launch-1.0 | 13065 nvidia 20 0 719944 14140 9996 S 9.2 0.2 0:09.34 gst-launch-1.0 | ||
</ | </syntaxhighlight> | ||
The encoder exposes the following parameters | The encoder exposes the following parameters | ||
< | <syntaxhighlight lang='bash'> | ||
bitrate : Target bitrate | bitrate : Target bitrate | ||
flags: readable, writable, changeable in NULL, READY, PAUSED or PLAYING state | flags: readable, writable, changeable in NULL, READY, PAUSED or PLAYING state | ||
Line 722: | Line 718: | ||
(3): SlowPreset - SlowPreset | (3): SlowPreset - SlowPreset | ||
</ | </syntaxhighlight> | ||
== H265 encoding == | == H265 encoding == | ||
Line 730: | Line 726: | ||
In order to support h265 you need VLC 2.2 in your computer to play the videos | In order to support h265 you need VLC 2.2 in your computer to play the videos | ||
< | <syntaxhighlight lang='bash'> | ||
sudo add-apt-repository ppa:mc3man/trusty-media | sudo add-apt-repository ppa:mc3man/trusty-media | ||
sudo apt-get update | sudo apt-get update | ||
sudo apt-get install vlc vlc-plugin-* | sudo apt-get install vlc vlc-plugin-* | ||
</ | </syntaxhighlight> | ||
=== videotestsrc === | === videotestsrc === | ||
Line 740: | Line 736: | ||
ARM load: 156% but only videotestsrc consumes 100%. According to the NVIDIA forum when using videotestsrc the system is also doing memory copies to feed the encoder with NVMM memory buffers so that loads more the ARM. | ARM load: 156% but only videotestsrc consumes 100%. According to the NVIDIA forum when using videotestsrc the system is also doing memory copies to feed the encoder with NVMM memory buffers so that loads more the ARM. | ||
< | <syntaxhighlight lang='bash'> | ||
gst-launch-1.0 videotestsrc num-buffers=150 ! 'video/x-raw, format=(string)I420,width=(int)640, height=(int)480' ! omxh265enc ! filesink location=test.h265 -e | gst-launch-1.0 videotestsrc num-buffers=150 ! 'video/x-raw, format=(string)I420,width=(int)640, height=(int)480' ! omxh265enc ! filesink location=test.h265 -e | ||
</pre> | </pre> | ||
Line 748: | Line 744: | ||
=== nvcamerasrc === | === nvcamerasrc === | ||
< | <syntaxhighlight lang='bash'> | ||
gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | ||
nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! omxh265enc ! filesink location=test.h265 -e | nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! omxh265enc ! filesink location=test.h265 -e | ||
</ | </syntaxhighlight> | ||
Codecvisa reports bitrate on 7.96Mbps when variable mode is selected on the encoder. | Codecvisa reports bitrate on 7.96Mbps when variable mode is selected on the encoder. | ||
Line 757: | Line 753: | ||
ARM consumption ~55% of one core (4 cores available 400% - this means something like 13% of total). However, only the capture is 11.25% so the h264 consumes '''1.75%''' | ARM consumption ~55% of one core (4 cores available 400% - this means something like 13% of total). However, only the capture is 11.25% so the h264 consumes '''1.75%''' | ||
< | <syntaxhighlight lang='bash'> | ||
RAM 1487/7853MB (lfb 993x4MB) cpu [0%@1267,off,off,0%@1267,0%@1267,0%@1267] | RAM 1487/7853MB (lfb 993x4MB) cpu [0%@1267,off,off,0%@1267,0%@1267,0%@1267] | ||
RAM 1487/7853MB (lfb 993x4MB) cpu [12%@345,off,off,12%@345,10%@345,14%@345] | RAM 1487/7853MB (lfb 993x4MB) cpu [12%@345,off,off,12%@345,10%@345,14%@345] | ||
Line 777: | Line 773: | ||
RAM 1488/7853MB (lfb 991x4MB) cpu [8%@345,off,off,13%@345,20%@345,10%@345] | RAM 1488/7853MB (lfb 991x4MB) cpu [8%@345,off,off,13%@345,20%@345,10%@345] | ||
RAM 1488/7853MB (lfb 991x4MB) cpu [11%@345,off,off,12%@345,11%@345,21%@345] | RAM 1488/7853MB (lfb 991x4MB) cpu [11%@345,off,off,12%@345,11%@345,21%@345] | ||
</syntaxhighlight> | |||
< | <syntaxhighlight lang='bash'> | ||
1574 root 20 0 9.979g 266012 44612 S 47.7 3.3 17:54.85 nvcamera-daemon | 1574 root 20 0 9.979g 266012 44612 S 47.7 3.3 17:54.85 nvcamera-daemon | ||
13273 nvidia 20 0 694396 12920 9156 S 8.6 0.2 0:01.32 gst-launch-1.0 | 13273 nvidia 20 0 694396 12920 9156 S 8.6 0.2 0:01.32 gst-launch-1.0 | ||
</ | </syntaxhighlight> | ||
The encoder exposes the following parameters | The encoder exposes the following parameters | ||
< | <syntaxhighlight lang='bash'> | ||
control-rate : Bitrate control method | control-rate : Bitrate control method | ||
flags: readable, writable, changeable only in NULL or READY state | flags: readable, writable, changeable only in NULL or READY state | ||
Line 856: | Line 851: | ||
Unsigned Long. Range: 0 - 18446744073709551615 Default: 0 | Unsigned Long. Range: 0 - 18446744073709551615 Default: 0 | ||
</ | </syntaxhighlight> | ||
== Dual H265 encoding == | == Dual H265 encoding == | ||
< | <syntaxhighlight lang='bash'> | ||
gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | ||
nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! tee name=streams \ | nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! tee name=streams \ | ||
streams. ! omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=testA.h264 \ | streams. ! omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=testA.h264 \ | ||
streams. ! omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=testB.h264 | streams. ! omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! filesink location=testB.h264 | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang='bash'> | ||
gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | gst-launch-1.0 -e nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! \ | ||
nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! tee name=streams \ | nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! tee name=streams \ | ||
streams. ! omxh265enc bitrate=8000000 ! 'video/x-h265, stream-format=(string)byte-stream' ! filesink location=testA.h265 \ | streams. ! omxh265enc bitrate=8000000 ! 'video/x-h265, stream-format=(string)byte-stream' ! filesink location=testA.h265 \ | ||
streams. ! omxh265enc bitrate=8000000 ! 'video/x-h265, stream-format=(string)byte-stream' ! filesink location=testB.h265 | streams. ! omxh265enc bitrate=8000000 ! 'video/x-h265, stream-format=(string)byte-stream' ! filesink location=testB.h265 | ||
</ | </syntaxhighlight> | ||
ARM consumption ~48.7% of one core (4 cores available 400% - this means something like 13.5% of total). However, only the capture is 11.25% so the dual h265 consumes '''2.25%''' | ARM consumption ~48.7% of one core (4 cores available 400% - this means something like 13.5% of total). However, only the capture is 11.25% so the dual h265 consumes '''2.25%''' | ||
< | <syntaxhighlight lang='bash'> | ||
RAM 1503/7853MB (lfb 965x4MB) cpu [0%@1420,off,off,0%@1420,0%@1420,0%@1420] | RAM 1503/7853MB (lfb 965x4MB) cpu [0%@1420,off,off,0%@1420,0%@1420,0%@1420] | ||
RAM 1503/7853MB (lfb 965x4MB) cpu [19%@345,off,off,10%@345,13%@345,16%@345] | RAM 1503/7853MB (lfb 965x4MB) cpu [19%@345,off,off,10%@345,13%@345,16%@345] | ||
Line 891: | Line 886: | ||
RAM 1457/7853MB (lfb 957x4MB) cpu [14%@345,off,off,9%@345,10%@345,15%@345] | RAM 1457/7853MB (lfb 957x4MB) cpu [14%@345,off,off,9%@345,10%@345,15%@345] | ||
RAM 1456/7853MB (lfb 957x4MB) cpu [0%@345,off,off,1%@345,0%@345,0%@345] | RAM 1456/7853MB (lfb 957x4MB) cpu [0%@345,off,off,1%@345,0%@345,0%@345] | ||
</syntaxhighlight> | |||
</ | |||
== H265 UDP Streaming == | == H265 UDP Streaming == | ||
Line 900: | Line 894: | ||
Currently it is not possible to receive the stream using the PC because there is not a h265 decoder available on gstreamer. In order to evaluate the performance let's receive the stream on the Jetson module as well. | Currently it is not possible to receive the stream using the PC because there is not a h265 decoder available on gstreamer. In order to evaluate the performance let's receive the stream on the Jetson module as well. | ||
< | <syntaxhighlight lang='bash'> | ||
export PKG_CONFIG_PATH=/home/$USER/gst_$VERSION/out/lib/pkgconfig | export PKG_CONFIG_PATH=/home/$USER/gst_$VERSION/out/lib/pkgconfig | ||
VERSION=1.8.0 | VERSION=1.8.0 | ||
export LD_LIBRARY_PATH=/home/$USER/gst_$VERSION/out/lib/ | export LD_LIBRARY_PATH=/home/$USER/gst_$VERSION/out/lib/ | ||
</ | </syntaxhighlight> | ||
server: | server: | ||
< | <syntaxhighlight lang='bash'> | ||
CLIENT_IP=<IP_ADDRESS> | CLIENT_IP=<IP_ADDRESS> | ||
gst-launch-1.0 nvcamerasrc fpsRange="30 30" intent=3 ! nvvidconv flip-method=6 \ | gst-launch-1.0 nvcamerasrc fpsRange="30 30" intent=3 ! nvvidconv flip-method=6 \ | ||
Line 913: | Line 907: | ||
omxh265enc low-latency=1 control-rate=2 bitrate=4000000 ! 'video/x-h265, stream-format=(string)byte-stream' ! \ | omxh265enc low-latency=1 control-rate=2 bitrate=4000000 ! 'video/x-h265, stream-format=(string)byte-stream' ! \ | ||
h265parse ! rtph265pay mtu=1400 ! udpsink host=$CLIENT_IP port=5000 sync=false async=false | h265parse ! rtph265pay mtu=1400 ! udpsink host=$CLIENT_IP port=5000 sync=false async=false | ||
</ | </syntaxhighlight> | ||
client: | client: | ||
< | <syntaxhighlight lang='bash'> | ||
gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=H265,payload=96 ! rtph265depay \ | gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=H265,payload=96 ! rtph265depay \ | ||
! h265parse ! queue ! omxh265dec ! nvoverlaysink sync=false async=false -e | ! h265parse ! queue ! omxh265dec ! nvoverlaysink sync=false async=false -e | ||
</ | </syntaxhighlight> | ||
=== Latency === | === Latency === | ||
Line 932: | Line 926: | ||
This is an application based on gstreamer and omx to capture, encode and save video to the filesystem. It has a lot of options. The source code is not released by NVIDIA yet but they are planning to release in future versions of Linux 4 Tegra (L4T), you can read about it at [https://devtalk.nvidia.com/default/topic/898129/jetson-tx1/enabling-camera-on-jetson-tx1-board/ Nvidia Embedded Computing Forum] | This is an application based on gstreamer and omx to capture, encode and save video to the filesystem. It has a lot of options. The source code is not released by NVIDIA yet but they are planning to release in future versions of Linux 4 Tegra (L4T), you can read about it at [https://devtalk.nvidia.com/default/topic/898129/jetson-tx1/enabling-camera-on-jetson-tx1-board/ Nvidia Embedded Computing Forum] | ||
< | <syntaxhighlight lang='bash'> | ||
nvidia@tegra-ubuntu:~$ nvgstcapture-1.0 --help | nvidia@tegra-ubuntu:~$ nvgstcapture-1.0 --help | ||
Encoder null, cannot set bitrate! | Encoder null, cannot set bitrate! | ||
Line 1,275: | Line 1,269: | ||
Enter 'f' | Enter 'f' | ||
</ | </syntaxhighlight> | ||
== Capture snapshots == | == Capture snapshots == | ||
Line 1,281: | Line 1,275: | ||
Sometimes when the board has been just flashed you need to run reboot in order to run nvgstcapture-1.0 successfully. To take snapshots: | Sometimes when the board has been just flashed you need to run reboot in order to run nvgstcapture-1.0 successfully. To take snapshots: | ||
< | <syntaxhighlight lang='bash'> | ||
nvgstcapture-1.0 | nvgstcapture-1.0 | ||
#then press j to take an snapshot | #then press j to take an snapshot | ||
q | q | ||
</ | </syntaxhighlight> | ||
Resolutions available to create snapshot: | Resolutions available to create snapshot: | ||
< | <syntaxhighlight lang='bash'> | ||
(2) : 640x480 | (2) : 640x480 | ||
(3) : 1280x720 | (3) : 1280x720 | ||
Line 1,301: | Line 1,295: | ||
(12): 5632x4224 | (12): 5632x4224 | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang='bash'> | ||
nvgstcapture-1.0 -m 1 --image-res=10 #set 1 to snapshot mode | nvgstcapture-1.0 -m 1 --image-res=10 #set 1 to snapshot mode | ||
</ | </syntaxhighlight> | ||
In general the application is consuming 15% of each of four cores. It is always displaying video this could affect. | In general the application is consuming 15% of each of four cores. It is always displaying video this could affect. | ||
Line 1,311: | Line 1,305: | ||
== Capture and record video == | == Capture and record video == | ||
< | <syntaxhighlight lang='bash'> | ||
nvgstcapture-1.0 -m 2 # set the mode in video | nvgstcapture-1.0 -m 2 # set the mode in video | ||
1 # start video recording | 1 # start video recording | ||
2 # take a snapshot | 2 # take a snapshot | ||
0 # stop video recording | 0 # stop video recording | ||
</syntaxhighlight> | |||
</ | |||
In case of video it should support: | In case of video it should support: | ||
< | <syntaxhighlight lang='bash'> | ||
(2) : 640x480 | (2) : 640x480 | ||
(3) : 1280x720 | (3) : 1280x720 | ||
Line 1,329: | Line 1,322: | ||
(8) : 3840x2160 | (8) : 3840x2160 | ||
(9) : 3896x2192 | (9) : 3896x2192 | ||
</syntaxhighlight> | |||
</ | |||
However, it is not possible to set other value than 2,3,4,5 up to 9. | However, it is not possible to set other value than 2,3,4,5 up to 9. | ||
< | <syntaxhighlight lang='bash'> | ||
nvgstcapture-1.0 -m 2 --video-res=5 | nvgstcapture-1.0 -m 2 --video-res=5 | ||
</ | </syntaxhighlight> | ||
'''top''' | '''top''' | ||
< | <syntaxhighlight lang='bash'> | ||
top - 22:15:09 up 2:30, 4 users, load average: 0.47, 0.45, 0.30 | top - 22:15:09 up 2:30, 4 users, load average: 0.47, 0.45, 0.30 | ||
Line 1,351: | Line 1,343: | ||
27513 nvidia 20 0 815040 13932 10272 S 4.3 0.2 0:01.48 nvgstcapture-1. | 27513 nvidia 20 0 815040 13932 10272 S 4.3 0.2 0:01.48 nvgstcapture-1. | ||
</ | </syntaxhighlight> | ||
There is a daemon and a pipeline. Interesting... | There is a daemon and a pipeline. Interesting... |