Streaming live WebM video with FFmpeg.
Streaming WebM to display in browser with HTML5 is currently quite problematic - none of the well-known streaming servers support WebM at the moment. Current popular options are either Java-based stream-m and experimental 2.4-beta release of Icecast.
Lesser known option is to use FFmpegs FFserver to stream WebM video. For this to work you need a decently current FFmpeg release (this article was written using stable 1.0 release) compiled with libvpx and ffserver support. New builds for FFmpeg are available for Windows and Linux, however ffserver is available only on Linux.
FFserver will be the deamon doing the actual delivery to client computers. It will need enough available outbound bandwidth to deliver video to all connected clients. Video stream encoding will be done by FFmpeg so machine running FFserver won’t need alot of CPU power.
ffserver.conf file for WebM streaming:
By default ffserver will look for
/etc/ffserver.conf config file. You can override that with -f switch.
After starting ffserver with
ffserver -f ffserver.conf you should see ffserver start up:
Opening the status page on
http://localhost:8090/status.html should now show configured server status.
After FFserver is running you can stream to it by specifying feed FFM url as an output.
Important: You SHOULD NOT specify any encoding settings, those will be retrieved from FFserver!
Example of streaming webcam (or any other V4L2 cam) input with PulseAudio microphone audio on Linux:
or screencasting your desktop with x11grab:
http://localhost:8090/test.webm in a compatible browser (Firefox, Chrome) should now result in your streamed video playing.
To get webcam capabilities you can use
-list_formats all input command:
Afterwards you can configure resolution with
-s, framerate with
-r and codec with
-codec:v. Just make sure to keep those parameters AFTER -f video4linux2 and BEFORE
-i. If you put them after the
-i input specifier they will apply as encoding settings.
In Windows you need to use DirectShow
dshow input format to grab video from a camera (or a capture device like Blackmagic boxes).
Example of streaming video from Windows webcam:
To get list of device names for devices available on your systems you can pass
-list_devices true to ffmpeg
and to get list of camera capabilities you can pass
The options can be passed in the same way as noted above.