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
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.
ACL allow 127.0.0.1
Format mpegAudioBitRate 32
AudioSampleRate 44100VideoBitRate 64
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255
Note: I am using the configs as mentioned in this thread. Check out FFserver docs for more configuration options.
Start the server:
ffserver -d -f /etc/ffserver.conf
Publish the Stream
We would be using ghoto2 to capture a 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.
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.
That’s it for this post. I hope you will find this post useful. I found the above information in a comment on this thread. All credits to vincent for suggesting this solution.
That’s it for this post. Please leave a clap if you found this article useful. Consider subscribing to Medium to read more of my stories.