Downloading YouTube videos using Termux and youtube-dl on Android


How to download YouTube videos from my Android phone to watch offline.

A solution

Use the youtube-dl command line utility from the Termux app.


I work on ships where watching YouTube videos is difficult. So I want to save videos to watch offline on my Android phone. The Android apps I'd used to do this stopped being able to download YouTube videos. I use youtube-dl from my Linux laptop to download from YouTube. The Termux app on Android gives a Linux like terminal which enables me to install and run youtube-dl.


Install Termux from the F-Droid app. Don't install Termux from Google Playstore. The version on Playstore is old and not supported. There are many websites giving tutorials on Termux.

Open up Termux. Now we need to install the Python programming language which is used to install and run youtube-dl. From the command line in Termux type:

pkg install python3

Wait a minute or two while python is installed.

Python has a package installation tool called pip. We use this to install youtube-dl.


pip3 install youtube-dl

Almost there. To download a YouTube video, you copy and paste the YouTube video url and use it with the youtube-dl command like this:

youtube-dl <youtube-video-url>

Marvel as the video is downloaded to your Termux drive. But... how do we view this video? Use the Files file explorer app that comes with Android. The Termux drive shows up on this. Many file browsers don't allow access to the Termux drive. I don't know why either. You can access your newly downloaded video on the Termux drive.

Keeping youtube-dl up to date

Often youtube-dl stops working as YouTube changes something somewhere. Updating youtube-dl fixes this. Update youtube-dl using this command:

pip3 install youtube-dl -U


There are many options with youtube-dl to can specify the quality of your video and to rename it. You can download only audio which is useful for music videos. You can give a playlist link to youtube-dl and all of the playlist will be downloaded. Have a look for tutorials on youtube-dl if you want to learn more.

The alias I set up in Linux to download videos at the top quality available and rename them is:

alias youtubevid='youtube-dl -f 'best' --ignore-errors --output "%(uploader)s_%(title)s.%(ext)s"'

The alias I use to download audio only at the best quality available and rename the files is:

alias youtubemp3='youtube-dl --extract-audio --audio-format mp3 --ignore-errors --output "%(uploader)s_%(title)s.%(ext)s"'

Kicad – fixing invisible gaps in board outlines on the Edge.Cuts layer


Kicad appears to tell us that we have gaps in our board outlines when there aren't any. This can be solved by opening up the segments of the board edge slightly at the error points and bridging the gaps with short lines.

The problem

Kicad printed circuit board (PCB) designer tells you that you have a board edge that is incomplete when you run the design rules check (DRC). You can clearly see that you have a lovely, complete outline with no gaps in it. Involuntary sailor-language syndrome occurs. I encountered this issue with versions 5 and 6 of Kicad.

This occurs for me when I inherit a layout that has curves on the board edge. The board edge is drawn on the Edge.Cuts layer on Kicad. I suspect that the cause may be different grids being used at different times in the project. Grid management is one of the many things that needs attention when laying out a PCB.

See the figure below that shows the red pointy arrow of frustration generated by the DRC.

Kicad Edge.Cuts layer showing an error.

The error message in the DRC is shown below. "Error: Board has malformed outline (not a closed shape)". This is not the only error message that can be generated for this issue and the wording may well change between different versions of Kicad.

Kicad DRC error message.

For the screenshots I use a 0.1mm grid and the line thickness on the Edge.Cuts layer is 0.15mm. Only the Edge.Cuts layer is active.

If we select the top part of the curve and then the bottom part of the curve we can see that the arrow points at the join of two curves. The two curves appear to connect with no gap. Please see the two figures below which demonstrate this.

Kicad Edge.Cuts layer, top segment of board edge curve selected.
Kicad Edge.Cuts layer, bottom segment of board edge curve selected.

Take it from me, you can waste hours of your life that you will never get back trying to shift the two curve segments so that they join up so precisely that the Kicad DRC accepts them as a complete outline.

The solution

Open up the two segments so that there is visible gap between them. Keep this gap as small as practical. To do this, click on the edge of one segment and press G for grab, then keep the mouse button down and drag it. See the figure below

Kicad Edge.Cuts layer showing two segments with a gap between them.

Now we want to join the two segments with a small 'jumper', using the line tool. To get this line to connect at exactly the end of the segment so that Kicad accepts that it is connected to the curve, we look for the cursor to become a cross with a circle around it. Don't forget to select the Edge.Cuts layer first. For some reason, Kicad defaults to selecting any layer except the Edge.Cuts layer. Which also leads to involuntary sailor-language syndrome.

The figures below show the beginning and end of the short 'jumper' line correctly connecting the separate segments.

Selecting the end of a segment on the Edge.Cuts layer.

Drawing the connecting line between two segments on the Edge.Cuts layer.

Again, note that the cursor becomes a cross in a circle. This shows that the cursor is on the end of the segment.

Run DRC again and rejoice that the red arrow has gone. You may find that the jumper you drew has been adsorbed into one of the segments and no longer appears as a separate entity.


Adding this jumper may slightly distort your intended board outline. The router bit used to carve out your PCB is probably around 2mm in diameter. By zooming in on the affected region to add your jumper, any small distortion will be smoothed out by the router. In the example screenshots, the small crosses are 0.1mm apart.

Installing kicad nightly-build on Debian 11

The problem

I needed the latest nightly build version of the Kicad PCB design software to open some design files sent to me. I run Debian 11.

How to install kicad nightly-build on Debian

I got started with the information on this site

Create a .list file in the folder /etc/apt/sources.list.d. e.g. /etc/apt/sources.list.d/kicad-nightly.list.


deb [arch=amd64] bullseye main

If you are not running Debian bullseye, change the 'bullseye' to whichever version of Debian that you are running.

sudo aptitude update

There will be an error, complaining of an unsigned key with a name like e.g. E3CA1A89941C42E6.

Fix this by:

sudo apt-key adv --keyserver --recv-keys [missing key name]

sudo aptitude update

sudo aptitude search kicad

You should find kicad-nightly in the list of available files.

sudo aptitude install kicad-nightly

To run:


Where I went wrong

I tried to install from an Ubuntu PPA site here.

I ended up with unresolved dependencies, which had other dependencies in a never-ending pit of dependencies.