[Django]-Webcam streaming in Django project

3👍

It’s hard to say use this one thing when really it will be a collection of things that meet your individual needs. Here are some links to some resources that should get you started.

  • OpenCV – Has Python wrappers for webcam
  • Tornado – Python web framework and asynchronous networking
    library
  • Twisted – Event driven networking engine written in Python

3👍

On the client side, you might want to look at getUserMedia.js for handling capturing the video from the camera – it implements a Flash fallback for browsers that don’t support the getUserMedia() API.

On the server side, I think Drewness’s answer covers it.

2👍

The short answer is that you have to use flash or narrow down which browsers you want to support.

The act of getting the stream from your webcam and into the browser is somewhat supported by HTML5 and fully supported by flash in modern browsers.

The tricky part is streaming that to other people in a call. There are two approaches – have everyone pipe their feed to a central server which then beams the collected feeds down to everyone in the room, or have peers directly connect to one another.

For any kind of real time chat app, you want to be using the latter (the latency of a central server architecture makes it unusable).

On the web your options are WebRTC, RTMFP, HLS, or plugins. WebRTC is fantastic, but is still a working standard. Most significantly IE does not support it, so if you expect this to be a public facing web app a sizable percentage of your users will be out of luck. HLS is an apple technology that also has patchy support (and isn’t particularly efficient).

For RTMFP, have a look at cirrus/stratus. They have a sample app that illustrates the technology (BTW this is what ChatRoulette uses). Of course this requires flash, but IMO it’s your best bet for covering as many platforms as possible without having your users install something first.

The choice of web framework (Django in your case) doesn’t matter very much since you don’t want your users sending their streams up to the server anyway. The server’s job is simply to help with discovery and connection, and for this you should look into a push/comet server like APE.

👤xavier

Leave a comment