64kbps is enough to stream video
Mobile internet providers usually give you a limited amount of data per month (1GB most commonly) at full 3g/4g speed, past this limit speed is reduced to 64kbps until the month ends or you pay for an extended data package. 64Kbps is pretty similar to the 56Kbps I had back in the day so I decided to test how far can I push video compression with today’s tools and past century speeds.
The bandwidth problem
Past the data cap, download speed is reduced anywhere from 128Kbps to 32Kbps, 64Kbps being the most common and the one I have to deal with with my mobile internet provider. Latency also increases significantly from the 100ms mark to up to 1000ms, even though the download speed is fairly regular. With these characteristics, watching a YouTube video in real time is night-impossible.
My objective would be being able to, somehow, make a server grab a YouTube video and compress it so it would ‘comfortably’ stream through a 64Kbps download link and be still watchable.
Solving the problem
Deciding what to do regarding compression wasn’t too much of a headache. The best video codec available on my system is VP9 and the best audio codec at very low bit rates is Xiph’s Opus audio codec.
Codecs selected, I need to download the YouTube video stream provided with the YouTube link, the youtube-dl project proved the perfect option, since it only needs a working python interpreter to work.
Finally I need a way to send the results back to the mobile client, the video conversion being performed by a shell script, the obvious choice was using the script itself as a CGI executable so my current web server would provide the means to deliver the compressed stream. This option would also allow me to provide the YouTube URL I want to watch to the script as a CGI parameter.
All set up and done, the result is a shell script, run as CGI by a web server that pipes-through a YouTube video feed through ffmpeg or opusenc (if only audio is needed) so it could be watched in real time over a 64Kbps download link.
Considering the ridiculous bandwidth, the results were reasonably good. I will be using this video from Plainly Difficult as an example. Audio-only, Opus codec performs surprisingly good at low bit rates, 16kbps being enough for comfortable voice listening.
All these files can be played with VLC (and VLC for android) if the browser does not support the format.
Extra: added AV1 video sample. Is not ready for live encoding, only hitting
rav1e, but fun to have nonetheless.
Audio only, 16Kbps OPUS
Audio only, 8Kbps OPUS
Audio only, 6Kbps OPUS
Audio only, 0.5Kbps OPUS (Absolute minimum)
Audio/Video, 6Kbps OPUS, 32Kbps VP9
Audio/Video, 6Kbps OPUS, 32Kbps AV1 (rav1e)