How to Stream Live Feed From DSLR on Raspberry Pi using FFServer

Vivek Maskara
3 min readOct 17, 2020

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.

Install FFmpeg and FFserver. Check out this post for step-by-step instructions.

Setup FFServer

Create a file at /etc/ffserver.conf and the following contents in it.

Port 8090
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 200M
ACL allow
<Stream test1.swf>
Feed feed1.ffm
Format mpeg
AudioBitRate 32
AudioChannels 1
AudioSampleRate 44100
VideoBitRate 64
VideoBufferSize 40
VideoFrameRate 20
VideoSize 1056x704
VideoGopSize 12
<Stream stat.html>
Format status
ACL allow localhost
ACL allow
<Redirect index.html>

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.