tips:gstreamer

gstream jetson

orin native

URL=rtsp://192.168.1.1:7447/IFnqNlmdfTQxDOWV
#URL=rtsp://192.168.2.35:7447/60e1a6425a20203019f719aa_1
gst-launch-1.0 rtspsrc location=$URL protocols=tcp latency=0 ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvideoconvert ! autovideosink

deepstream amd64

URL=rtsp://192.168.2.35:7447/60e1a6425a20203019f719aa_1

nvv4l2h264enc

gst-launch-1.0 videotestsrc is-live=1 ! nvvidconv ! nvv4l2h264enc ! h264parse ! matroskamux ! filesink location=/tmp/out.mkv

gstreamer

debug

mkdir ./tmp
export GST_DEBUG_DUMP_DOT_DIR=./tmp/

# ... run pipeline

cd tmp
dot -Tpng x.xx.xx.xxxxxxxxx-gst-launch.FOO.dot > graph.png

show usb camera

gst-launch-1.0 v4l2src device=/dev/video0 ! xvimagesink

rtsp client

gst-launch-1.0 \
  rtspsrc location=rtsp://foscam:foscam1@192.168.2.14:554/videoMain ! rtph264depay \
  ! h264parse ! avdec_h264 \
  ! videoconvert ! xvimagesink

rtsp save stream to test.mkv without h264 decoding

gst-launch-1.0 -e rtspsrc location=rtsp://flex/s0 protocols=tcp \
 ! rtph264depay ! h264parse ! matroskamux ! filesink location=test.mkv

hardware decode

F=videos/traffico01-1152x720-1610kb.mkv
gst-launch-1.0 filesrc location=$F ! matroskademux ! queue ! h264parse ! omxh264dec ! autovideoconvert ! xvimagesink

hardware encode

...  ! videoconvert ! omxh264enc ! matroskamux ! filesink location=test.mkv

inspect pipeline properties

... ! fakesink -v | grep fake

oCam-1CGN-U

identify

v4l2-ctl --list-devices

v4l2-ctl --list-formats-ext -d /dev/video0                                                                                               
ioctl: VIDIOC_ENUM_FMT
	Type: Video Capture

	[0]: 'GRBG' (8-bit Bayer GRGR/BGBG)
		Size: Discrete 1280x960
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.040s (25.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 1280x720
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.040s (25.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 640x480
			Interval: Discrete 0.010s (100.000 fps)
			Interval: Discrete 0.011s (90.000 fps)
			Interval: Discrete 0.017s (60.000 fps)
			Interval: Discrete 0.020s (50.000 fps)
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.040s (25.000 fps)
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 320x240
			Interval: Discrete 0.006s (180.000 fps)
			Interval: Discrete 0.007s (150.000 fps)
			Interval: Discrete 0.008s (120.000 fps)
			Interval: Discrete 0.010s (100.000 fps)
			Interval: Discrete 0.017s (60.000 fps)
			Interval: Discrete 0.020s (50.000 fps)
v4l2-ctl -d /dev/video0 --list-ctrls                                                            
    white_balance_red_component 0x0098090e (int)    : min=0 max=250 step=1 default=100 value=100
   white_balance_blue_component 0x0098090f (int)    : min=0 max=250 step=1 default=100 value=100
                           gain 0x00980913 (int)    : min=0 max=255 step=1 default=64 value=64
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=1 value=1
              exposure_absolute 0x009a0902 (int)    : min=1 max=1000 step=1 default=55 value=128
ffplay -f video4linux2 -s 640x480 -i /dev/video0

Stream #0:0: Video: rawvideo ([186]GR[8] / 0x85247BA), bayer_grbg8, 640x480, 245760 kb/s, 100 fps, 100 tbr, 1000k tbn, 1000k tbc
gst-launch-1.0 -v v4l2src device=/dev/video0 ! 'video/x-bayer,format=grbg,width=640,height=480,framerate=100/1,colorimetry=bt601' ! bayer2rgb ! videoconvert ! xvimagesink

# width=640,height=480,framerate=100/1
# width=1280,height=960,framerate=30/1

save to file with h264 encode

gst-launch-1.0 -e v4l2src device=/dev/video0 ! 'video/x-bayer,format=grbg,width=1280,height=960,framerate=30/1,colorimetry=bt601' ! bayer2rgb ! videoconvert ! x264enc ! matroskamux ! filesink location=test.mkv
  • tips/gstreamer.txt
  • Last modified: 2023/11/16 11:42
  • by sscipioni