8

Possible Duplicate:
Downloading a youtube video
How to download an MP3 track from a YouTube video

Is there any app like the one from DVDvideosoft but for linux to download and convert videos to mp3? Without the need to download them first. If it is not what app should I use without the terminal? I have 12.10.

Atladica
  • 1,377

7 Answers7

34

youtube-dl has a command line option to extract the audio into an mp3 and discard the video downloaded:

youtube-dl --extract-audio --audio-format mp3 -l [YOUTUBE VIDEO LINK]

This works in my version of youtube-dl, which is 2012.09.27. Download youtube-dl from its website.

gertvdijk
  • 67,947
Chris
  • 341
  • 2
    add the option --audio-quality 160K (or 128K or whatever). In my case, without the option it is converted to 64kbps, which is pretty low-fi. See nan youtube-dl for details and more options. ALso keep in mind, that youtube-dl is able to extract from many other sites. – PythoNic Sep 16 '14 at 21:00
10

You could always try clipgrab you can download youtube videos and also select which format you would like it to be in. It has a nice interface also...

ppa:clipgrab-team/ppa Launchpad logo (Click here for instructions on using PPAs.)

sudo add-apt-repository ppa:clipgrab-team/ppa && sudo apt-get update && sudo apt-get install clipgrab

by adding this ppa you will get the clipgrab package...you can search for youtube videos via this application and also copy and paste the link to the video into it and it will download the video, also you can select the format you want it in. enter image description here

rstreeter78
  • 1,364
7

Ubuntu. Convert youtube video to mp3 on-line with a command line script.

http://iasptk.com/ubuntu-convert-youtube-video-mp3-line-command-line-script/

Before you can use the script make sure you have "youtube-dl" and "ffmpeg" installed. We will use youtube-dl to download youtube videos, and ffmpeg to convert them into the mp3 format. Create a new file...

gedit youtube2mp3

...and paste the following script:


#!/bin/bash

x=/tmp/.youtube-dl-$(date +%y.%m.%d_%H.%M.%S)-$RANDOM.flv

youtube-dl --output=$x --format=18 "$1"

avconv -i $x -acodec libmp3lame -ac 2 -ab 128k -vn -y "$2"

rm $x

# if you get "ERROR: unable to download video" 
# update youtube-dl with
# sudo youtube-dl -U

(avconv is used in DEBIAN and UBUNTU instead of ffmpeg)

Save and close gedit. Now install the script somewhere easily accessible.

sudo install youtube2mp3 /usr/local/bin

Now you can convert youtube videos into mp3 files by using the following command (including the double quotes):

youtube2mp3 "youtube-link" "mp3-file.mp3"

For this script to work, avconv OR ffmpeg must be able to use the libmp3lame code (libavcodec-extra-53 and libavcodec-extra-52), not provided with the ffmpeg on Ubuntu (see installation).

Also, the script is very verbose. Use the following command if you don't want to see all the messages on your screen:

youtube2mp3 "youtube-link" "mp3-file.mp3" > /dev/null

You can also use the following command to make the script run in the background. This way you will be able to run multiple instances of the script at the same time.

youtube2mp3 "youtube-link" "mp3-file.mp3" > /dev/null &

How it works

The way this script works is really simple. First it downloads the youtube video into a temporary file, converts the video to mp3 and then deletes the temporary file. Let's go through this script step-by-step.

  1. The first line of the script assigns a random .flv filename to the variable $x.

  2. The second line downloads the youtube video into the temporary file named $x. It automatically downloads the HQ version of the video if it's available.

  3. The third line extracts the audio from the video and converts it into an mp3 file with the filename you specified.

  4. The last line removes the temporary file created in step 2.

youtube-dl install from Ubuntu Software Center

youtube-dl is a small command-line program to download videos from YouTube.com and other sites that don't provide direct links to the videos served.

ptheo
  • 1,676
3

You can use jDownloader. You can paste a youtube link and it offers you to download the video and the audio as mp3 separately. You can install jDownloader using the ppa.

sudo add-apt-repository ppa:jd-team/jdownloader
sudo apt-get update
sudo apt-get install jdownloader
1

There is a Add-on Named as Easy youtube downloader , I will use it often to get the Video files as MP3 and you can add that to Firefox and Chrome browsers .

enter image description here

Raja G
  • 102,391
  • 106
  • 255
  • 328
1

Typo alert!!

sudo add-apt-repository ppa:clipgrab-team/ppa sudo apt-get update && sudo apt-get install clipgrab

It should be:

sudo add-apt-repository ppa:clipgrab-team/ppa && sudo apt-get update && sudo apt-get install clipgrab
0

Try "xVideoServiceThief":

http://xviservicethief.sourceforge.net

It can download FLV files and do automated conversion into any desired format.

JPL
  • 116