I would like to connect to YouTube and read a video only for audio with commands. Is that possible?
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
To make the command line shorter, options can be saved in the config file:
-x is the short form of
You can use
youtube-dl -f bestaudio <URL> to download the audio of the video and
mplayer to play it.