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.

1
  • I'm looking for the same to use with the mpv plugin for youtube-dl. The best I found so far is to just limit the video resolution (not ideal, I know). Using something like mpv --ytdl-format='bestaudio/[height<=?480]' --no-video --cache-pause-initial=yes ytdl://UnIlSgBrbRM
    – zrajm
    Aug 17, 2022 at 2:07

2 Answers 2

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
2
  • Note: worstvideo, worstaudio, bestvideo, bestaudio formats may be unavailable. In that case, use worst(or best) May 17, 2021 at 16:02
  • As far as I read in the youtube-dl manpage it seems like this would download the file with the worst video AND the file with the worst video and then recombine them. Surely this is not what the OP desires?
    – zrajm
    Aug 17, 2022 at 1:59
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 .

You must log in to answer this question.

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