Play music from youtube without download

wget -q -O - `youtube-dl -b -g $url`| ffmpeg -i - -f mp3 -vn -acodec libmp3lame -| mpg123 -
Sample Output
torrid@siebot ~ $ wget -q -O - `youtube-dl -b -g`| ffmpeg -i - -f mp3 -vn -acodec libmp3lame - 2>/dev/null | mpg123  -
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
        version 1.9.0; written and copyright by Michael Hipp and others
        free software (LGPL/GPL) without any warranty but with best wishes

Playing MPEG stream 1 of 1: - ...
MPEG 1.0 layer III, 64 kbit/s, 44100 Hz joint-stereo

By: torrid
2009-11-07 13:45:13

1 Alternatives + Submit Alt

What Others Think

JollyJumper · 659 weeks ago
there's those backticks again... i swear we'll never rid ourselves of them
atoponce · 658 weeks and 6 days ago
ffmpeg is giving error: "Unknown encoder 'libmp3lame' " Which package contains this codec?
alperyilmaz · 658 weeks and 4 days ago
@alperyilmaz which *nix flavour? The lib of the lame command is actually, so the package is probably lame. To make ffmpeg use it, you have to compile it with --enable-mp3lame. @atoponce I read all about evil backticks, and I'll try to avoid them now.^^
torrid · 658 weeks and 4 days ago
How to extend this to download file directly with the name of the file matching the name on youtube title?
unixmonkey8504 · 642 weeks and 5 days ago
Technically, you're still downloading.
tommytwoeyes · 380 weeks and 4 days ago
us mpv! and forget that commands!
zodman · 302 weeks and 1 day ago
This is also what I look for in terms of music. Youtube Premium apk is what I want to mention for you
Cleopatra2021 · 33 weeks ago
You can listen to music through the website for free at
BlancheAurora · 13 weeks and 1 day ago
Honestly speaking, I have always had a dream to be a little more popular and it came true. In the past, I could not find something suitable for me, but my friend decided to advise me to buy spotify followers. How I can use it in my profile, interact with the public and live a good social life. I think that's really cool thing.
Colin80Duncan · 5 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: