News for hackers. Stuff that matters.
Re:Youtube-dl by nklas on Sunday November 23, 2014 @02:47AM (#8648106)
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

Re:Youtube-dl by zuck9 on Sunday November 23, 2014 @05:14AM (#8648330)

  > 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.
Re:Youtube-dl by phihag_ on Sunday November 23, 2014 @05:26AM (#8648351)
While -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.
Re:Youtube-dl by zuck9 on Sunday November 23, 2014 @07:05AM (#8648540)
That'll come in handy. I always used -F to find out what is highest # for downloading audio.
Re:Youtube-dl by shmerl on Sunday November 23, 2014 @03:32AM (#8648183)
Converting 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.
Re:Youtube-dl by spain on Sunday November 23, 2014 @05:12AM (#8648327)
According to the docs it formats them as "best" by default.

    --audio-quality QUALITY

    "best", "aac", "vorbis", "mp3", "m4a", "opus", or "wav"; "best" by default
Re:Youtube-dl by rossy on Sunday November 23, 2014 @08:00AM (#8648659)
When 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.
Re:Youtube-dl by rational-future on Sunday November 23, 2014 @08:32AM (#8648734)
That'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.

Re:Youtube-dl by stinos on Sunday November 23, 2014 @11:18AM (#8649100)
Winamp and VLC also don't play these..
Re:Youtube-dl by shmerl on Sunday November 23, 2014 @02:05PM (#8649531)
By the way, is DASH a free technology, or it's patent encumbered like the rest of the MPEG stuff?
Re:Youtube-dl by colomon on Sunday November 23, 2014 @11:25AM (#8649112)
Hmmm, can you add the --audio-format mp3 to ~/.config/youtube-dl.conf without breaking normal video downloads?

(Edit) Answering my own question, apparently yes!

Re:Youtube-dl by anw on Sunday November 23, 2014 @02:51AM (#8648112)
Or even shorter:

youtube-dl -x --audio-format mp3 OKbtC223e30

Re:Youtube-dl by Strom on Sunday November 23, 2014 @02:56AM (#8648121)
In general youtube-dl is great, but that short id input handling is broken, as evidenced by this:

  youtube-dl -x --audio-format mp3 -fCtvurGDD8
Re:Youtube-dl by phihag_ on Sunday November 23, 2014 @04:55AM (#8648307)
As 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 ) is usually a better place to report issues. But just for youtube-dl reaching #1 on HN, I'll make an exception.

Re:Youtube-dl by ekimekim on Sunday November 23, 2014 @03:09AM (#8648141)
Like 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
Re:Youtube-dl by rossy on Sunday November 23, 2014 @03:08AM (#8648140)
Because it interprets video IDs that start with a dash as short options? This should be better:

  youtube-dl -x --audio-format mp3 -- -fCtvurGDD8