Low-cost Video Streaming With A Webcam And Raspberry Pi

Some people will tell you that YouTube has become a vast wasteland of entertainment like the boob tube before it. Live streaming doesn’t help the situation much, and this entry level webcam live-stream server isn’t poised to advance the art.

We jest, but only a little. [Mike Haldas] runs a video surveillance company that sells all manner of web-enabled cameras and wondered what it would take to get a low-end camera set up for live streaming. The first step was converting the Zavio webcam stream from RTSP (real-time streaming protocol) to the standard that YouTube uses, RTMP (real-time messaging protocol). Luckily, FFmpeg handles that conversion, so he compiled it for his MacBook Pro and set up a proof of concept. It worked, but he needed a compact solution that would free up his laptop. Raspberry Pi to the rescue – after loading a bunch of libraries and a four-hour build and install of FFmpeg, the webcam was streaming 1080p video of [Mike]’s sales office. He was worried that the Pi wouldn’t have the power needed for the job, and that it would be unstable. But as of this writing, the stream below has been active for six days, and it’s riveting stuff.

Raspberry Pis are a staple in the audio streaming world, like this pro-grade FM broadcast streaming rack or this minuscule internet radio streamer. And of course there’s this quick and dirty, warm and fuzzy streaming baby monitor.

https://www.youtube.com/watch?v=3k_AOArC-ec

[via r/Raspberry Pi]

