hardware:raspi-vc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
hardware:raspi-vc [2020/07/15 10:20] derpeterhardware:raspi-vc [2020/12/14 02:20] (current) andi
Line 1: Line 1:
 = Video capture and encoding on the Raspberry pi = Video capture and encoding on the Raspberry pi
 +
 This page is currently a research collection and commands might not work This page is currently a research collection and commands might not work
  
Line 9: Line 10:
 * https://stamm-wilbrandt.de/en/Raspberry_camera.html * https://stamm-wilbrandt.de/en/Raspberry_camera.html
  
-== gstreamer pipe gen srt mit kaputtem alsasrc-audio vom usb:+=== gstreamer pipe gen srt mit kaputtem alsasrc-audio vom usb:
  
-gst-launch-1.0 rpicamsrc inline-headers=true annotation-mode=date+time+frame-number+black-background brightness=60 preview=1 awb-mode=1 bitrate=10000000 exposure-mode=fixedfps sensor-mode=1 keyframe-interval=25 ! 'video/x-h264, width=1920, height=1080, framerate=25/1, profile=high'  ! muxout. alsasrc device=hw:1,0 actual-latency-time=12000 buffer-time=200000  ! audioconvert ! avenc_aac ! aacparse ! muxout. mpegtsmux name=muxout ! queue  ! srtserversink uri='srt://:8888/'+  gst-launch-1.0 rpicamsrc inline-headers=true annotation-mode=date+time+frame-number+black-background brightness=60 preview=1 awb-mode=1 bitrate=10000000 exposure-mode=fixedfps sensor-mode=1 keyframe-interval=25 ! 'video/x-h264, width=1920, height=1080, framerate=25/1, profile=high'  ! muxout. alsasrc device=hw:1,0 actual-latency-time=12000 buffer-time=200000  ! audioconvert ! avenc_aac ! aacparse ! muxout. mpegtsmux name=muxout ! queue  ! srtserversink uri='srt://:8888/'`
  
-== funktionierendes audio mit ffmpeg und ner pipe in das srt-tool "srt-live-transmit":+=== funktionierendes audio mit ffmpeg und ner pipe in das srt-tool "srt-live-transmit":
  
-ffmpeg -analyzeduration 500000  -probesize 100000 -thread_queue_size 512 -f v4l2 -input_format h264 -video_size 1920x1080 -framerate 30 -i /dev/video0 -thread_queue_size 512 -f alsa -sample_rate 44100 -ac 2 -i hw:1 -map 0:0 -map 1:0 -bufsize 0 -af 'adelay=520|520,volume=0dB' -vcodec copy -acodec aac -f mpegts - | srt-live-transmit -v file://con 'srt://:8888&delay=80' -c 1316+  ffmpeg -analyzeduration 500000  -probesize 100000 -thread_queue_size 512 -f v4l2 -input_format h264 -video_size 1920x1080 -framerate 30 -i /dev/video0 -thread_queue_size 512 -f alsa -sample_rate 44100 -ac 2 -i hw:1 -map 0:0 -map 1:0 -bufsize 0 -af 'adelay=520|520,volume=0dB' -vcodec copy -acodec aac -f mpegts - | srt-live-transmit -v file://con 'srt://:8888&delay=80' -c 1316
  
 ggf vorher im v4l2 codec parameter setzen: ggf vorher im v4l2 codec parameter setzen:
  
-v4l2-ctl -c video_bitrate=4000000 +  v4l2-ctl -c video_bitrate=4000000 
-v4l2-ctl -c h264_i_frame_period=25+  v4l2-ctl -c h264_i_frame_period=25
  
-== rtmp stream from pi cam +=== rtmp stream from pi cam 
-raspivid -fps 25 -h 1080 -w 1920 -n -t 0 -g 5 -b 5000000 -stm -o - | gst-launch-1.0 -v fdsrc ! h264parse !  flvmux ! rtmpsink location='rtmp://changeme/stream/bla live=1'+  raspivid -fps 25 -h 1080 -w 1920 -n -t 0 -g 5 -b 5000000 -stm -o - | gst-launch-1.0 -v fdsrc ! h264parse !  flvmux ! rtmpsink location='rtmp://changeme/stream/bla live=1'
  
  
-== RTP stream sink and source+=== RTP stream sink and source
  
-raspivid -fps 25 -h 1080 -w 1920 -n -t 0 -b 5000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 ! gdppay ! tcpserversink host=10.23.42.145 port=5000+  raspivid -fps 25 -h 1080 -w 1920 -n -t 0 -b 5000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 ! gdppay ! tcpserversink host=10.23.42.145 port=5000
  
-gst-launch-1.0 -v tcpclientsrc host=10.23.42.145 port=5000 ! gdpdepay ! rtph264depay ! decodebin !  autovideosink sync=false+  gst-launch-1.0 -v tcpclientsrc host=10.23.42.145 port=5000 ! gdpdepay ! rtph264depay ! decodebin !  autovideosink sync=false
  
 == Capture from UVC capture device and stream rtmp == Capture from UVC capture device and stream rtmp
  
 === video4linux === video4linux
-gst-launch-1.0  v4l2src device=/dev/video0 do-timestamp=true ! videoscale !  videorate  ! videoconvert ! video/x-raw,width=1920,height=1080,framerate=25/ ! omxh264enc control-rate=variable target-bitrate=5000000  !  h264parse ! flvmux ! rtmpsink location='rtmp://<host>/stream/picam live=1'+  gst-launch-1.0  v4l2src device=/dev/video0 do-timestamp=true ! videoscale !  videorate  ! videoconvert ! video/x-raw,width=1920,height=1080,framerate=25/ ! omxh264enc control-rate=variable target-bitrate=5000000  !  h264parse ! flvmux ! rtmpsink location='rtmp://<host>/stream/picam live=1'
  
 === raspivid wrapper === raspivid wrapper
-gst-launch-1.0 rpicamsrc bitrate=5000000  do-timestamp=true ! h264parse ! flvmux ! rtmpsink location='rtmp://<host>/stream/picam'+  gst-launch-1.0 rpicamsrc bitrate=5000000  do-timestamp=true ! h264parse ! flvmux ! rtmpsink location='rtmp://<host>/stream/picam' 
 + 
 +== read encoded video
  
-= read encoded video with ffmpeg from the cam +=== read encoded video with ffmpeg from the cam 
-ffmpeg -f video4linux2 -input_format h264 -video_size 1920x1080 -framerate 30 -i /dev/video0 -vcodec copy -an test.h264+  ffmpeg -f video4linux2 -input_format h264 -video_size 1920x1080 -framerate 30 -i /dev/video0 -vcodec copy -an test.h264
  
-= read encoded video with gst and provide output via srt server +=== read encoded video with gst and provide output via srt server 
-gst-launch-1.0 rpicamsrc bitrate=8000000 ! video/x-h264, framerate=25/1, profile=high ! h264parse config-interval=1 !  mpegtsmux ! queue ! srtserversink uri=srt://:10000/+  gst-launch-1.0 rpicamsrc bitrate=8000000 ! video/x-h264, framerate=25/1, profile=high ! h264parse config-interval=1 !  mpegtsmux ! queue ! srtserversink uri=srt://:10000/
  
  
  
-= FFMPEG with SRT support on ubuntu 20.04+== FFMPEG with SRT support on ubuntu 20.04
 <code> <code>
 sudo apt build-dep ffmpeg libsrt-dev sudo apt build-dep ffmpeg libsrt-dev
  • hardware/raspi-vc.1594801211.txt.gz
  • Last modified: 2020/07/15 10:20
  • by derpeter