4 ms·
A very nice utility to have installed. It can also convert a video to an mp3: youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=OK
by nklas 12y ago
A very nice utility to have installed.
It can also convert a video to an mp3:
youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=OKbtC223e30 https://www.youtube.com/watch?v=OKbtC223e30
- anw 12y agoOr even shorter: youtube-dl -x --audio-format mp3 OKbtC223e30
- Strom 12y agoIn general youtube-dl is great, but that short id input handling is broken, as evidenced by this: youtube-dl -x --audio-format mp3 -fCtvurGDD8
- rossy 12y agoBecause it interprets video IDs that start with a dash as short options? This should be better: youtube-dl -x --audio-format mp3 -- -fCtvurGDD8
- ekimekim 12y agoLike many tools, youtube-dl supports a -- flag to indicate "the remaining arguments are not flags". So your example would work as: youtube-dl -x --audio-format mp3 -- -fCtvurGDD8
- phihag_ 12y agoAs others have pointed out, you'll need -- in this case. However, there's really no reason why youtube-dl should not detect this common problem (we also try to detect when users forget to quote URLs with ampersands). Update to youtube-dl 2014.11.23.1 or newer and try this again ;) By the way, the GitHub issue tracker (https://yt-dl.org/bug https://yt-dl.org/bug ) is usually a better place to report issues. But just for youtube-dl reaching #1 on HN, I'll make an exception.
- shmerl 12y agoConverting it to MP3 is a bad idea. Youtube uses other lossy codecs inside, such as Vorbis and AAC. So reencoding it will degrade the quality. The best option is to keep the audio as is.
- spain 12y agoAccording to the docs it formats them as "best" by default. --audio-quality QUALITY "best", "aac", "vorbis", "mp3", "m4a", "opus", or "wav"; "best" by default
- rossy 12y agoWhen you convert audio from a lossy format to a lossy format (from YouTube's native AAC streams to MP3,) you always end up with worse quality than the original, regardless of the encoding settings. Since pretty much everything can play AAC, there's no point in converting it in the first place. Just remove --audio-format mp3, and you'll get an .m4a straight from YouTube with no conversion step.
- rational-future 12y agoThat's right, usually the best quality audio you can get from youtube is in m4a format. The only problem I'm having is youtube sets the format inside the m4a to dash, which some stupid players (including iTunes) don't want to play. So I have to run something like ffmpeg.exe -i "Keith Wiley - The Fermi Paradox, Self-Replicating Probes, Interstellar Transport Bandwidth-AUk6ZlePtQA.m4a" -c:a copy 2.m4a to change the format in the file header to M4A.
- zuck9 12y ago> youtube-dl -F OKbtC223e30 139 m4a audio only DASH audio 49k , audio@ 48k (22050Hz), 525.88KiB (worst) 171 webm audio only DASH audio 129k , audio@128k (44100Hz), 1.27MiB 140 m4a audio only DASH audio 129k , audio@128k (44100Hz), 1.36MiB 172 webm audio only DASH audio 176k , audio@256k (44100Hz), 1.78MiB 141 m4a audio only DASH audio 255k , audio@256k (44100Hz), 2.71MiB Just use youtube-dl -f 141 to direct download just the audio from YouTube. I always use this to download songs.
- phihag_ 12y agoWhile -f 141 is of course perfectly fine, may I suggest -f bestaudio ? That should work fine for non-YouTube sites (soundcloud or so), and will get you a better version should YouTube one day add it. If you really prefer 141, you can also use -f 141/bestaudio to fall back to bestaudio if 141 is unavailable.
- zuck9 12y agoThat'll come in handy. I always used -F to find out what is highest # for downloading audio.
- colomon 12y agoHmmm, can you add the --audio-format mp3 to ~/.config/youtube-dl.conf without breaking normal video downloads? (Edit) Answering my own question, apparently yes!