[Tip] Extract the audio from a YouTube video

We can extract the audio from a YouTube video (I have even download the complete video) with a console application, youtube-dl: In Archlinux it is in the Community branch:

# pacman -S youtube-dl

To download the audio from a video only:

$ youtube-dl -x --audio-format vorbis http://www.youtube.com/watch?v=TvwJMa5b1Qg

Necessary ffmpg o avconvand ffprobe o avprobe, and you can choose between the formats:

best #default best acc vorbis mp3 m4a opus wav

To download the video ...

$ youtube-dl http://www.youtube.com/watch?v=TvwJMa5b1Qg

It is also possible to download a video with subtitles (only on Youtube), although I have not tried (when I have time I will) 😀

$ youtube-dl --sub-lang es http://www.youtube.com/watch?v=eRsGyueVLvQ&list=TL7mNcNCIjH6U

To display the list of available subtitles

$ youtube-dl --list-subs http://www.youtube.com/watch?v=eRsGyueVLvQ&list=TL7mNcNCIjH6U

This article has been written in our forum by wadaI just bring it here with some small edits in the text.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

20 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Tesla said

    In Debian it is also in the testing branch: http://packages.debian.org/jessie/youtube-dl
    And as it says, in the squeeze-backports branch. I don't understand why it's not also in wheezy ...

    Anyway, a very good tip to download our favorite videos and / or audios.

    1.    EGR said

      Because Debian is like that. 😀 Interesting tip, especially to be able to listen to «in off».

  2.   King said

    I was looking for some browser extension to do the same thing, but this idea is much better. Thank you very much for sharing it 😀

  3.   Vicente said

    Do you know if it is possible to choose the quality of the downloaded audio with this tool?

    Thank you very much.

    1.    tuxdtk said

      From the terminal: man youtube-dl
      In the «Post-processing Options:» section are all the parameters ...
      -x, –extract-audio
      –Audio-format FORMAT
      –Audio-quality QUALITY

      Without QUALITY I downloaded the mp3 at 105 KBit / ps. With the parameter
      –Audio-quality 192K -> has done it at 192 KBit / s… It implies improvement of the audio quality.

      1.    sieg84 said

        Ideally, just extract the unconverted audio with another tool like ffmpeg.
        - ffmpeg -i input.mkv -acodec
        copy output.m4a (if the audio is in aac)
        thus there is not so much loss of quality.
        otherwise it would be conversion of the conversion.

        1.    tuxdtk said

          So what this does is convert from mp4 to mp3, for example? The title of the article is confusing.

          In dmaciasblog.com he has made a script that downloads the video and then uses ffmpeg to extract the audio, and at the end it deletes the video, thus leaving only the mp3. I think it does what you comment, extracts the audio.

          Link -> http://www.dmaciasblog.com/script-para-bajar-musica-de-youtube/

          It has a video explaining how it works.

          1.    sieg84 said

            that's right, youtube videos use aac codec for audio.
            unless you want to use mp3, if not, the loss of quality due to the re-conversion of the file is irrelevant.
            and yes, the script you mention does the same, it converts to mp3,

      2.    Vicente said

        Thank you very much! What I have not found in the man is how to change the default folder where the downloads go ... I have seen that the .conf can be modified, but these files do not appear on my system (neither via / etc / youtube-dl ... nor in /home/usuario/.config…)


  4.   Alberto said

    I even have a script to do this and rename everything (album, year, theme, song number). What I just realized is that after extracting it I can't modify the labels with amarok and if I try to put it in the soundconverter it doesn't work either ...
    I'm going to have to try mp3 first and then ogg….

    1.    sieg84 said

      you could edit the tags with easytag, or mp3tag but using wine ..

      with amarok I think there is an option for me to save the changes to the file.

      1.    freebsddick said

        I don't know why you should use wine for those programs !!

        1.    sieg84 said

          for mp3tag there is only version for windows, easytag there are some m4a that cannot edit (in my case).

  5.   Paul said

    Too many steps. I use CLIPGRAB, I can search and download YouTube videos and I can even just lower the sound. It is opensource, it comes for Linux, windows and Mac.
    : )

  6.   Javier said

    Hello, as already mentioned ClipGrab is a much more practical option when performing this task.

    The KeepVid website is also very useful, allowing you to download videos in different formats or, which is what is explained in the publication, download only the audio from it.

    A greeting.

    1.    eliotime3000 said

      Keepvid is useful if you use it with the OpenJDK 7 IcedTea plugin (best option), or the Java 7 browser plugin (worst case).

      Anyway, that option is much faster than going to Keepvid.com

  7.   Nebuchadnezzar said

    There is also the option –audio-quality followed by, for example, 128k to extract the audio to 128kbs. It can also be 192 64 or 32k
    I used it in Arch or Manjaro and in Ubuntu (virtual my machine is Debian) but I have noticed that it updates punctually every week and that its logs disappear and that has caused me mistrust also that it is more comfortable to use ffmpeg for the conversion and cclive for download.

    1.    freebsddick said

      The first time I see the word used with the letter h <- written

      1.    eliotime3000 said

        It must be Lapsus Calami, since many times we do not pay attention to the browser's spell checker.

  8.   Brian said

    Thank you very much for the info. I was just needing to do this and the more I can use the console to learn the better! As we are, happy holidays everyone!