====== Video Streaming ====== Currently testing the following stream to local Janus: ===== VP8 ===== This command runs vp8 encoding with some cpu optimization: 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 With these Janus settings [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 ===== H264 ===== H264 Encoding is not supported well on Chrome. 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 This one is nice 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 And with synced audio: 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 Lower the CPU Usage 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 Using JANUS Gateway's streaming plugin configured as such: [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 ===== Pulse Audio ===== Auto start pulse audio on Raspbian - **/etc/systemd/system/pulseaudio.service** [Unit] Description=PulseAudio system server [Service] Type=simple ExecStart=/usr/bin/pulseaudio --system --realtime --log-target=journal [Install] WantedBy=multi-user.target **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]]