Thursday, November 19, 2015

Video on the Pi, and over the Network (with WebRTC)

It'd be nice to have the Pi able to:

  • Operate a camera (webcam)
  • Relay the video over the network
Thinking about this, I'd like to do as little work as possible on the video.  I don't know much about encoding/decoding, but I do know it's CPU intensive (something I don't have much of on the Pi).

Therefore I'd like to do minimal work but be able to kick a video stream out over the network.

It made me think of WebRTC, a web-standard peer-to-peer media transfer mechanism.  Used in several places include Google Hangouts.  I didn't know much about it so I researched it.



In short, a WebRTC endpoint (like a web browser) will want to establish a peer-to-peer connection with another endpoint.  This entails:
  • Discovering another endpoint (not part of the standard, you implement this)
  • Exchanging details about media capabilities, and network / NAT details (details acquired by API, but still up to you to implement the transfer.
  • Attempt direct-connection (API handles this, but you need to provide STUN server details)
  • Javascript (or other language) then is provided with a stream of media content (like video) which can be directed to the screen (like a <video> tag 'src' attribute in a browser).

This seems promising on the Pi side if there is a non-browser implementation.  And there is.

Hunting around there appears to be several mentions of WebRTC and Python and Pi, including OpenWebRTC, and others.

However, the most successful path I could find online appeared to be message boards discussing the UV4L (Userspace Video 4 Linux) implementation of WebRTC and interface via a WebServer.


Another post will include detail on attempts to set up and use.


Resources about WebRTC:
  • WebRTC Demo (link)
  • WebRTC Tutorial - Infrastructure (link)
  • WebRTC Basics (link)

Resources about UV4L:
  • UV4L Announcement about supporting WebRTC (link)
  • UV4L Instructions on use (link)

No comments:

Post a Comment