This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
robot-implementation:video-streaming [2019/02/25 13:20] avnerus removed |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Video Streaming ====== | ||
- | Currently testing the following stream to local Janus: | ||
- | |||
- | ===== VP8 ===== | ||
- | This command runs vp8 encoding with some cpu optimization: | ||
- | <code> | ||
- | gst-launch-1.0 pulsesrc ! queue ! opusenc ! rtpopuspay ! udpsink host=127.0.0.1 port=8003 rpicamsrc | ||
- | preview=false ! videoconvert ! video/x-raw, framerate=30/1, width=640, height=480 ! vp8enc cpu-used=5 | ||
- | threads=3 deadline=1 ! rtpvp8pay ! udpsink host=127.0.0.1 port=8004 sync=false | ||
- | </code> | ||
- | |||
- | With these Janus settings | ||
- | <code> | ||
- | [vp8-rpi] | ||
- | type = rtp | ||
- | id = 10 | ||
- | description = VP8 live stream coming from gstreamer on Raspberry Pi | ||
- | audio = yes | ||
- | video = yes | ||
- | videoport = 8004 | ||
- | audioport = 8003 | ||
- | audiopt = 111 | ||
- | audiortpmap = opus/48000/2 | ||
- | videopt = 100 | ||
- | videortpmap = VP8/90000 | ||
- | </code> | ||
- | |||
- | ===== H264 ===== | ||
- | H264 Encoding is not supported well on Chrome. | ||
- | |||
- | <code> | ||
- | gst-launch-1.0 rpicamsrc preview=false ! video/x-raw,width=1024,height=768 ! x264enc speed-preset=ultrafast | ||
- | tune=zerolatency byte-stream=true bitrate=5000 threads=1 ! h264parse config-interval=1 ! rtph264pay ! | ||
- | udpsink host=127.0.0.1 port=8004 | ||
- | </code> | ||
- | |||
- | This one is nice | ||
- | <code> | ||
- | gst-launch-1.0 rpicamsrc preview=false vflip=true ! x264enc tune=zerolatency speed-preset=ultrafast | ||
- | qp-min=18 pass=5 quantizer=21 ! video/x-h264,width=640,height=480,framerate=30/1 ! rtph264pay ! udpsink | ||
- | host=127.0.0.1 port=8004 sync=false | ||
- | </code> | ||
- | |||
- | And with synced audio: | ||
- | <code> | ||
- | gst-launch-1.0 pulsesrc ! queue ! opusenc ! rtpopuspay ! udpsink host=127.0.0.1 port=8003 rpicamsrc | ||
- | preview=false vflip=true ! x264enc tune=zerolatency speed-preset=ultrafast qp-min=18 pass=5 quantizer=21 ! | ||
- | video/x-h264,width=640,height=480,framerate=30/1 ! rtph264pay ! udpsink host=127.0.0.1 port=8004 sync=false | ||
- | </code> | ||
- | |||
- | Lower the CPU Usage | ||
- | <code> | ||
- | gst-launch-1.0 pulsesrc ! queue ! opusenc ! rtpopuspay ! udpsink host=127.0.0.1 port=8003 rpicamsrc | ||
- | preview=false ! x264enc tune=fastdecode speed-preset=1 pass=5 quantizer=30 ! video/x- | ||
- | h264,width=640,height=480,framerate=30/1 ! rtph264pay ! udpsink host=127.0.0.1 port=8004 sync=false | ||
- | </code> | ||
- | |||
- | Using JANUS Gateway's streaming plugin configured as such: | ||
- | <code> | ||
- | [h264-sample] | ||
- | type = rtp | ||
- | id = 10 | ||
- | description = H.264 live stream coming from gstreamer | ||
- | audio = yes | ||
- | video = yes | ||
- | videoport = 8004 | ||
- | audioport = 8003 | ||
- | audiopt = 111 | ||
- | audiortpmap = opus/48000/2 | ||
- | videopt = 126 | ||
- | videortpmap = H264/90000 | ||
- | videofmtp = profile-level-id=42e01f\;packetization-mode=1 | ||
- | </code> | ||
- | |||
- | ===== Pulse Audio ===== | ||
- | |||
- | Auto start pulse audio on Raspbian - **/etc/systemd/system/pulseaudio.service** | ||
- | <code> | ||
- | [Unit] | ||
- | Description=PulseAudio system server | ||
- | |||
- | [Service] | ||
- | Type=simple | ||
- | ExecStart=/usr/bin/pulseaudio --system --realtime --log-target=journal | ||
- | |||
- | [Install] | ||
- | WantedBy=multi-user.target | ||
- | </code> | ||
- | |||
- | **Sources** | ||
- | * [[https://groups.google.com/forum/#!topic/meetecho-janus/k2_oz0Kptdw]] | ||
- | * [[https://groups.google.com/forum/#!topic/meetecho-janus/KyEuS9I9B50]] | ||
- | * [[https://www.rs-online.com/designspark/building-a-raspberry-pi-2-webrtc-camera]] | ||
- | * [[https://raspberrypi.stackexchange.com/questions/26675/modern-way-to-stream-h-264-from-the-raspberry-cam]] |