I love Free and Open Source software. There are two free and Open Source tools that I really enjoy using, they are: youtube-dl and ffmpeg.

Let’s start this guide by installing the tool youtube-dl that makes use of ffmpeg. It is up to you if you want to install a pip3 package as root. You can use pipenv or pip + virtualenv as a workaround if you prefer not to install stuff as root.

sudo pip3 install youtube-dl

Before we go any further you might also need to install ffmpeg as youtube-dl has ffmpeg as a dependency.

If you are on Mac then you can just do:(Assuming you have brew installed)

brew install ffmpeg

I found I really like that I’m going to download with my new tool in my toolbox:

This will download the file in my current directory as an mp3.

This article won’t go into the legal ramifications of using such tools so let’s assume we are working in /tmp

and that the file won’t survive reboot.

Image from KnowYourMeme:

This song is really cool, but it has quite a long intro. If I’m driving in my car then I really won’t feel like

listening to a long intro. I’m going to use my ffmpeg magic to shorten the song that I just downloaded.

ffmpeg -i “Houdini x Burna Bandz — Late Nights (Official Video)-SnLSZFAfo_M.mp3” -ss 00:00:13 -to 00:04:29 -c copy shortened-song.mp3

As you can see we not have “shortened-song.mp3” in /tmp.

Both ffmpeg and youtube-dl are amazing tools that can be used to create amazing bash scripts. I highly encourage you to use youtube-dl to download educational video playlists.

For example one of my favourite playlist for learning about SQL Injection is this one: