ffmpeg is an amazing program, you can do lots of crazy things with it.

In this opportunity I will teach you how to stream your webcam to http in mjpeg format.

In order to accomplish this, we will use the ffserver program that comes with ffmpeg.

ffserver allows us to configure the streaming url, and with ffmpeg we will redirect the output of our webcam to there.

Example ffserver configuration file

Start ffserver, use the -f options to specify the configuration file

  ffserver -f ffserver.conf

Redirect the webcam output to the ffserver feed


  ffmpeg -f avfoundation -i "0" http://localhost:8090/cam.ffm

Then, you can see your webcam at http://localhost:8090/cam.mpjpeg