NVIDIA Jetson Xavier - H264 encoding, decoding, and streaming pipelines

From RidgeRun Developer Connection
Jump to: navigation, search



Previous: GStreamer Pipelines/Capture and Display Index Next: GStreamer Pipelines/H265



Nvidia-preferred-partner-badge-rgb-for-screen.png




H264 encoding

gst-OMX

FILE=filename.mp4
gst-launch-1.0 -e nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' \
! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420' ! omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' \
! h264parse ! qtmux ! filesink location=$FILE -e

Performance:

Operation Mode CPU% GPU% FPS
0 (max performance) 0.0 0.18 30.01
1 (min power) 0.57 66.38 30.02
2 (default) 2.27 0.76 30.01

The omxh264enc element allows for change between profiles by using the profile property, the posible values are baseline, high and main.

gst-V4L2

FILE=filename.mp4
gst-launch-1.0 -e nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' \ 
! nvv4l2h264enc bitrate=8000000 ! h264parse ! qtmux ! filesink location=$FILE -e

Dual H264 encoding

gst-OMX

FILE_A=filenameA.mp4
FILE_B=filenameB.mp4
gst-launch-1.0 -e nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' \
! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420' ! tee name=streams \
streams. ! omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! qtmux ! filesink location=$FILE_A \
streams. ! omxh264enc bitrate=8000000 ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! qtmux ! filesink location=$FILE_B

gst-V4L2

FILE_A=filenameA.mp4
FILE_B=filenameB.mp4
gst-launch-1.0 -e nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' ! tee name=streams \
streams. ! nvv4l2h264enc bitrate=8000000 ! h264parse ! qtmux ! filesink location=$FILE_A \
streams. ! nvv4l2h264enc bitrate=8000000 ! h264parse ! qtmux ! filesink location=$FILE_B

H264 decoding

gst-OMX

FILE=filename.mp4
gst-launch-1.0 filesrc location=$FILE ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec ! nvoverlaysink -e

Performance:

Operation Mode CPU% GPU% FPS
0 (max performance) 0.43 0.72 30.02
1 (min power) 0 0 0
2 (default) 0.0 34.06 30.02

gst-V4L2

FILE=filename.mp4
gst-launch-1.0 filesrc location=$FILE ! qtdemux ! queue ! h264parse ! nvv4l2decoder ! nv3dsink -e

H264 UDP Streaming

Server

gst-OMX

CLIENT_IP=<IP_ADDRESS>
gst-launch-1.0 -e nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' \
! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420' ! 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

gst-V4L2

CLIENT_IP=<IP_ADDRESS>
gst-launch-1.0 -e nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' \
! nvv4l2h264enc bitrate=8000000 ! h264parse ! rtph264pay mtu=1400 ! udpsink host=$CLIENT_IP port=5000 sync=false async=false

PC client

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

Latency OMX

  • 1080p@30fps
  • H264
  • Bitrate 4Mbps
  • Latency=216ms



Previous: GStreamer Pipelines/Capture and Display Index Next: GStreamer Pipelines/H265