Battling YouTube Bloat.

How watching videos on-line has become an exercise in affluent entitlement, and surveillance analytics, which I prefer to avoid

Page bookmarks:
Lower the video quality
My download script: ‘ydl’

  » download a compressed version of the script.

These days I routinely download YouTube videos rather than watching on-line. It’s not just that I like to keep an archive for future reference, and want to avoid the energy-intensive operation of repeat downloading. It’s to avoid the inherent bloat that’s taken over the YouTube world, and is clogging the Internet with people screaming into their webcams at full 4K. Additionally, it moderates the built-in surveillance that tracks your viewing habits.

It started around 2018 or 2019. I noted that the vloggers were increasingly uploading excessively large video files. The question is, why? Is is really necessary to scream into a webcam recording at 4K, or walk down a street with a selfie-stick in full HD? You have to ask why a talking-head video really has to consume almost a gigabyte of data every half-hour when it could be produced with little quality degradation for a fraction of that.

I have to hold my hand up here. Yes, I have a YouTube channel. Yes, I produce videos in HD (in case I need them for public screenings). But I downsize them to 720 pixels at 25 frames, and usually with a data rate of 600 to 800 kbps, before uploading to YouTube.

Apparently YouTube automatically encode video to H265 for storage. The higher compression rate reduces the size of the files that must be stored. The problem is the higher quality the video data, the more power H265 draws to encode each minute compared to its predecessor, H264. That’s another reason I like to upload smaller, lower quality videos; it cuts the energy used in their storage.

Quite simply, YouTube have to trade having a much larger quantity of server storage for a much larger level of power consumption. Either option isn’t pretty from an ecological perspective.

Clearly this trend, encouraged by ever-greater bandwidth amongst the affluent YouTube community, is not going to cease. As I routinely download videos to keep for future reference, this creates a huge problem for my system capacity – let alone YouTube who must host all that content, and keep it live 24–7–365. Here are two solutions:

Lower the video quality

First option: To cut data download reduce the download quality/bandwidth with the control in the player window. That cuts your individual bandwidth demand, but you will still suffer the consequences of everyone else watching at high bandwidth and slowing down the network for everyone.

YouTube's quality setting options

One of the consequences of lockdown was that the network slowed as everyone went on-line. At the same time video streaming sites came under massive pressure, and some even lowered their image quality in order to manage the physical load on their servers.

On YouTube you can lower the video playback quality manually. At the bottom-right of the display there’s a little cog icon. Click that, then click ‘quality’, and you can select the playback quality (as shown in screenshot on the right). Simple, yes?

Two catches here:

Firstly, just reducing the size of the playback image doesn’t automatically mean you’re downloading a certain amount of data for each minute of video.

The techniques of video compression vary between fast moving background and talking-head style videos. A lower quality doesn’t always mean the video occupies a specific amount of space per hour of video. You can’t easy equate an ‘Xp quality’ video to ‘Y megabytes’ of data download.

Secondly, you have to do this every time you watch a video, which is a bit of a faff.

If you want to reduce the quality for all your viewing then you have to configure this in your personalised settings (click ‘Account Settings’‘Playback’). But to do that you have to be logged in as a known user – at which point every second of every video you watch will be logged and filed for analytics purposes (itself, a major source of ‘Net bloat).

For one-off views, if you don’t want to generate lots of personalised analytics by logging in, yes, reducing the video quality is the simplest option. But what if you want to keep/collect a video for future use? Or you want to view without generating lots of analytics every time you pause or end the video?


Before I proceed to the second option, I need to introduce you to the key program involved. youtube-dl is a command-line utility that downloads videos from YouTube.

By default youtube-dl grabs the best quality video and downloads it to the local hard drive, converting the format where necessary so that it can be viewed locally. Nice and simple: Just right-click ‘Save As’ on the video link; click copy; paste into a terminal after the youtube-dl command; and press ‘enter’.

I can here people saying, “but hang on, you can get a browser plug-in to download videos”.

True. But sometimes those plug-ins will also be collecting data about your viewing habits, and may even be collecting other data about your computer and other page views. Inevitably, the ‘terms and conditions’ that pop-up when the plug-in is installed will say this, but how often do people bother to read all that?

You can configure the download process to select the quality of the video to be downloaded. To list all the videos available to download use:
youtube-dl -F {YouTube video URL}

That will dump a list of all the available video and audio formats.

The length of this list again shows how complex YouTube has become to operate, as the dimensions and bandwidth of viewing devices has increased. To serve every conceivable device, YouTube has to separately encode and store these different files to supply to anyone on demand a stream that suits them.

Most of the streams have the file size stated (in ‘MiB’, binary megabytes). That means you can choose which to download based upon its file size rather than a blind image quality setting.

To download a particular one select the ID number at the beginning of the line and enter:
youtube-dl -f {ID number} {YouTube video URL}

The specific file will then be downloaded.

youtube-dl is a great and easy to use tool – and its capabilities go far beyond the space to describe here. For example the ‘-r’ switch, which limits the downloading rate, allowing you to exist peaceably in a house where everyone is using the same slow broadband connection. But again, it’s an annoyance to have to do this two-step procedure for every video.

My download script: ‘ydl’

In 2019, tired of doing the two-step, I automated the whole process with a script – which is what I’ve decided to release. Recently, discussing the use of youtube-dl with someone who has a limited mobile data connection, it became clear that others might benefit from the use of my script.

This script is written for the standard bash shell on a Linux machine. To save time typing, you can download a compressed version of the script.

Most of the script is actually designed to make it a little more user friendly.

YouTube download bash script, ‘ydl’

# BEGIN REGEX='^[0-9]+$' # 1. capture zero parameters and throw error if [ $# -eq 0 ] then echo -e "\n" echo "Youtube video URL required" exit 1 fi # 2. download list for url and filter full audio+visual options echo -e "\n" echo "Downloading YouTube video options:" youtube-dl -F "$1" | grep -vi "only" # 3. download requested video echo -e "\n" read -p "Select video ID or 0 to exit: " ID # 4. validate integer if ! [[ $ID =~ $REGEX ]] then echo "Input not an integer value" exit 1 fi # 5. check if exit requested if [ $ID -eq "0" ] then echo -e "\n" echo "Download halted." exit fi youtube-dl -f $ID "$1" exit 0 # END

The first section checks that you have entered a string with an address.

The second section dumps the list of files, the ‘-F’ switch of the youtube-dl command. This is refined by filtering the output through a grep command to exclude all the lines that use the word ‘only’. This eliminates all the files which offer separate video or audio streams.

The third section prompts for the identity number of the file to download.

The fourth section validates the number as an integer.

The fifth section checks if a zero was entered, and if so exits the script.

Finally youtube-dl is called automatically for a second time with the file number and the address.

Let’s be clear here. This script doesn’t solve the problem of video bloat. At best it allows you to manage the bloat in a way that gives you finer control, and more privacy, than YouTube offer. In the final analysis, only YouTube themselves can control the issue of video bloat by putting limitation on the kinds of content people upload; and only then will we begin meaningfully to tackle the ecological footprint of on-line video.