For those who want to test WebM live streaming with +Icecast
avconv -f video4linux2 -re -input_format mjpeg -framerate 30 -video_size 640x360 -i /dev/video0 -f WebM -g 5 -content_type video/webm icecast://source:firstname.lastname@example.org:8000/test.webm
I've tested this on latest git. Note that Icecast support in the latest stable avconv release is broken, releases before that might work.
There are 4 noteworthy parameters:
- -video_size 640x360
- I've had to use quarter of the webcam resolution, because it looked like the webcam wouldn't deliver stable output at full resolutions. This will obviously depend on the hardware/input used.
- -input_format mjpeg
- Also depends on the hardware used, might also be YUYV or h264
- -framerate 30
- Doesn't seem to do anything(?), but was supposed to match the framerate of the input device
- -g 5
- This one is rather important, as the default won't work for streaming. It sets the GOP ratio, so the keyframe interval. You can experiment with this. My quick testing shows that especially browsers seem to have problems with a stream that doesn't have a keyframe near the start. Values up to 10 seem to work reliable. Setting it too low drives the bitrate up and the quality down. YMMV.
I left out audio, as I was only testing video playback, but adding that in should be trivial.
Thanks +Luca Barbato
and +Marvin Scholz
for your work!