LOGIN
The Node Bot
Node.js on wheels, powered by Raspberry Pi.
Harsha Alva
101
Mechanical Engineer + Software Developer
· Mangaluru, Karnataka, India
TUTORIAL

Install mjpg-streamer on Raspberry Pi for video streaming!

Introduction

mjpg-streamer is a command line application that copies JPEG frames from one or more input plugins to multiple output plugins. It can be used to stream JPEG files over an IP-based network from a webcam to various types of viewers such as Chrome, Firefox, Cambozola, VLC, mplayer, and other software capable of receiving MJPG streams.

It was originally written for embedded devices with very limited resources in terms of RAM and CPU. Its predecessor uvc_streamer was created because Linux-UVC compatible cameras directly produce JPEG data, allowing fast and performant M-JPEG streams even from an embedded device running OpenWRT. The input module input_uvc.so captures such JPG frames from a connected webcam. mjpg-streamer now supports a variety of different input devices.

 

[Edit 22 April, 2017]: Dev dependencies were not installing for some people. Updated instructions to fix that problem.

 

Steps

  1. Open terminal window.

  2. Update local package lists.
    Always do this before installing packages.
    sudo apt-get update

  3. Install dependencies.
    sudo apt-get install libjpeg8-dev imagemagick libv4l-dev

  4. Make a symbolic link of videodev2.h to videodev.h for backward-compatibility.
    sudo ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h

  5. Change directory to home directory.
    cd

  6. Clone mjpg-streamer repository from GitHub.
    This will download the source to /home/<username>/mjpg-streamer. The default username is pi.
    git clone https://github.com/jacksonliam/mjpg-streamer.git

  7. Enter into code directory.
    cd mjpg-streamer/mjpg-streamer-experimental

  8. Build and install mjpg-streamer and dependencies.

make
sudo make install
  1. Connect webcam to Raspberry Pi and check if everything works.
    mjpg_streamer -o "output_http.so -p 9000" -i "input_uvc.so -r 640x480 -n"

  2. Exit mjpg-streamer.
    Press ctrl-c

 

References

  1. https://github.com/jacksonliam/mjpg-streamer
  2. https://blog.miguelgrinberg.com/post/how-to-build-and-run-mjpg-streamer-on-the-raspberry-pi

#Robots #Robotics

#raspberrypi #robotics

Electrical Engineering
Engineering & Tech
Raspberry Pi
Skills
6 likes
Like
Award Contribution
Leave a reply...
DISCOVER
CHAT
HIRE
ACTIVITY
FEED
Chat with us!
Help
Write something before you submit it!
Photo updated
Request Sent!
Updated
Copied to Clipboard