Download music to mp3 with the command line in Linux

in #linux7 years ago

Download mp3's on the Linux Command Line? What?

What is this post about? This post is to show how you can download music from youtube or soundcloud using the CLI. Before I got into Linux I was always wondering, what is so cool about the command line, and why would I want to use it for everything?


Besides the above meme, I've also felt a bit like:"I'm on this Linux thing, what now?". Its almost like the first time you installed Gentoo. Now what?

Download videos from youtube and have them converted to mp3 automatically:

For this example we are going to download one of my favourite Dave Chapelle videos.
Start by installing youtube-dl:
(You could do all of this in a virtualenv if you know what that is, if you don't know yet, don't worry about it for now.)

$ sudo apt-get install python3-pip

$ sudo pip3 install youtube-dl

You should now have youtube-dl installed. You can check if it was installed with:

$ which youtube-dl

Now we navigate to the directory where we would like to download the video as an mp3:

$ cd ~/Music/

Now let's download the video which contains a cool song in my opinion:

$ youtube-dl -x --audio-format mp3 https://www.youtube.com/watch?v=egIWskTD5J8

Hope this short post is of some help to somebody out there. If you would like to know how to download via the CLI from soundcloud then leave me a comment and I'll explain how you can do it.
Thanks for reading. Please follow and upvote if you enjoyed this article.

I wrote a previous post on this: https://steemit.com/linux/@netscape101/download-videos-from-youtube-and-convert-it-mp3-all-on-the-commandline and one of the users @harvhat gave a cool suggestion that I included in this post.

Sort:  

Oh my daughter is going to love this - she watches cover artists on YouTube and has often wanted the music on her phone

I do that for music in my car. You can show her scdl too (soundcloud downloader in python) ,see https://github.com/flyingrub/scdl which can be installed with:
$ pip3 install scdl

I always download audio in OPUS format with youtube-dl if I can.
youtube-dl --list-formats
OPUS is better quality and size than the m4a of vorbis formats.
If you want to see videos without ads: Opening the URL in VLC usually works.

Very interesting comment about OPUS. I used to be on what.cd then I would download stuff in FLAC never heard of OPUS before. I only recently figured out the opening a URL in VLC thing.
Thanks for sharing!

Youtube-dl is great, did you know about hooktube ? It is really nifty
replace youtube.com in any url with hooktube.com and you can watch the video without ads and through the browsers native video player!

I am going to try hooktube(I hope its not a lemonparty type site waiting for me lol).
Thanks for the info. Btw I see you like chess. What is a good site to read about chess related stuff,besides reddit.com/r/chess?

Ok hooktube is cool I tried it out

Free MP3 downloads online without the additional problem

Coin Marketplace

STEEM 0.15
TRX 0.17
JST 0.028
BTC 68552.89
ETH 2454.37
USDT 1.00
SBD 2.36