32 thoughts on “Low-cost Video Streaming With A Webcam And Raspberry Pi

    1. I’ve just put in a order for 2 more Orange pi PCs for $20 each and 1 more MiNi BPI-M2+plus Banana Pi M2+plus H3 Quad-Core 1GB RAM 8GB eMMC for $45.
      The M2 I love the little thing. using it for free wifi at the coffee shops and stores up to 2 km. it has a rotary hi gain 2.4 ghz antenna. it is about 45 feet up and mixed in with my TV antennas. It is also streaming video of my solar panels and back yard.
      For the price they are great. And yes you do have to do a little extra work to get them going right. And they are not meant for some jobs.

    2. No need for temps, SD card can be read-only for the system… Even the Raspi Zero 1.3 has just enough power to encode a 1080p h264 stream and send it somewhere… Mind you that 1080p is pretty much the limit of what this SoC can do on real-time.

  1. Camera on a Pi? Must be a slow news day.

    How about hacking an old CCTV outdoor camera, replace the internal board with a rooted Hi3518E, add ESP32 with an IR sensor to wake up the cam and upload a few seconds of video to a cloud service? Low duty cycle, so it’s powered by solar and battery. Then you’d have my attention.

    (Something I hope to try myself in the next year.)

  2. This looks like a ‘low end’ *IP* camera not a webcam.

    Webcams are normally VGA still picture (640×480) with magic pixie interpolation so that it looks twice as blurry as it actually is OR QVGA (320×240) motion picture at about 20FPS because that it about all that can fit down the hole of a USB 2.0 cable.

    So a web cam is totally useless as a wide angle 55-70 deg fixed lens security camera.

    On the other hand, IP cameras have much higher resolution and can do digital compression before sending over IP so they really can’t be compared to a ‘web cam’. Not only that, IP cameras often have pan tilt zoom.

    1. webcam just means a camera meant to hook up to a different device and feed it video probably for streaming, like a computer or a video game console. it came from the fact that a lot of the first webcams were hooked to a livestream, and could be viewed on the early web.

      not sure where you get the resolution or lens autism from?

      and yes, this is an IP camera but most webcams do some sort of compression before sending it over firewire or USB or whatever hardline to the computer/device. IP cameras don’t often have PTZ, that’s another wrong generalization.

      the reason IP cameras are grouped separate from webcams is that they usually connect via a primarily networked interface (wifi, ethernet) and they can be accessed remotely somehow: IP.

    2. Logitech have some pretty good webcams that do HD…

      BTW: webcam means: a video camera that inputs to a computer connected to the Internet, so that its images can be viewed by Internet users. It has nothing to do with resolution…

    3. From Wikipedia –
      “Unlike an IP camera (which connects using Ethernet or Wi-Fi), a webcam is generally connected by a USB cable, or similar cable, or built into computer hardware, such as laptops”

      That means that until recently the bottle neck to resolution was USB 2.0 as most cheep webcams don’t encode, they just send RAW pixel data.

      As for IP/webcam and PTZ, just go look at ebay.

  3. Why not hack the firmware on the webcam ? most run Linux on ARM, can easily do RSTP, and instead of recompiling FFMpeg for Raspberry Pi it could be done on the webcam itself. At least the cheap (35$] cameras with autofocus can do that…

    1. Hey, we are looking for a consultant to basically hack a webcam firmware so that it will transmit audio / video over wireless HDMI or bluetooth. Would that be something You’d be interested in?

  4. why use shitty $199 IP camera (that probably is one of the MIRAI targets) instead of Pee $30 camera module?

    > [Mike Haldas] runs a video surveillance company that sells

    oh, thats why …

      1. [rasz_pl] has been calling the Raspberry Pi “the Pee” for several years in HAD comments because he thinks it’s funny (nobody else seems to laughs though), and because he says “Pi” sounds like “PEE” so calls it the Pee instead. That is a strange thing to say given that both it and the Greek letter ‘π’ are pronounced the same way (/paɪ/, “pie”), and has been used to represent the mathematical constant since the mid 1700’s and is derived from the first letter of the Greek word perimetros.

        He has been noted in the past to semi-troll posters about various Raspberry Pi related things. Again, he thinks he is being clever / funny. I only ever see him post when it’s a Pi related topic, or if the comments swing to a Pi related topic.

        rasz_pl – what exactly is your problem with the Raspberry Pi, you seem to some strange love-hate relationship that you want people to notice, or is it that you are just wanting attention? If you just like to troll people like other comment posters do with the Arduino topics, then fine, just say so and I’ll let you get back to it. I don’t care if you Troll or not, it doesn’t bother me, I’m just curious as to your intentions.

        1. I guess I haven’t noticed him before now. Definitely a weak attempt at trolling, though points for him doing it for so long despite little to no recognition for his efforts. Sad…so sad.

        2. Quite frankly Im shocked you would slander my name with those baseless accusations!

          I just ran a script on last ~350 Had topics I read (2016/08-2016/11, and Yes Im logging this, google “HaDcomments” for old version of my script). I commented in 68 topics. There was less than 10% Pee in those 350 (30 stories), and I only commented in 7 of those. You could say this is only 1% Pee.

  5. where i am from, a raspi + camera module + sd card + wifi was more expensive than chinese wifi enabled webcam.

    at least a year or two ago, when i was considering my options.

    lets update those calculations, shall we?

    raspberry pi 3 (https://www.robofun.ro/raspberry-pi-si-componente/raspberry-pi-v3) approx 50 USD
    pi noir camera (https://www.robofun.ro/raspberry-pi-si-componente/camera/camera-pi-noir-infrarosu-raspberry-pi-versiunea2) approx 90 USD
    minimal 4G sd card (http://www.emag.ro/search/carduri-memorie/filter/capacitate-gb-f467,4-v1226/sd+card) approx 4USD
    usb power supply (http://www.emag.ro/search/carduri-memorie/filter/capacitate-gb-f467,4-v1226/sd+card) approx 10 USD

    For a total of approx 154 USD

    for a fourth/fifth of the price, i can get a wifi surveillance camera:
    http://www.emag.ro/search/camera+wifi/sort-priceasc

    of course, with a pi, i can optimize the experience, but none of these calculations include even a case for the pi, let alone custom lenses or whatnot.

    sure, i could plug in multiple usb webcams into a single pi, but considering the distances, i might as well string them all into a more powerful (yet older) desktop pc, and forget the wireless…. aaaaand i have another ratsnest of wires to mind.

    so… uhm… yeah…

    1. chinese wifi enabled webcam = mirai botnet calling motherbase spyware shitbox, and as for the quality here you go:
      https://www.youtube.com/watch?v=ESG7Uw6kBsE

      pee zero $5, of if you cant get the snowflake price $25 on amazon free shipping
      pee camera module $15 on Amazon free shipping, Noir is $24
      USB 2.0 to Fast Ethernet $5 amazon free shipping
      usb charger >=$7 amazon free shipping

      ~$32-$60

      >none of these calculations include even a case for the pi, let alone custom lenses or whatnot.

      you bring chinese interpolated 720p garbage spycam and custom lenses in same comment? :DDD

      1. the only reason i bring custom lenses and chinese surveillance cams in the same paragraph is that the viewing angles on a surveillance camera might be more suitable for surveillance (wide angle, perhaps), than the Pi Camera. I didnt actually research it. for this price difference, i couldnt be bothered.i could envision a situation where a chinese camera would have a good angle, and a pi camera needing a custom lens for that. were the prices closer, i might have done further research.

        as for the botnet calls mothership, the solution is simple, for my project:

        i planned to make a system that allows multiple viewers to connect to the stream. hence multiple users connecting directly to the cameras would very fastly saturate the Wifi as it is essentially a time shared medium, with all sockets streaming pretty large quantities of data.

        hence, i planned to connect all cameras via wifi on a network without internet acces to a linux motion client that would have dual nic and serve as a stream server for multiple connection at once on an external, wired nic. aditionally, it would record, detect motion and do other things as well..

        chinese cameras are hence deprived of any exterior access.

    2. Why the hell is a pi noIR 90 USD over there? That’s the weirdest thing ever, you should order it from a neighboring country and save at the very least 50 bucks, and that’s calculating the shipping with the price.

Leave a Reply to ewertzCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.