How to play youtube song in terminal with ffplay and youtube-dl

Is there any you to stream any music the terminal with youtube-dl and ffplay I know that ffplay can play audio with shell $ audio stram | ffplay -i -

Upvotes: 5

Views: 4079

Answers (2)

Sanaf
Sanaf

Reputation: 364

You can try this:

youtube-dl -f bestaudio  ytsearch:"SONG NAME" -o - 2>/dev/null | ffplay -nodisp -autoexit -i - &>/dev/null

Or:

youtube-dl -f bestaudio VIDEO_URL -o - 2>/dev/null | ffplay -nodisp -autoexit -i - &>/dev/null

Upvotes: 5

Stefan Sjöberg
Stefan Sjöberg

Reputation: 183

..and if you mordernize the command a little you can play YT-videos from the terminal without ads.

youtube-dl -f mp4 YOUTUBE_VIDEO_URL -o - 2>/dev/null | ffplay -autoexit -i - &>/dev/null

Due to YouTube at the moment are throttlening youtube-dl I'm now using yt-dlp instead. Same codebase but no throttlening :)

yt-dlp -f mp4 YOUTUBE_VIDEO_URL -o - 2>/dev/null | ffplay -autoexit -i - &>/dev/null

Upvotes: 0

Related Questions