Page 1 of 1

UV4L for streaming between rpi's

Posted: Mon Jul 11, 2016 11:12 am
by wese
Hi,

I'm trying to set up a audio and video streaming between 3 raspberry pi's. Every raspberry pi has usb webcam with microphone and external screen attached to them. The plan is that every screen is on split screen showing the streams from two other raspberry pi's.

I was trying to accomplish this using UV4L and the most promising feature was the WebRTC two-way Audio Video plugin. With it i was able to set the --webrtc-renderer-window option and got the uv4l to render the video straight without the need of an browser. Problem is that the other raspberry pi has to use browser to make the call. I also tried to run two UV4L instances to make two calls to the same rpi without success.

So I have few questions. Is it possible to make a call from one raspberry pi to another using uv4l and without the need of an browser? Also the uv4l-uvc.conf file includes option for second webrtc-renderer2-window, why is it there if it's not possible to receive many simultaneous calls anyway, or is it?

I also tried the janus-gateway plugin but it doesn't work well with my scenario, because every raspberry pi would have to send the stream to janus videoroom and then also join the room second time with a browser to see the other streams.

Is there a way to make this scenario work with UV4L or do i have to think some other solution?
Suggestions are always welcome :)

Thank you!

Re: UV4L for streaming between rpi's

Posted: Mon Jul 11, 2016 1:16 pm
by RpiName
wese wrote:I also tried the janus-gateway plugin but it doesn't work well with my scenario, because every raspberry pi would have to send the stream to janus videoroom and then also join the room second time with a browser to see the other streams.
That makes little or no sense.

You do not need any browser installed on any of the Rpi. UV4L makes direct use of all the hardware attached to the Rpi and can be optionally controlled through a web interface. In few words, it automatically captures your camera and audio input (e.g. usb mic) and automatically renders any participants in the room onto the screen (if present) and audio is played back through the speakers (if present).

Try out this DEMO OS made for Raspberry Pi 3, which allows you to entirely host videoconferences on a single Rpi. It works out of the box with the official Rpi camera board, but you can tweak it to make it work with usb webcams:

http://www.linux-projects.org/rpi-video ... e-demo-os/

Re: UV4L for streaming between rpi's

Posted: Tue Jul 12, 2016 5:54 am
by wese
Thanks for the reply,
seems I misunderstood the janus gateway.
In few words, it automatically captures your camera and audio input (e.g. usb mic) and automatically renders any participants in the room onto the screen (if present) and audio is played back through the speakers (if present).
So I started the janus gateway and started to stream the video there with raspberry pi:

Code: Select all

curl --insecure -s 'https://<RPI>/janus?gateway_url=https://<RPI>&gateway_root=/janus&room=1234&username=test&publish=1&subscribe=1&hw_vcodec=1&vformat=60&reconnect=1&action=Start' > /dev/null
and then I connected to the videoroom with my laptop but nothing appeared to the screen connected to raspberry pi. The laptop was connected through the janus demo website and the website was displaying both streams correctly.

My uv4l configuration on janus and webrtc part looks like this:

Code: Select all

### WebRTC options:
server-option = --enable-webrtc=yes
server-option = --enable-webrtc-video=yes
server-option = --enable-webrtc-audio=yes
server-option = --enable-webrtc-datachannels=no
#server-option = --webrtc-datachannel-label=uv4l
#server-option = --webrtc-datachannel-socket=/tmp/uv4l.socket
server-option = --webrtc-receive-video=yes
### video rendering window size on display
### all four lines below one for each (x, y, width, height)
### fullscreen should be disabled if you want to set the size of the window:
server-option = --webrtc-renderer-window=0
server-option = --webrtc-renderer-window=0
server-option = --webrtc-renderer-window=1920
server-option = --webrtc-renderer-window=1080
server-option = --webrtc-renderer-fullscreen=no
server-option = --webrtc-renderer-rotation=0
server-option = --webrtc-renderer-opacity=255
server-option = --webrtc-renderer2-window=960
server-option = --webrtc-renderer2-window=0
server-option = --webrtc-renderer2-window=960
server-option = --webrtc-renderer2-window=1080
server-option = --webrtc-receive-audio=yes
server-option = --webrtc-received-audio-volume=5.0
server-option = --webrtc-prerenderer-smoothing=yes
server-option = --webrtc-vad=yes
server-option = --webrtc-echo-cancellation=yes
server-option = --webrtc-preferred-vcodec=0
server-option = --webrtc-enable-hw-codec=yes
server-option = --webrtc-hw-vcodec-minbitrate=256
server-option = --webrtc-hw-vcodec-maxbitrate=4000
server-option = --webrtc-hw-vcodec-startbitrate=800
server-option = --webrtc-cpu-overuse-detection=yes
server-option = --webrtc-combined-audiovideo-bwe=yes
# server-option = --webrtc-stun-urls=stun:stun.l.google.com:19302
# server-option = --webrtc-ice-servers=[{"urls": "stun:stun1.example.net"}, {"urls": "turn:turn.example.org", "username": "user", "credential": "myPassword"}]
# server-option = --webrtc-stun-server=yes
# server-option = --webrtc-tcp-candidate-policy=yes
# server-option = --webrtc-ignore-loopback=yes

