z3bra.org - monochromatic blog

submited by
Style Pass
2021-06-11 21:00:12

For teaching purposes (and cool internet points!) I recently needed to share my screen and microphone online. Being the unix enthusiast that I am, I looked into how I could do it "simple" command-line tools.

And here comes ffmpeg. ffmpeg is the swiss army knife for everything related to audio and video decoding/encoding. I've been using it for multiple tasks already, from converting .ogg to .mp3, to recording GIFs of my desktop.

I started looking into how I could "stream" my desktop online, and quickly found about the ffserver utility (which is part of the ffmpeg package).

A "Feed", from ffserver point, is a URL that a user will pass to ffmpeg as the output media, to start "uploading" or "streaming" a video to. ffserver will then start bufferizing this input locally, and expose this raw buffer via a "Stream". A stream will read from this buffer, and encode it in the specified format, with a bunch of options.

I limited my research for the perfect stream to either x264 or vp8 video encoding. At first, vp8 seemed appealing, being a royalty-free format. The WEBM container also seems to be pretty good for online videos. But x264 turned out to be faster, and of higher quality (especially thanks to the "zerolatency" setting). I had to switch to x264 also because I couldn't get the libvorbis codec for audio to synchronize well with the vp8 video stream.

Leave a Comment