Ubuntu Download youtube videos as mp3

Hello,

In my last post I highlighted how you can download youtube videos using a great tool called youtube-dl

In this post we will be covering a few things.

  1. Downloading youtube videos and later converting them to mp3
  2. Downloading videos directly as mp3

We will be making use of ffmpeg and youtube-dl for our case.

Lets go

Preperation

Just so that you know that you will need to install youtube-dl first on your Ubuntu box. If you haven’t read my previous article please read that from here

http://jaspreetchahal.org/ubuntu-12-04-download-youtube-videos-using-youtube-dl/

You will also need to install ffmpeg. You can install it using the command below

[geshi lang="bash" nums="1" target="_self" ]

 

Downloading video from youtube and converting them to mp3 using ffmpeg

Lets download a video from youtube now. Considering that you are in /home/user/videos directory and you have write permissions to this folder, run this command

[geshi lang="bash" nums="1" target="_self" ]

Your video will now be stored under /home/user/videos as C-2MmguSO4w.mp4

You can also specify a file name when using youtube-dl as shown below

[geshi lang="bash" nums="1" target="_self" ]

Depending on your download speed it can take a while to download this video.

Just in case if you got error saying “Unable to download” then you would like to read my previous post.

Now we have C-2MmguSO4w.mp4 to work with. Lets convert it to mp3

The command

[geshi lang="bash" nums="1" target="_self" ]

The above command will convert our mp4 file to a mp3

-ab 192000 in above command means that our mp3 should be encoded at 192Kbps for great quality
-vn means that do not include video
-i means input file name

To know more about ffmpeg command read more here

http://linux.die.net/man/1/ffmpeg

 

 

Downloading videos as mp3 using youtube-dl

Now that we have seen how to mix ffmpeg and youtube-dl together to convert to desired format. We can do pretty much the same stuff with youtube-dl by itself.

Allow me to show you how this is done

Use this command

[geshi lang="bash" nums="1" target="_self" ]

And that’s it your video will be downloaded as mp3 now.

 

I hope that this helps. If you found any error in any of the commands above please let me know as I am also riding on a learning curve and it will be great help if you can offer any improvement to whatever I came up with above.

Cheers

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Comments

  1. Related to your topic of converting youtube videos to mp3, I found this of interest and thought I’d share this resource http://www.real.com/resources/youtube-to-mp3-converter Apparently, google has shut down several sites due to copyright violations. There are still plenty of legal youtube to mp3 converters available just best to do your homework first!

Speak Your Mind

*

CommentLuv badge