I was searching about a way to stream the raspicam using WebRTC, trying to learn a bit more about WebRTC stuff.
In the different things I read, I notice these articles :
- an interesting tutorial building-a-raspberry-pi-2-webrtc-camera using janus-gateway
- the unofficial v4l2 driver uv4l that provides an webrtc-extension
- an old blog explaining that it is possible to stream from a C++ application to a browser webrtc-native-to-browser-video-streaming-example
The uv4l is nice but closed source.
Then sometimes ago, I started to build a WebRTC streamer based on the WebRTC project.
There is still works to do, like improve sound support, work with datachannels, bring interoperability with Jitsi...
But as it is starts to work, maybe it could be interesting for others developpers.
The project for Raspberry Pi can be built using an Ubuntu trusty proceeding like this :
- Install raspberry cross-compiler:
Code: Select all
git clone --depth 1 https://github.com/raspberrypi/tools.git rpi_tools export PATH=$PATH:$(pwd)/rpi_tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
- Get & Build WebRTC for Raspberry Pi
Code: Select all
git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git export PATH=$PATH:$(pwd)/depot_tools mkdir webrtc pushd webrtc GYP_DEFINES="target_arch=arm" fetch --no-history webrtc pushd src gn gen out/Release --args='is_debug=false rtc_use_h264=true ffmpeg_branding="Chrome" rtc_include_tests=false rtc_enable_protobuf=false is_clang=false target_cpu="arm" treat_warnings_as_errors=false' ninja -C out/Release popd popd
- Get & Build & pkg WebRTC Streamer
Code: Select all
git clone https://github.com/mpromonet/webrtc-streamer cd webrtc-streamer make CROSS=arm-linux-gnueabihf- SYSROOT=$(pwd)/../webrtc/src/build/linux/debian_jessie_arm-sysroot tgz
After copy and extract the tgz to a Raspberry Pi, you can simply run :
Code: Select all
./webrtc-streamer
This works with V4L2 capture devices that supports standard YUV format for capture, like raspicam, but also with USB webcam.
Best Regards,
Michel.