I would like to connect to YouTube and read a video only for audio with commands. Is that possible?

  • VLC can play Youtube videos, you should fiddle around with the command line options to disable GUI, video and tell it the correct audio device to use
    – user67289
    Commented Jul 19, 2014 at 20:54

2 Answers 2


To download the audio as mp3, naming the file including the authors name and the video title, use:

youtube-dl -x --audio-format mp3 '<URL>'

For example, to download that interesting talk of Linus on git, and include the uploader's name in the file name (*),

youtube-dl -x --audio-format mp3 --output '%(uploader)s-%(title)s.%(ext)s' 'https://www.youtube.com/watch?v=4XpnKHJAok8'

will save the audio as file
Google-Tech Talk - Linus Torvalds on git.mp3

To date, this needs to download the full video data, and split the audio part off, discarding the images.
But it is expected that it will be possible to download just the audio track soon, with one of the next updates of youtube-dl, combined with changes at the YouTube server side.

youtube-dl then uses ffmpeg to convert the downloaded .m4a file to the .mp3 format.

To make the command line shorter, options can be saved in the config file:

* -x is the short form of --extract-audio

  • It do not work: [download] 100% of size .MiB in time ERROR: ffprobe or avprobe not found. Please install one. I think it is because of ffmpeg.
    – aleroy
    Commented Jul 19, 2014 at 12:35
  • @aleroy Yes, right. (Try apt-get install ffmpeg or equivalent) Commented Jul 19, 2014 at 13:09
  • All this suppose to download the video but what if we do not download it, but we just read it? How can I do that?
    – aleroy
    Commented Jul 19, 2014 at 13:37
  • What do you mean by "just read"? The audio is mixed with the video in one file, so we need to get that file first. Commented Jul 19, 2014 at 13:39
  • Why are you passing in --restrict-filenames? That's not necessary at all. Also note that any recent version of youtube-dl does only download the audio for YouTube videos.
    – phihag
    Commented Jul 19, 2014 at 15:29

You can use youtube-dl -f bestaudio <URL> to download the audio of the video and mplayer to play it.

  • Thank you, but I do not have mplayer, and I don't want to install it. Do you know one that is already installed on OS X Mavericks?
    – aleroy
    Commented Jul 19, 2014 at 12:40
  • aleroy, you will need to install something, why not mplayer?
    – Alexander
    Commented Jul 19, 2014 at 15:32
  • @Alexander I finally did it, the website did not makes me trust it. But whatever, how can I now put this in background? (not suspended with Ctrl+Z)
    – aleroy
    Commented Jul 19, 2014 at 20:57
  • just type bg after pressing ctrl-z, or better, use tmux
    – Alexander
    Commented Jul 20, 2014 at 0:09
  • 1
    @Alexander thank you, I discovered Tmux and it is very powerful.
    – aleroy
    Commented Jul 27, 2014 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .