Raspbian简易RTSP服务

Raspbian简易RTSP服务

  • 1. 源由
  • 2. 搭建简易RTSP服务器
    • 2.1 系统安装
    • 2.2 软件安装
    • 2.3 命令介绍
      • 2.3.1 libcamera-hello
      • 2.3.2 libcamera-vid
      • 2.3.3 cvlc
  • 3. 实测
  • 4. 参考资料

1. 源由

鉴于前期的一些准备工作:

  • 《ArduPilot开源飞控之Companion Computers简单分析》
  • 《ArduPilot开源代码之CompanionComputer上天计划》

以及手头可用的资源RaspberryPi(PiZero/Pi3B+),选择rpanion-server这个想对容易上手的伴机电脑。

在使用过程中确实也遇到一些问题:

  1. Can’t set “Maximum Bitrate” beyond 10MB on Raspberry Pi3B+ #191
  2. Re-install process will fail due to the existence of binary(node/npm) links #194
  3. Feature Request: pan-tilt gimbal controls #196
  4. Is there any way to save configuration locally on Rpanion? #197
  5. 720P@20FPS latency is obviously there, any idea? #204
  6. No video feed thru UDP with RTP #175
  7. Feature Request: send VIDEO_STREAM_INFO mavlink messages to GCS #169

整个过程中也得到了stephendade的大力支持和帮助。

当然,整理这份资料,主要目的是

  1. 记录一下其他方式搭建简易RTSP服务器
  2. 了解最简系统下的RTSP服务性能
  3. 同时,和Rpanion做一个对比

期望:用最简单的命令或者环境来做对比测试。

2. 搭建简易RTSP服务器

  • 最简单的环境:rpi-rtsp-gstreamer 对应的资料:《Streaming Raspberry Pi Video via RTSP with GStreamer and Video4Linux》

  • 最简单的命令:libcamera-vid + cvlc 对应的资料:《How to use libcamera-vid to stream rtsp on raspberry pi? #3097》

注:最终结合了上面两份资料,选择了最简单命令来搭建环境。

2.1 系统安装

略,详见《Raspbian镜像无头烧录》

2.2 软件安装

$ sudo apt-get install gstreamer1.0-tools -y
$ sudo apt-get install libgstrtspserver-1.0-dev gstreamer1.0-rtsp -y
$ sudo apt-get install vlc -y

2.3 命令介绍

$ libcamera-hello --list-camera
Available cameras
-----------------
0 : ov5647 [2592x1944] (/base/soc/i2c0mux/i2c@1/ov5647@36)
    Modes: 'SGBRG10_CSI2P' : 640x480 [58.92 fps - (16, 0)/2560x1920 crop]
                             1296x972 [43.25 fps - (0, 0)/2592x1944 crop]
                             1920x1080 [30.62 fps - (348, 434)/1928x1080 crop]
                             2592x1944 [15.63 fps - (0, 0)/2592x1944 crop]

$ libcamera-vid --codec h264 --profile main --level 4 -b 150000000 --framerate 30 --width 1920 --height 1080 -t 0 --inline -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream1}' :demux=h264

2.3.1 libcamera-hello

OV5647摄像头CSI模块,支持以下模式:

  • 640x480 [58.92 fps - (16, 0)/2560x1920 crop]
  • 1296x972 [43.25 fps - (0, 0)/2592x1944 crop]
  • 1920x1080 [30.62 fps - (348, 434)/1928x1080 crop]
  • 2592x1944 [15.63 fps - (0, 0)/2592x1944 crop]
