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 -
Asked
Active
Viewed 1,881 times
4
2 Answers
4
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

Sanaf
- 336
- 3
- 13
-
1Can you please explain this command? I know the basic usage of youtube-dl. – codingbruh Oct 31 '22 at 19:36
-
1https://linuxhint.com/what_is_dev_null/ This was interesting I didn't know it. Thanks – codingbruh Oct 31 '22 at 19:56
-
1In this case youtube-dl not writing the downloaded data to a file instead it's piping it to ffplay to play directly. – Sanaf Nov 01 '22 at 10:13
0
..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

Stefan Sjöberg
- 83
- 1
- 1