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.
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
worstvideo
, worstaudio
, bestvideo
, bestaudio
formats may be unavailable. In that case, use worst
(or best
)
May 17, 2021 at 16:02
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?
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
.
mpv
plugin foryoutube-dl
. The best I found so far is to just limit the video resolution (not ideal, I know). Using something likempv --ytdl-format='bestaudio/[height<=?480]' --no-video --cache-pause-initial=yes ytdl://UnIlSgBrbRM