$ libcamera-hello --help
Valid options are:
  -h [ --help ] [=arg(=1)] (=0)         Print this help message
  --version [=arg(=1)] (=0)             Displays the build version number
  --list-cameras [=arg(=1)] (=0)        Lists the available cameras attached to the system.
  --camera arg (=0)                     Chooses the camera to use. To list the available indexes, use the
                                        --list-cameras option.
  -v [ --verbose ] [=arg(=2)] (=1)      Set verbosity level. Level 0 is no output, 1 is default, 2 is verbose.
  -c [ --config ] [=arg(=config.txt)]   Read the options from a file. If no filename is specified, default to
                                        config.txt. In case of duplicate options, the ones provided on the command line
                                        will be used. Note that the config file must only contain the long form
                                        options.
  --info-text arg (=#%frame (%fps fps) exp %exp ag %ag dg %dg)
                                        Sets the information string on the titlebar. Available values:
                                        %frame (frame number)
                                        %fps (framerate)
                                        %exp (shutter speed)
                                        %ag (analogue gain)
                                        %dg (digital gain)
                                        %rg (red colour gain)
                                        %bg (blue colour gain)
                                        %focus (focus FoM value)
                                        %aelock (AE locked status)
                                        %lp (lens position, if known)
                                        %afstate (AF state, if supported)
  --width arg (=0)                      Set the output image width (0 = use default value)
  --height arg (=0)                     Set the output image height (0 = use default value)
  -t [ --timeout ] arg (=5000)          Time (in ms) for which program runs
  -o [ --output ] arg                   Set the output file name
  --post-process-file arg               Set the file name for configuring the post-processing
  --rawfull [=arg(=1)] (=0)             Force use of full resolution raw frames
  -n [ --nopreview ] [=arg(=1)] (=0)    Do not show a preview window
  -p [ --preview ] arg (=0,0,0,0)       Set the preview window dimensions, given as x,y,width,height e.g. 0,0,640,480
  -f [ --fullscreen ] [=arg(=1)] (=0)   Use a fullscreen preview window
  --qt-preview [=arg(=1)] (=0)          Use Qt-based preview window (WARNING: causes heavy CPU load, fullscreen not
                                        supported)
  --hflip [=arg(=1)] (=0)               Request a horizontal flip transform
  --vflip [=arg(=1)] (=0)               Request a vertical flip transform
  --rotation arg (=0)                   Request an image rotation, 0 or 180
  --roi arg (=0,0,0,0)                  Set region of interest (digital zoom) e.g. 0.25,0.25,0.5,0.5
  --shutter arg (=0)                    Set a fixed shutter speed in microseconds
  --analoggain arg (=0)                 Set a fixed gain value (synonym for 'gain' option)
  --gain arg                            Set a fixed gain value
  --metering arg (=centre)              Set the metering mode (centre, spot, average, custom)
  --exposure arg (=normal)              Set the exposure mode (normal, sport)
  --ev arg (=0)                         Set the EV exposure compensation, where 0 = no change
  --awb arg (=auto)                     Set the AWB mode (auto, incandescent, tungsten, fluorescent, indoor, daylight,
                                        cloudy, custom)
  --awbgains arg (=0,0)                 Set explict red and blue gains (disable the automatic AWB algorithm)
  --flush [=arg(=1)] (=0)               Flush output data as soon as possible
  --wrap arg (=0)                       When writing multiple output files, reset the counter when it reaches this
                                        number
  --brightness arg (=0)                 Adjust the brightness of the output images, in the range -1.0 to 1.0
  --contrast arg (=1)                   Adjust the contrast of the output image, where 1.0 = normal contrast
  --saturation arg (=1)                 Adjust the colour saturation of the output, where 1.0 = normal and 0.0 =
                                        greyscale
  --sharpness arg (=1)                  Adjust the sharpness of the output image, where 1.0 = normal sharpening
  --framerate arg (=-1)                 Set the fixed framerate for preview and video modes
  --denoise arg (=auto)                 Sets the Denoise operating mode: auto, off, cdn_off, cdn_fast, cdn_hq
  --viewfinder-width arg (=0)           Width of viewfinder frames from the camera (distinct from the preview window
                                        size
  --viewfinder-height arg (=0)          Height of viewfinder frames from the camera (distinct from the preview window
                                        size)
  --tuning-file arg (=-)                Name of camera tuning file to use, omit this option for libcamera default
                                        behaviour
  --lores-width arg (=0)                Width of low resolution frames (use 0 to omit low resolution stream
  --lores-height arg (=0)               Height of low resolution frames (use 0 to omit low resolution stream
  --mode arg                            Camera mode as W:H:bit-depth:packing, where packing is P (packed) or U
                                        (unpacked)
  --viewfinder-mode arg                 Camera mode for preview as W:H:bit-depth:packing, where packing is P (packed)
                                        or U (unpacked)
  --buffer-count arg (=0)               Number of in-flight requests (and buffers) configured for video, raw, and
                                        still.
  --viewfinder-buffer-count arg (=0)    Number of in-flight requests (and buffers) configured for preview window.
  --autofocus-mode arg (=default)       Control to set the mode of the AF (autofocus) algorithm.(manual, auto,
                                        continuous)
  --autofocus-range arg (=normal)       Set the range of focus distances that is scanned.(normal, macro, full)
  --autofocus-speed arg (=normal)       Control that determines whether the AF algorithm is to move the lens as quickly
                                        as possible or more steadily.(normal, fast)
  --autofocus-window arg (=0,0,0,0)     Sets AfMetering to  AfMeteringWindows an set region used, e.g.
                                        0.25,0.25,0.5,0.5
  --lens-position arg                   Set the lens to a particular focus position, expressed as a reciprocal distance
                                        (0 moves the lens to infinity), or "default" for the hyperfocal distance
  --hdr [=arg(=1)] (=0)                 Enable (1) or disable (0) High Dynamic Range, where supported
  --metadata arg                        Save captured image metadata to a file or "-" for stdout
  --metadata-format arg (=json)         Format to save the metadata in, either txt or json (requires --metadata)

2.3.2 libcamera-vid

视频采集

  • 编码:--codec h264
  • 配置:--profile main
  • 级别:--level 4
  • 码流:-b 150000000
  • 帧率:--framerate 30
  • 宽高:--width 1920 --height 1080
  • 延时:-t 0
  • 强制:--inline
  • 输出:-o -
$ libcamera-vid --help
Valid options are:
  -h [ --help ] [=arg(=1)] (=0)         Print this help message
  --version [=arg(=1)] (=0)             Displays the build version number
  --list-cameras [=arg(=1)] (=0)        Lists the available cameras attached to the system.
  --camera arg (=0)                     Chooses the camera to use. To list the available indexes, use the
                                        --list-cameras option.
  -v [ --verbose ] [=arg(=2)] (=1)      Set verbosity level. Level 0 is no output, 1 is default, 2 is verbose.
  -c [ --config ] [=arg(=config.txt)]   Read the options from a file. If no filename is specified, default to
                                        config.txt. In case of duplicate options, the ones provided on the command line
                                        will be used. Note that the config file must only contain the long form
                                        options.
  --info-text arg (=#%frame (%fps fps) exp %exp ag %ag dg %dg)
                                        Sets the information string on the titlebar. Available values:
                                        %frame (frame number)
                                        %fps (framerate)
                                        %exp (shutter speed)
                                        %ag (analogue gain)
                                        %dg (digital gain)
                                        %rg (red colour gain)
                                        %bg (blue colour gain)
                                        %focus (focus FoM value)
                                        %aelock (AE locked status)
                                        %lp (lens position, if known)
                                        %afstate (AF state, if supported)
  --width arg (=0)                      Set the output image width (0 = use default value)
  --height arg (=0)                     Set the output image height (0 = use default value)
  -t [ --timeout ] arg (=5000)          Time (in ms) for which program runs
  -o [ --output ] arg                   Set the output file name
  --post-process-file arg               Set the file name for configuring the post-processing
  --rawfull [=arg(=1)] (=0)             Force use of full resolution raw frames
  -n [ --nopreview ] [=arg(=1)] (=0)    Do not show a preview window
  -p [ --preview ] arg (=0,0,0,0)       Set the preview window dimensions, given as x,y,width,height e.g. 0,0,640,480
  -f [ --fullscreen ] [=arg(=1)] (=0)   Use a fullscreen preview window
  --qt-preview [=arg(=1)] (=0)          Use Qt-based preview window (WARNING: causes heavy CPU load, fullscreen not
                                        supported)
  --hflip [=arg(=1)] (=0)               Request a horizontal flip transform
  --vflip [=arg(=1)] (=0)               Request a vertical flip transform
  --rotation arg (=0)                   Request an image rotation, 0 or 180
  --roi arg (=0,0,0,0)                  Set region of interest (digital zoom) e.g. 0.25,0.25,0.5,0.5
  --shutter arg (=0)                    Set a fixed shutter speed in microseconds
  --analoggain arg (=0)                 Set a fixed gain value (synonym for 'gain' option)
  --gain arg                            Set a fixed gain value
  --metering arg (=centre)              Set the metering mode (centre, spot, average, custom)
  --exposure arg (=normal)              Set the exposure mode (normal, sport)
  --ev arg (=0)                         Set the EV exposure compensation, where 0 = no change
  --awb arg (=auto)                     Set the AWB mode (auto, incandescent, tungsten, fluorescent, indoor, daylight,
                                        cloudy, custom)
  --awbgains arg (=0,0)                 Set explict red and blue gains (disable the automatic AWB algorithm)
  --flush [=arg(=1)] (=0)               Flush output data as soon as possible
  --wrap arg (=0)                       When writing multiple output files, reset the counter when it reaches this
                                        number
  --brightness arg (=0)                 Adjust the brightness of the output images, in the range -1.0 to 1.0
  --contrast arg (=1)                   Adjust the contrast of the output image, where 1.0 = normal contrast
  --saturation arg (=1)                 Adjust the colour saturation of the output, where 1.0 = normal and 0.0 =
                                        greyscale
  --sharpness arg (=1)                  Adjust the sharpness of the output image, where 1.0 = normal sharpening
  --framerate arg (=-1)                 Set the fixed framerate for preview and video modes
  --denoise arg (=auto)                 Sets the Denoise operating mode: auto, off, cdn_off, cdn_fast, cdn_hq
  --viewfinder-width arg (=0)           Width of viewfinder frames from the camera (distinct from the preview window
                                        size
  --viewfinder-height arg (=0)          Height of viewfinder frames from the camera (distinct from the preview window
                                        size)
  --tuning-file arg (=-)                Name of camera tuning file to use, omit this option for libcamera default
                                        behaviour
  --lores-width arg (=0)                Width of low resolution frames (use 0 to omit low resolution stream
  --lores-height arg (=0)               Height of low resolution frames (use 0 to omit low resolution stream
  --mode arg                            Camera mode as W:H:bit-depth:packing, where packing is P (packed) or U
                                        (unpacked)
  --viewfinder-mode arg                 Camera mode for preview as W:H:bit-depth:packing, where packing is P (packed)
                                        or U (unpacked)
  --buffer-count arg (=0)               Number of in-flight requests (and buffers) configured for video, raw, and
                                        still.
  --viewfinder-buffer-count arg (=0)    Number of in-flight requests (and buffers) configured for preview window.
  --autofocus-mode arg (=default)       Control to set the mode of the AF (autofocus) algorithm.(manual, auto,
                                        continuous)
  --autofocus-range arg (=normal)       Set the range of focus distances that is scanned.(normal, macro, full)
  --autofocus-speed arg (=normal)       Control that determines whether the AF algorithm is to move the lens as quickly
                                        as possible or more steadily.(normal, fast)
  --autofocus-window arg (=0,0,0,0)     Sets AfMetering to  AfMeteringWindows an set region used, e.g.
                                        0.25,0.25,0.5,0.5
  --lens-position arg                   Set the lens to a particular focus position, expressed as a reciprocal distance
                                        (0 moves the lens to infinity), or "default" for the hyperfocal distance
  --hdr [=arg(=1)] (=0)                 Enable (1) or disable (0) High Dynamic Range, where supported
  --metadata arg                        Save captured image metadata to a file or "-" for stdout
  --metadata-format arg (=json)         Format to save the metadata in, either txt or json (requires --metadata)
  -b [ --bitrate ] arg (=0)             Set the video bitrate for encoding, in bits/second (h264 only)
  --profile arg                         Set the encoding profile (h264 only)
  --level arg                           Set the encoding level (h264 only)
  -g [ --intra ] arg (=0)               Set the intra frame period (h264 only)
  --inline [=arg(=1)] (=0)              Force PPS/SPS header with every I frame (h264 only)
  --codec arg (=h264)                   Set the codec to use, either h264, mjpeg or yuv420
  --save-pts arg                        Save a timestamp file with this name
  -q [ --quality ] arg (=50)            Set the MJPEG quality parameter (mjpeg only)
  -l [ --listen ] [=arg(=1)] (=0)       Listen for an incoming client network connection before sending data to the
                                        client
  -k [ --keypress ] [=arg(=1)] (=0)     Pause or resume video recording when ENTER pressed
  -s [ --signal ] [=arg(=1)] (=0)       Pause or resume video recording when signal received
  -i [ --initial ] arg (=record)        Use 'pause' to pause the recording at startup, otherwise 'record' (the default)
  --split [=arg(=1)] (=0)               Create a new output file every time recording is paused and then resumed
  --segment arg (=0)                    Break the recording into files of approximately this many milliseconds
  --circular [=arg(=4)] (=0)            Write output to a circular buffer of the given size (in MB) which is saved on
                                        exit
  --frames arg (=0)                     Run for the exact number of frames specified. This will override any timeout
                                        set.

2.3.3 cvlc

cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream1}' :demux=h264 这里需要仔细的阅读以下文档:

  • RTP (I): Intro to RTP and SDP
  • RTP (II): Streaming with FFmpeg

还不太熟悉这个命令,不过个人理解如下:

  • 输入输出:stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream1}'
  • H264编码::demux=h264
$ cvlc --help
VLC media player 3.0.20 Vetinari (revision 3.0.20-0-g6f0d0ab126b)
Usage: vlc [options] [stream] ...
You can specify multiple streams on the commandline.
They will be enqueued in the playlist.
The first item specified will be played first.

Options-styles:
  --option  A global option that is set for the duration of the program.
   -option  A single letter version of a global --option.
   :option  An option that only applies to the stream directly before it
            and that overrides previous settings.

Stream MRL syntax:
  [[access][/demux]://]URL[#[title][:chapter][-[title][:chapter]]]
  [:option=value ...]

  Many of the global --options can also be used as MRL specific :options.
  Multiple :option=value pairs can be specified.

URL syntax:
  file:///path/file              Plain media file
  http://host[:port]/file        HTTP URL
  ftp://host[:port]/file         FTP URL
  mms://host[:port]/file         MMS URL
  screen://                      Screen capture
  dvd://[device]                 DVD device
  vcd://[device]                 VCD device
  cdda://[device]                Audio CD device
  udp://[[]@[][:]]
                                 UDP stream sent by a streaming server
  vlc://pause:          Pause the playlist for a certain time
  vlc://quit                     Special item to quit VLC


 core program (core)

 Audio
      --audio, --no-audio        Enable audio
                                 (default enabled)
      --force-dolby-surround {0 (Auto), 1 (On), 2 (Off)}
                                 Force detection of Dolby Surround
      --audio-replay-gain-mode {none,track,album}
                                 Replay gain mode
      --audio-replay-gain-preamp 
                                 Replay preamp
      --audio-replay-gain-default 
                                 Default replay gain
      --audio-time-stretch, --no-audio-time-stretch
                                 Enable time stretching audio
                                 (default enabled)
      --audio-filter     Audio filters
      --audio-visual {any,visual,glspectrum,none}
                                 Audio visualisations

 Video
  -f, --fullscreen, --no-fullscreen
                                 Fullscreen video output
                                 (default disabled)
      --video-on-top, --no-video-on-top
                                 Always on top
                                 (default disabled)
      --video-wallpaper, --no-video-wallpaper
                                 Enable wallpaper mode
                                 (default disabled)
      --video-title-show, --no-video-title-show
                                 Show media title on video
                                 (default enabled)
      --video-title-timeout 
                                 Show video title for x milliseconds
      --video-title-position {0 (Centre), 1 (Left), 2 (Right), 4 (Top), 8 (Bottom), 5 (Top-Left), 6 (Top-Right), 9 (Bottom-Left), 10 (Bottom-Right)}
                                 Position of video title
      --mouse-hide-timeout 
                                 Hide cursor and fullscreen controller after x milliseconds
   Snapshot:
      --snapshot-path    Video snapshot directory (or filename)
      --snapshot-prefix  Video snapshot file prefix
      --snapshot-format {png,jpg,tiff}
                                 Video snapshot format
      --snapshot-preview, --no-snapshot-preview
                                 Display video snapshot preview
                                 (default enabled)
      --snapshot-sequential, --no-snapshot-sequential
                                 Use sequential numbers instead of timestamps
                                 (default disabled)
   Window properties:
      --crop             Video cropping
      --custom-crop-ratios 
                                 Custom crop ratios list
      --aspect-ratio     Source aspect ratio
      --autoscale, --no-autoscale
                                 Video Auto Scaling
                                 (default enabled)
      --custom-aspect-ratios 
                                 Custom aspect ratios list
      --deinterlace {0 (Off), -1 (Automatic), 1 (On)}
                                 Deinterlace
      --deinterlace-mode {auto,discard,blend,mean,bob,linear,x,yadif,yadif2x,phosphor,ivtc}
                                 Deinterlace mode
      --video-filter     Video filter module
      --video-splitter   Video splitter module

 Subpictures
   On Screen Display:
      --spu, --no-spu            Enable sub-pictures
                                 (default enabled)
      --osd, --no-osd            On Screen Display
                                 (default enabled)
   Subtitles:
      --sub-file         Use subtitle file
      --sub-autodetect-file, --no-sub-autodetect-file
                                 Autodetect subtitle files
                                 (default enabled)
      --sub-text-scale 
                                 Subtitles text scaling factor
   Overlays:
      --sub-source       Subpictures source module
      --sub-filter       Subpictures filter module
   Track settings:
      --audio-language   Audio language
      --sub-language     Subtitle language
      --menu-language    Menu language
      --preferred-resolution {-1 (Best available), 1080 (Full HD (1080p)), 720 (HD (720p)), 576 (Standard Definition (576 or 480 lines)), 360 (Low Definition (360 lines)), 240 (Very Low Definition (240 lines))}
                                 Preferred video resolution
   Playback control:
      --input-repeat 
                                 Input repetitions
      --input-fast-seek, --no-input-fast-seek
                                 Fast seek
                                 (default disabled)
      --rate              Playback speed
   Default devices:
      --dvd              DVD device
      --vcd              VCD device
   Advanced:
      --input-title-format 
                                 Change title according to current media

 Input
      --stream-filter    Stream filter module

 Playlist
   Performance options:
  -Z, --random, --no-random      Play files randomly forever
                                 (default disabled)
  -L, --loop, --no-loop          Repeat all
                                 (default disabled)
  -R, --repeat, --no-repeat      Repeat current item
                                 (default disabled)
      --play-and-exit, --no-play-and-exit
                                 Play and exit
                                 (default disabled)
      --play-and-stop, --no-play-and-stop
                                 Play and stop
                                 (default disabled)
      --start-paused, --no-start-paused
                                 Start paused
                                 (default disabled)
      --playlist-autostart, --no-playlist-autostart
                                 Auto start
                                 (default enabled)
      --playlist-cork, --no-playlist-cork
                                 Pause on audio communication
                                 (default enabled)
      --media-library, --no-media-library
                                 Use media library
                                 (default disabled)
      --playlist-tree, --no-playlist-tree
                                 Display playlist tree
                                 (default disabled)
      --open             Default stream
      --auto-preparse, --no-auto-preparse
                                 Automatically preparse items
                                 (default enabled)
      --preparse-timeout 
                                 Preparsing timeout
      --metadata-network-access, --no-metadata-network-access
                                 Allow metadata network access
                                 (default disabled)
      --recursive {none,collapse,expand}
                                 Subdirectory behaviour
      --ignore-filetypes 
                                 Ignored extensions
      --show-hiddenfiles, --no-show-hiddenfiles
                                 Show hidden files
                                 (default disabled)
  -v, --verbose         Verbosity (0,1,2)
      --pidfile          Write process id to file
      --advanced, --no-advanced  Show advanced options
                                 (default disabled)
      --interact, --no-interact  Interface interaction
                                 (default enabled)
  -I, --intf             Interface module
      --extraintf        Extra interface modules
      --control          Control interfaces

 Hot keys
      --hotkeys-y-wheel-mode {-1 (Ignore), 0 (Volume control), 2 (Position control), 3 (Position control reversed)}
                                 Mouse wheel vertical axis control
      --hotkeys-x-wheel-mode {-1 (Ignore), 0 (Volume control), 2 (Position control), 3 (Position control reversed)}
                                 Mouse wheel horizontal axis control
      --global-key-toggle-fullscreen 
                                 Fullscreen
      --key-toggle-fullscreen 
                                 Fullscreen
      --global-key-leave-fullscreen 
                                 Exit fullscreen
      --key-leave-fullscreen 
                                 Exit fullscreen
      --global-key-play-pause 
                                 Play/Pause
      --key-play-pause   Play/Pause
      --global-key-faster 
                                 Faster
      --key-faster       Faster
      --global-key-slower 
                                 Slower
      --key-slower       Slower
      --global-key-rate-normal 
                                 Normal rate
      --key-rate-normal  Normal rate
      --global-key-rate-faster-fine 
                                 Faster (fine)
      --key-rate-faster-fine 
                                 Faster (fine)
      --global-key-rate-slower-fine 
                                 Slower (fine)
      --key-rate-slower-fine 
                                 Slower (fine)
      --global-key-next  Next
      --key-next         Next
      --global-key-prev  Previous
      --key-prev         Previous
      --global-key-stop  Stop
      --key-stop         Stop
      --global-key-jump-extrashort 
                                 Very short backwards jump
      --key-jump-extrashort 
                                 Very short backwards jump
      --global-key-jump+extrashort 
                                 Very short forward jump
      --key-jump+extrashort 
                                 Very short forward jump
      --global-key-jump-short 
                                 Short backwards jump
      --key-jump-short   Short backwards jump
      --global-key-jump+short 
                                 Short forward jump
      --key-jump+short   Short forward jump
      --global-key-jump-medium 
                                 Medium backwards jump
      --key-jump-medium  Medium backwards jump
      --global-key-jump+medium 
                                 Medium forward jump
      --key-jump+medium  Medium forward jump
      --global-key-jump-long 
                                 Long backwards jump
      --key-jump-long    Long backwards jump
      --global-key-jump+long 
                                 Long forward jump
      --key-jump+long    Long forward jump
      --global-key-frame-next 
                                 Next frame
      --key-frame-next   Next frame
      --global-key-quit  Quit
      --key-quit         Quit
      --global-key-vol-up 
                                 Volume up
      --key-vol-up       Volume up
      --global-key-vol-down 
                                 Volume down
      --key-vol-down     Volume down
      --global-key-vol-mute 
                                 Mute
      --key-vol-mute     Mute
      --global-key-audio-track 
                                 Cycle audio track
      --key-audio-track  Cycle audio track
      --global-key-audiodevice-cycle 
                                 Cycle through audio devices
      --key-audiodevice-cycle 
                                 Cycle through audio devices
      --global-key-subtitle-revtrack 
                                 Cycle subtitle track in reverse order
      --key-subtitle-revtrack 
                                 Cycle subtitle track in reverse order
      --global-key-subtitle-track 
                                 Cycle subtitle track
      --key-subtitle-track 
                                 Cycle subtitle track
      --global-key-subtitle-toggle 
                                 Toggle subtitles
      --key-subtitle-toggle 
                                 Toggle subtitles
      --global-key-program-sid-next 
                                 Cycle next program Service ID
      --key-program-sid-next 
                                 Cycle next program Service ID
      --global-key-program-sid-prev 
                                 Cycle previous program Service ID
      --key-program-sid-prev 
                                 Cycle previous program Service ID
      --global-key-aspect-ratio 
                                 Cycle source aspect ratio
      --key-aspect-ratio 
                                 Cycle source aspect ratio
      --global-key-crop  Cycle video crop
      --key-crop         Cycle video crop
      --global-key-toggle-autoscale 
                                 Toggle autoscaling
      --key-toggle-autoscale 
                                 Toggle autoscaling
      --global-key-incr-scalefactor 
                                 Increase scale factor
      --key-incr-scalefactor 
                                 Increase scale factor
      --global-key-decr-scalefactor 
                                 Decrease scale factor
      --key-decr-scalefactor 
                                 Decrease scale factor
      --global-key-deinterlace 
                                 Toggle deinterlacing
      --key-deinterlace  Toggle deinterlacing
      --global-key-deinterlace-mode 
                                 Cycle deinterlace modes
      --key-deinterlace-mode 
                                 Cycle deinterlace modes
      --global-key-intf-show 
                                 Show controller in fullscreen
      --key-intf-show    Show controller in fullscreen
      --global-key-wallpaper 
                                 Toggle wallpaper mode in video output
      --key-wallpaper    Toggle wallpaper mode in video output
      --global-key-random 
                                 Random
      --key-random       Random
      --global-key-loop  Normal/Loop/Repeat
      --key-loop         Normal/Loop/Repeat
      --global-key-zoom-quarter 
                                 1:4 Quarter
      --key-zoom-quarter 
                                 1:4 Quarter
      --global-key-zoom-half 
                                 1:2 Half
      --key-zoom-half    1:2 Half
      --global-key-zoom-original 
                                 1:1 Original
      --key-zoom-original 
                                 1:1 Original
      --global-key-zoom-double 
                                 2:1 Double
      --key-zoom-double  2:1 Double
   Jump sizes:
      --extrashort-jump-size 
                                 Very short jump length
      --short-jump-size 
                                 Short jump length
      --medium-jump-size 
                                 Medium jump length
      --long-jump-size  Long jump length
      --bookmark1        Playlist bookmark 1
      --bookmark2        Playlist bookmark 2
      --bookmark3        Playlist bookmark 3
      --bookmark4        Playlist bookmark 4
      --bookmark5        Playlist bookmark 5
      --bookmark6        Playlist bookmark 6
      --bookmark7        Playlist bookmark 7
      --bookmark8        Playlist bookmark 8
      --bookmark9        Playlist bookmark 9
      --bookmark10       Playlist bookmark 10
  -h, --help, --no-help          print help for VLC (can be combined with --advanced and --help-verbose)
                                 (default disabled)
  -H, --full-help, --no-full-help
                                 Exhaustive help for VLC and its modules
                                 (default disabled)
      --longhelp, --no-longhelp  print help for VLC and all its modules (can be combined with --advanced and --help-verbose)
                                 (default disabled)
      --help-verbose, --no-help-verbose
                                 ask for extra verbosity when displaying help
                                 (default disabled)
  -l, --list, --no-list          print a list of available modules
                                 (default disabled)
      --list-verbose, --no-list-verbose
                                 print a list of available modules with extra detail
                                 (default disabled)
  -p, --module           print help on a specific module (can be combined with --advanced and --help-verbose). Prefix the module name with = for strict matches.
      --ignore-config, --no-ignore-config
                                 no configuration option will be loaded nor saved to config file
                                 (default enabled)
      --reset-config, --no-reset-config
                                 reset the current config to the default values
                                 (default disabled)
      --reset-plugins-cache, --no-reset-plugins-cache
                                 resets the current plugins cache
                                 (default disabled)
      --version, --no-version    print version information
                                 (default disabled)
      --config           use alternate config file

Note: add --advanced to your command line to see advanced options.

To get exhaustive help, use '-H'.

3. 实测

注:链接视频是一个合集,有Rpanion/libcamera_ivd等视频,可以点开来看下效果。

总的来说:Rpi3B+ OV5647 CSI摄像模组,在640x480 @ 30/50FPS下实时的效果还是可以的。目前该摄像头驱动好像并不支持720P,所以高清的时候,会很卡顿。

$ libcamera-vid --codec h264 --profile main --level 4 --framerate 30 --width 1920 --height 1080 -t 0 --inline -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream1}' :demux=h264

  • OV5647_libcamera_cvlc_1920x1080x30FPS

OV5647-1920x1080x30FPS

4. 参考资料

【1】Raspbian安装云台
【2】Raspbian安装摄像头
【3】Raspbian镜像无头烧录

你可能感兴趣的:(Linux,计算机视觉,RTSP)