Skip to content

Instantly share code, notes, and snippets.

@codetricity
Last active October 23, 2020 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codetricity/1ee8428937c821376e89b7df46b85981 to your computer and use it in GitHub Desktop.
Save codetricity/1ee8428937c821376e89b7df46b85981 to your computer and use it in GitHub Desktop.
working gstreamer examples on NVIDIA Jetson Nano

play logitech c920 webcam with mpeg

gst-launch-1.0 v4l2src device=/dev/video1 io-mode=2 ! image/jpeg,width=1280,height=720,framerate=30/1 ! nvjpegdec ! video/x-raw ! xvimagesink

Play video YUY2

gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12' ! nvoverlaysink

rtsp

https://gstreamer.freedesktop.org/src/gst-rtsp-server/ gst-rtsp-server-1.14.5

serve on Jetson Nano

./test-launch "videotestsrc ! nvvidconv ! nvv4l2h264enc ! h264parse ! rtph264pay name=pay0 pt=96"

play rtsp on Jetson Nano

gst-launch-1.0 uridecodebin uri=rtsp://127.0.0.1:8554/test ! nvoverlaysink

tested with

  • videotestsrc
  • nvarguscamerasrc (Raspberry Pi camera)

rtsp server with raspberry pi camera

./test-launch "nvarguscamerasrc ! nvvidconv ! nvv4l2h264enc ! h264parse ! rtph264pay name=pay0 pt=96"

play rtsp from rasbperry pi camera

web cam player Raspberry Pi camera v2

gst-launch-1.0 nvarguscamerasrc ! nvoverlaysink

resources

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/accelerated_gstreamer.html

https://www.jetsonhacks.com/2014/10/28/gstreamer-network-video-stream-save-file/

x86

with Logitech C920 USB webcam

Play webcam

x-raw video

$ gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, framerate=30/1  !  xvimagesink

x-h264 video software decoder

key points

  • avdec_h264 specifies software decoding
$ gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-h264, framerate=30/1  ! avdec_h264 !  xvimagesink sync=false

video from h.264 encoded video file

key points

  • nvdec
  • glimagesink
gst-launch-1.0 filesrc location=robocop_trailer.mp4 ! qtdemux ! h264parse ! nvdec ! glimagesink sync=false

Logitech Webcam h.264 video stream and glimagesink

Approximately 250ms latency

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-h264, framerate=30/1  ! nvdec !  glimagesink sync=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment