How to Stream Live Feed From DSLR on Raspberry Pi using FFServer
In this short post, I will walk you through the steps for streaming a live camera feed from a DSLR connected to the Raspberry Pi. We will be using gphoto2 for interfacing with the camera, FFmpeg for encoding the video, and FFserver for hosting the feed on a local webserver.
For this tutorial, I am assuming that you have a Raspberry Pi with Raspbian or Noob OS installed on it. You can get a Raspberry Pi from Amazon if you don’t already have one.
Also, I am assuming that you already have one of the supported cameras listed here:
Projects :: libgphoto2 :: supported cameras
On this page, you find list of the supported cameras as of the current release. Supported means here: Able to download…
I used the Canon Rebel T7 camera which I got from Amazon.
Install libghoto2 and ghoto2. Check out the setup instructions in this post for installing these libraries on a Rasberry Pi.
How to Control and Capture Images from DSLR using Raspberry Pi
In this short post, I will walk you through the steps for controlling and capturing pictures from a DSLR connected to…
Install FFmpeg and FFserver. Check out this post for step-by-step instructions.
How to install FFMPEG and FFServer on Raspberry Pi
Recently while working on a project, I needed to install FFmpeg on a Raspberry Pi. I also required FFServer along with…
Create a file at
/etc/ffserver.conf and the following contents in it.
Start the server:
ffserver -d -f /etc/ffserver.conf
Publish the Stream
We would be using ghoto2 to capture live camera preview from the DSLR and will then be encoding it to
mjpg format using FFmpeg. Finally, we will be serving this file to
feed1.ffm as defined in the
ffserver.conf file. This command achieves all of the above:
gphoto2 --capture-movie --stdout | ffmpeg -re -i pipe:0 -listen 1 -f swf http://localhost:8090/feed1.jpg
View the Stream
Create a simple HTML page and embed the stream URL in it.
<object style="width: 600px; height: 600px;" data="http://192.168.0.4:8090/test1.swf"></object>
Open the HTML file in the browser and you should be able to view the stream.
Note: You will need to enable Flash support in your browser. Also, keep in mind that Flash support might permanently be gone from the browsers by the end of the year.
You can buy me a coffee if this post really helped you learn something or fix a nagging issue!