### Janus WebRTC Gateway options:
server-option = --janus-gateway-url=https://<RPI>:8089
server-option = --janus-gateway-root=/janus
server-option = --janus-room=1234
# server-option = --janus-room-pin=#pin
server-option = --janus-username=test
# server-option = --janus-token=#token
# server-option = --janus-proxy-host=#host
# server-option = --janus-proxy-port=80
# server-option = --janus-proxy-username=#user
# server-option = --janus-proxy-password=#password
# server-option = --janus-proxy-bypass=#regex
server-option = --janus-reconnect=yes
server-option = --janus-force-hw-vcodec=no
server-option = --janus-video-format=60
server-option = --janus-publish=yes
server-option = --janus-subscribe=yes
Am I missing something?

Edit:
Seems I'm running some kind of limited edition, uv4l is not free anymore?
Image

Re: UV4L for streaming between rpi's

Posted: Tue Jul 12, 2016 7:38 am
by RpiName
use the demo OS I pointed out, it does not have such limit

Re: UV4L for streaming between rpi's

Posted: Tue Jul 12, 2016 10:59 am
by jamesh
wese wrote:Hi,

I'm trying to set up a audio and video streaming between 3 raspberry pi's. Every raspberry pi has usb webcam with microphone and external screen attached to them. The plan is that every screen is on split screen showing the streams from two other raspberry pi's.

I was trying to accomplish this using UV4L and the most promising feature was the WebRTC two-way Audio Video plugin. With it i was able to set the --webrtc-renderer-window option and got the uv4l to render the video straight without the need of an browser. Problem is that the other raspberry pi has to use browser to make the call. I also tried to run two UV4L instances to make two calls to the same rpi without success.

So I have few questions. Is it possible to make a call from one raspberry pi to another using uv4l and without the need of an browser? Also the uv4l-uvc.conf file includes option for second webrtc-renderer2-window, why is it there if it's not possible to receive many simultaneous calls anyway, or is it?

I also tried the janus-gateway plugin but it doesn't work well with my scenario, because every raspberry pi would have to send the stream to janus videoroom and then also join the room second time with a browser to see the other streams.

Is there a way to make this scenario work with UV4L or do i have to think some other solution?
Suggestions are always welcome :)

Thank you!
You could try the Foundations V4L driver - not userland, but should work OK on Raspbian.

Re: UV4L for streaming between rpi's

Posted: Wed Jul 13, 2016 7:07 am
by wese
I got everything needed to work with the Demo OS, only problem is that the Demo OS seems to be missing all the wifi drivers. I'm using raspberry pi 3 so is there any easy way to install the drivers for the built-in wifi chip? Would be nice to get the stuff working without ethernet cable.

Re: UV4L for streaming between rpi's

Posted: Wed Jul 13, 2016 8:22 am
by RpiName
wese wrote:Would be nice to get the stuff working without ethernet cable.
as it's based on Raspbian you can install and configure a wireless connection as usual.

Re: UV4L for streaming between rpi's

Posted: Wed Jul 13, 2016 11:15 am
by wese
as it's based on Raspbian you can install and configure a wireless connection as usual.
It doesn't seem to work with the rpi 3 built in wifi. The whole interface doesn't show up, even the configuration is correct.
When I tried connect the usb wifi dongle, the connection jumped up instantly without any problem.

Results form ifconfig:

Code: Select all

pi@raspberrypi-b827ebc49194:~$ sudo ifconfig wlan0 up
wlan0: ERROR while getting interface flags: No such device
So it must be missing a driver for the built in broadcom wifi chip right?

Re: UV4L for streaming between rpi's

Posted: Wed Jul 13, 2016 5:01 pm
by RpiName
wese wrote:So it must be missing a driver for the built in broadcom wifi chip right?
The firmware is missing. To install it:

Code: Select all

sudo mkdir -p /lib/firmware/brcm/
cd /lib/firmware/brcm/
sudo wget https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/brcm/brcmfmac43430-sdio.bin
sudo wget https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm80211/brcm/brcmfmac43430-sdio.txt
Reboot. You should now have wlan0.

Re: UV4L for streaming between rpi's

Posted: Fri Jul 15, 2016 5:35 am
by wese
RpiName wrote:
Reboot. You should now have wlan0.
Great, thanks!

One last question. Changing the –janus-video-format value doesn't seem to have any effect in the stream resolution. I tried changing it to different values (60, 80 etc.) without any effect. The video resolution stays at 480p. I also made custom request using curl and without success.
So is it possible to get 720p without enabling hw-encoding?

In two-way webrtc scenario the 720p works fine with hw-encoding but in the janus scenario hw-encoding is disabled.

Cheers :)

Re: UV4L for streaming between rpi's

Posted: Tue May 29, 2018 7:52 am
by Footniko
Is it possible to enable the hw encoding somehow when sending a stream to Janus gateway?