2

I have a slow connection, and I just want to extract audio from YouTube with youtube-dl.

Thus, my goal is to download and the extract the best quality audio, while downloading the smallest video format available, which gets disposed of anyway.

meskobalazs
  • 3,103
Anon
  • 12,339

2 Answers2

1

If you just want to extract audio, youtube-dl has an option specifically for that, --extract-audio.

From this answer:

You can also download the mp3 directly from youtube without converting using ffmpeg

youtube-dl --extract-audio --audio-format mp3 <video URL>

From the online help:

-x, --extract-audio        convert video files to audio-only files (requires
                           ffmpeg or avconv and ffprobe or avprobe)

Bear in mind as well that youtube-dl defaults to using avconv so you should consider specifying either avconv or FFmpeg at the commandline . From the online help :

--prefer-avconv                  Prefer avconv over ffmpeg for running the
                                 postprocessors (default)
--prefer-ffmpeg                  Prefer ffmpeg over avconv for running the
                                 postprocessors

Further options for keeping the original video, adjusting the bitrate or quality of the audio and a few others can be seen by looking at youtube-dl -h .

Dragonfang
  • 111
  • 3
1

I don't know if it's actually implemented, but this could work:

youtube-dl -f worstvideo+bestaudio www.youtube.com/watch?v=dQw4w9WgXcQ

or

youtube-dl -f worst+bestaudio www.youtube.com/watch?v=dQw4w9WgXcQ
meskobalazs
  • 3,103