1

I want to pass an h.264 or MJPEG RTSP stream from an IP camera directly to a webRTC session in a browser, without re-encoding. It has to be done in python, because the target is to have such RTSP/WebRTC gateway reside on the camera itself, which has a python interpreter. The stream is one way, to the browser only. I'm a python freshman, so any hints, ideas, or links to existing libraries are welcome.

I've seen the writeup at http://www.codeproject.com/Articles/800910/Broadcasting-of-a-Video-Stream-from-an-IP-camera-U, but this requires transcode to VP8 (and is not python).

Also reviewed the thread at Use an IP-camera with webRTC and looked at the Kurento media server (nodejs) and Janus gateway (C).

One of the commenters said "you could probably very easily use the native webrtc API and provide an RTSP stream through it." Do there exist any python bindings to the native WebRTC api? Am I deranged for even thinking such a gateway application is possible in python?

Community
  • 1
  • 1
pio
  • 158
  • 1
  • 12

1 Answers1

1

Firefox supports H.264 (via the OpenH264 plugin, which is automatically downloaded). Chrome will be adding H.264 "soon". Neither supports MJPEG, nor does the native webrtc.org code - though MJPEG is supported by all of them as a camera-capture source, and it wouldn't be particularly hard to add an MJPEG video codec to the native webrtc.org code. (Non-trivial, however, because of the number of things you'd need to change.)

Note that if this traverses the open internet (or even potentially a wifi link) your solution will be unable to easily adapt to bitrate changes without asking the IP camera to change it's rate.

jesup
  • 6,220
  • 23
  • 30
  • For adaptive bitrate, I had not yet considered a solution. Would a webRTC gateway potentially be able to map browser bitrate change requests into discrete parameterized ip camera rtsp api urls? For example to change frame rate, resolution, or CBR bitrate steps? I realize this would be highly customized to a particular ip camera api, but wondering whether webrtc native code even exposes such callbacks that the vp8 codec could be bypassed? – pio Aug 19 '15 at 02:07
  • A gateway can do anything it wants on the "far side" of the gateway, and it can have full info about the call (from it's end, and in some cases from the other end too). So yes, it could change what stream is being used locally from the IP camera. – jesup Aug 20 '15 at 20:39
  • For adaptive streaming, this might give some inputs: https://flashphoner.com/browser-based-webrtc-stream-from-rtsp-ip-camera-with-low-latency/ – psykid Nov 22 '17 at 16:53