Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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 Jul 19 '14 at 20:54
up vote 13 down vote accepted

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

share|improve this answer
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 Jul 19 '14 at 12:35
@aleroy Yes, right. (Try apt-get install ffmpeg or equivalent) – Volker Siegel Jul 19 '14 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 Jul 19 '14 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. – Volker Siegel Jul 19 '14 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 Jul 19 '14 at 15:29

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

share|improve this answer
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 Jul 19 '14 at 12:40
aleroy, you will need to install something, why not mplayer? – Alexander Jul 19 '14 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 Jul 19 '14 at 20:57
just type bg after pressing ctrl-z, or better, use tmux – Alexander Jul 20 '14 at 0:09
@Alexander thank you, I discovered Tmux and it is very powerful. – aleroy Jul 27 '14 at 14:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.