Skip to content

Instantly share code, notes, and snippets.

@stereosupersonic
Created November 16, 2010 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stereosupersonic/701919 to your computer and use it in GitHub Desktop.
Save stereosupersonic/701919 to your computer and use it in GitHub Desktop.
convert youtube videos to mp3 on OSX
#!/usr/bin/ruby
#example:
# youtube2mp3 EzgGTTtR0kc
VLC = "/Applications/VLC.app/Contents/MacOS/VLC"
youtube_id = ARGV.first || STDIN.read
raise "no youtube id is given" unless youtube_id
system "#{VLC} -I dummy http://www.youtube.com/watch?v=#{youtube_id}
--sout='#transcode{acodec=mp3,vcodec=dummy}:standard{access=file,mux=raw,dst=\"#{youtube_id}.mp3\"}' vlc://quit"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment