I am trying to stream my rpi-camera to my webbrowser. I would like to use webrtc. I have tried using (and modifying) this GStreamer WebRTC demos for webrtc using gstreamer. I can successfully stream vp8 to my browser, the issue is that it is taxing on the cpu to take the h264 frames from the camera and convert it to vp8 then send to the browser via webrtc.

I figure, okay, chrome and firefox support h264, so does webrtc, and so does raspivid. When I try passing the stream directly to the webrtcbin it will send it to the browser but with a lot of stuttering or out right artifacts:

This trying to use the videotestsrc element converting it to h264 and sending it to the webrtcbin

Is there some magic sauce that will allow me to stream the camera to the browser? I am unsure if its an issue with what profile/level the h264 stream is (although this is what I suspect).

I also looked at webrtc-unidirectional-h264.c and see that the profile is constrained-baseline with level 3.0. is there a way I can get the camera to output this or do I always need to convert it? AFAIK raspivid does not do profiles lower than baseline and level lower than 4. Can this be the issue?

I am stuck here anyone care to shed some light.

  • Have you had a look at motioneyeos it's a dedicated distro for using your pi as a network camera.
    – rohtua
    Commented Feb 10, 2019 at 18:03
  • jsmpg works - there's a ready-made implementation here: github.com/waveform80/pistreaming Commented Feb 10, 2019 at 19:53
  • @rohtua yes, I used to use motioneye, its just sad that the framerate is so low. I can get upto 10fps at 640x480 which is much worse than many cameras on the market. AFAIK the pi can stream 1080p with <1sec latency. The only issue I am having is pushing the h264 to the browser properly. Have you had any experience with doing this?
    – Kevin
    Commented Feb 10, 2019 at 20:16
  • I'm afraid not. I guess I've been quite lucky. I'm using motioneye on a Pi3b+ I'm recording at 1600x1200 getting 10fps. It took a bit of tweaking particularly with the streaming settings. I record at the above but the streaming I've had to reduce to 75% quality. Apart from some storage issues (recording direct to nas) I can't say I've had many issues with motioneye. Its doing the job for me for now.
    – rohtua
    Commented Feb 10, 2019 at 20:21
  • hrmm... jsmpg is interesting, but still no dice on how to present h264 on the browser. Although this still relies on transcoding, more specifically transcoding at low resolutions.
    – Kevin
    Commented Feb 10, 2019 at 20:21

2 Answers 2


I have found that the solution mentioned in


works well. Out-of-the box, the video will have a text overlay, but if you give a "contribution" of $15 or so, and email the author, you can get a key that removes the text. I'm getting low-latency (0.5 sec or so) video at 1280 X 960 @ 30fps from a Model 3B Raspberry pi and the Raspberry pi camera. The resultant h.264 video stream is directly viewable in CHROME or Firefox.
Note that I'm not doing 2-way video or audio of any kind, although it is supposed to be capable of that. The program has a lot of options.

  • Yeah, I have seen this before. Very promising project. I am very curious as to how they did it. Thanks!
    – Kevin
    Commented Mar 8, 2019 at 21:59
  • I believe they are capturing the screen buffer and sending it. One thing that I can say - it works well. Commented Mar 9, 2019 at 22:51

You can try my project, it makes your H264 camera viewable in any browser. (or your basic usb camera, if your hw has m2m compatible h264 encoder, like the rpi) https://github.com/soyersoyer/fmp4streamer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.