How to use your Raspberry Pi Camera as a Webcam? (Skype demo)

use raspberry pi camera as a webcam

You probably have no webcam at home but need to make a video call now
And you are thinking about your Raspberry Pi camera, but don’t know how to use it as a webcam
That’s what I’ll show you today and it’s easy

How to use your Raspberry Pi Camera as a Webcam?
In fact, it’s not possible to plug your Raspberry Pi Camera module on your computer
But the solution I suggest is to stream the camera image on the network (IP camera), capture it on your computer and send it back to your favorite video call application (Skype for example)

In this post, I’ll explain step-by-step how to do this
And as you’ll see, it’s faster, you only need the right softwares on your computer and on your Raspberry Pi

Raspberry Pi Preparation

Let’s start now with the Raspberry Pi preparation

Install Raspbian

This tutorial is for the Raspbian distribution, so if you don’t have it yet, I recommend installing it now
I have an entire guide on how to install Raspbian on Raspberry Pi, so I will not repeat everything here

The Raspbian version has no importance
I’m doing this tutorial on Raspbian Lite, so any version is fine

Before going further you need to:

  • Install Raspbian by following the tutorial if needed
  • Update Raspbian packages to the latest version
    sudo apt update && sudo apt upgrade && sudo reboot
  • Connect the Raspberry Pi to the network (Ethernet or WiFi)
  • Enable SSH
    sudo raspi-config

    Then go to Interfacing options, SSH, and answer “Yes”
    You can now use SSH to do the next part of this tutorial

That’s it, you are ready to start

Plug the camera

You probably know how to do this if you have a camera, but don’t forget to plug it correctly on your Raspberry Pi
Remove the slot protection and plug the cable as shown in this picture:

camera cable raspberry pi

Enable the camera

By default, the camera interface of the Raspberry Pi is not enabled
To activate it, you need to use raspi-config:

sudo raspi-config

Then go to “Interfacing options” and select the “Camera” item
Answer “Yes” and exit raspi-config
The tool will ask you to reboot, accept and reboot

After the reboot, it enables the camera and we can now install the software

Install Motion

Motion is a powerful software to do everything with your camera
We’ll use it to stream the camera on the network (IP camera), but it can do a lot more

To use it, follow this procedure:

  • Install motion and the required dependencies
    sudo apt install motion libavcodec-dev libavformat-dev libavutil-dev libjpeg-dev libjpeg62-turbo-dev libpq-dev libswresample-dev

    Answer “Yes” to install them

  • Enable the camera driver
    sudo modprobe bcm2835-v4l2
  • Use this command to check that the camera is visible and displays its settings
    v4l2-ctl -V

    You will get something like:

    Format Video Capture:
    Width/Height : 1024/768
    Pixel Format : 'JPEG'
    Field : None
    Bytes per Line : 0
    Size Image : 786432
    Colorspace : JPEG
    Transfer Function : Default
    YCbCr/HSV Encoding: Default
    Quantization : Default
    Flags
  • Then you need to configure motion
    The best way I found is to download directly the configuration we need
    wget https://www.dropbox.com/s/6ruqgv1h65zufr6/motion-mmal-lowflyerUK-20151114.tar.gz
  • Extract the files
    tar -zxvf motion-mmal-lowflyerUK-20151114.tar.gz
  • Start motion
    sudo motion -c motion-mmalcam-both.conf

    Feel free to adjust settings in this file to fit your camera configuration (image height and width for example)

To do the Motion installation part, you just need to check the video stream before moving to the computer configuration

Check the video stream

The live stream is available in HTTP, by using the Raspberry Pi IP address and the port 8081
Open your web browse and go to http://<RASPBERRY_IP>:8081

Check that you can see correctly the live stream, with sufficient quality
Now that you can see the live steam, you can adjust again the Motion configuration

The goal of this tutorial is not to explain you how to configure Motion
But you can find all resources needed on their GitHub page

Computer software installation

We now have your live stream working and we need to use another software on the computer to relay the camera image in a video call

SplitCam introduction

SplitCam is the software we’ll use to turn your IP camera to a webcam for your computer
SplitCam allows, among other things, to create a virtual camera on your computer and send an IP camera flow into it

We’ll use this software to have a camera available on Skype (or other video conference softwares), even if we don’t really have a camera on our computer

Download & Install

SplitCam is a free software for Windows, you can download it from the official website

Installation

To install it on your computer, follow this procedure:

  • Double click on the file you just downloaded
  • Keep the default values (“Next”, “Agree”, “Install”)
  • At the end of the installation, click “Next” and choose where you want to put shortcuts and set default options
    Choose whatever you want. In my case, I keep only the Start menu shortcut
  • Then hit “Finish” to start SplitCam
    It may ask you to reboot to install the camera, it’s mandatory for the following

Configuration

  • After the reboot, start SplitCam
  • Click on “Sources” in the bottom menu
  • In the drop-down list, make sure you select “IP Split Camera”
    You’ll get something like this:
    splitcam sources
  • Then in the URL field, enter the live stream URL
    For example: http://192.168.1.17:8081
    Click on Add
  • After a few seconds, the line appears in the “IP Camera List” and the image in the main window

You’re almost ready, you just need to configure your video call software now

Skype configuration

I’ll show you how to use it in Skype, as I guess it’s always the most used tool for this
But it’s the same thing with any software

  • Start Skype
  • Click on “…” in the left panel and choose “Settings”
  • In the settings windows, go to “Audio & Video”
  • In the Camera section, make sure that the “SplitCam Video driver” is your main camera
    skype ip camera
  • You can check the camera image below
    And you are ready to use your Raspberry Pi camera as a classic webcam 🙂

Related questions

How to auto start motion on boot? We use a specific configuration file and command to start motion temporarily, but you can move the files to the default folders to configure it as a daemon.
Here is how to do this:

sudo mv motion /usr/bin/motion
sudo mv motion-mmalcam.conf /etc/motion.conf

Then edit the daemon configuration file: sudo nano /etc/default/motion
And change the start_motion_daemon option to “yes”
On the next reboot, motion will start directly

Conclusion

That’s it, you now know how to use your Raspberry Pi camera as a webcam in any computer software
I hope it was useful for you and that I saved you some money 🙂

If you want to get more ideas on what you can do with a camera, check my article about 10 cool things to do with a camera on Raspberry Pi

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *