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 debian stable is h264 (via x264) and the best audio codec at very low bitrates is Xiph’s Opus adio 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 the Co-Optional podcast animated series as an example. Audio-only, Opus codec performs surprisingly good at low bitrates, 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.