Streaming USB Webcam With the Intel Galileo Gen 2

Introduction: Streaming USB Webcam With the Intel Galileo Gen 2

About: I help ambitious entrepreneurs start, build, and grow their online business.


Today we will learn how to stream a USB webcam with the Intel Galileo Gen 2.

We will need the use of "apt-get" so a Debian Linux Build is needed on your Galileo.

Follow my Instructable for Building a Debian Linux Distribution for the Intel Galileo

Compatible Devices Check

The Drivers we will be using are the UVC video drivers.

The USB video device class (also USB video class or UVC) is a USB device class that describes devices capable of streaming video like webcams, digital camcorders, analog video converters, and still-image cameras.

This link here holds a List of Compatible UVC Devices

Once you have your Debian Build SD Card and you've checked that your webcam is compatible then we are ready to move forward!

Step 1: Prerequisites

Install libjpeg-dev and libv4l-dev

Run the following commands:

# apt-get install libjpeg-dev

# apt-get install libv4l-dev

Create a soft link to /usr/include/linux/videodev2.h

# ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h

Setup Directories

# cd /home

# mkdir Downloads

# cd Downloads

Setting up a local server

# apt-get install apache2 php5 libapache2-mod-php5

Step 2: Installing Mjpg_streamer and Fswebcam

Enter the following Commands to download and install mjpg_streamer:

# wget

# tar -zxvf mjpg-streamer.tar.gz

# cd mjpg-streamer

Comment the following line in the Makefile:



# make

Copying Files

# sudo cp mjpg_streamer /usr/local/bin

# sudo cp /usr/local/lib/

# cp -R www /usr/local/www

Installing fswebcam

# apt-get install fswebcam

Step 3: Testing the Webcam

Plug in your webcam and type:

# dmesg

Depending on your Webcam, you'll see an input device of some sort. Mine reads:

[ 12.721488] input: UVC Camera (046d:0825) as /devices/pci0000:00/0000:00:14.3/usb2/2-1/2-1:1.0/input/input2

Change Directory to our public server:

# cd /var/www

Test your server by typing <IP-Address>/index.html in your browser

For Example:

And you should see a page with a header "It Works!

Now we will test the webcam by capturing a jpeg image and sharing it on our server so we can see it from the browser.

# fswebcam -r 640x480 test.jpeg -S 20

// The -S 20 Parameter Skips 20 Frames. Useful because some cameras will capture a black image. Downsides is it delays in seconds. Feel free to play around with the parameter.

Once the picture is taken successfully, navigate to <IP-Address>/test.jpeg

And you should see a picture of whatever was in front of your camera!

Step 4: Streaming Your Webcam

We are now ready to stream the webcam!

Run the following commands:

# cd /

# export LD_LIBRARY_PATH=/usr/local/lib

# mjpg_streamer -i " -f 25 -r 640x480" -o " -w /usr/local/www"

In your browser type in <IP-Address>:8080/stream_simple.html

Congratulations you have are successfully streaming your webcam!

Step 5: Wrapping Up

I would recommend creating a script that sets up and starts the camera instead of typing many commands each time you want to start streaming.

# cd /home

# nano

Edit the file with the following contents:

fswebcam -r 640x480 test.jpeg -S 20

rm test.jpeg

export LD_LIBRARY_PATH=/usr/local/lib

usr/local/bin/mjpg_streamer -i " -f 25 -r 640x480" -o " -w /usr/local/www"

This script will capture a test image, remove it, set path environment for mjpg_streamer and run it

If you would like to run it in the background, add a '&' after the last command

(mjpg_streamer -i " -f 25 -r 640x480" -o " -w /usr/local/www" & )

Exit and Save.

# chmod a+x

Test it.

# ./

Check out this video of a project I came up with myself that uses this tutorial:

Joystick Controlled Surveillance Camera

Goodluck! and Thank you for reading my instructable.

Be the First to Share


    • Puzzles Challenge

      Puzzles Challenge
    • Lamps Challenge

      Lamps Challenge
    • Rice & Grains Challenge

      Rice & Grains Challenge



    3 years ago

    I'm having issues with uploading Arduino code to the board after Debian has loaded. The serial port will not show up on my pc at all. Any ideas how to fix this problem? Thanks!


    Question 3 years ago

    r# make
    gcc -O2 -DLINUX -D_GNU_SOURCE -Wall -lpthread -ldl mjpg_streamer.o utils.o -o mjpg_streamer
    mjpg_streamer.o: In function `signal_handler':
    mjpg_streamer.c:(.text+0x19f): undefined reference to `dlclose'
    mjpg_streamer.c:(.text+0x1cf): undefined reference to `dlclose'
    mjpg_streamer.o: In function `main':
    mjpg_streamer.c:(.text.startup+0x27b): undefined reference to `dlopen'
    mjpg_streamer.c:(.text.startup+0x29d): undefined reference to `dlsym'
    mjpg_streamer.c:(.text.startup+0x2c0): undefined reference to `dlsym'
    mjpg_streamer.c:(.text.startup+0x2e3): undefined reference to `dlsym'
    mjpg_streamer.c:(.text.startup+0x306): undefined reference to `dlsym'
    mjpg_streamer.c:(.text.startup+0x485): undefined reference to `dlopen'
    mjpg_streamer.c:(.text.startup+0x4a0): undefined reference to `dlsym'
    mjpg_streamer.c:(.text.startup+0x4c3): undefined reference to `dlsym'
    mjpg_streamer.c:(.text.startup+0x4e6): undefined reference to `dlsym'
    mjpg_streamer.c:(.text.startup+0x50d): undefined reference to `dlsym'
    mjpg_streamer.c:(.text.startup+0x778): undefined reference to `dlerror'
    mjpg_streamer.c:(.text.startup+0x923): undefined reference to `dlerror'
    collect2: error: ld returned 1 exit status
    Makefile:62: recipe for target 'mjpg_streamer' failed
    make: *** [mjpg_streamer] Error 1


    5 years ago

    do you have tutorial with another os? like windows? if you have it please sent to me

    i have many problem for connect the webcam to my pc


    6 years ago

    Hello, i have managed to install everything specifically but i have one last problem..

    it cant see the output stream when i run this mjpg_streamer -i " -f 25 -r 640x480" -o " -w /usr/local/www"

    all i see is this on mozilla firefox..

    please help.. :(


    Reply 6 years ago

    We have the same problem GanzM!! :(


    6 years ago

    Man, I just made the light go blink blink. I'll have to work my way up to this one.


    6 years ago

    I got stuck in the second step when copying files, I can't find any file neither an file and the only one with the name mjpg-streamer is the directory so there is no case to copy the other ones isn't it? I need help!


    7 years ago

    Wow!, This is a great project.... thanks for the info!.