Can't play youtube url in mpv command line

Good day.

I am trying to play youtube via mpv on the terminal and can’t play it. I already have youtube-dl but the line mpv https://www.youtube.com/watch?v=XnzxEGLaPxs --no-video is not working.

am I missing something?

thanks.

If you’re using zsh you need to quote it:

 mpv "https://www.youtube.com/watch?v=XnzxEGLaPxs" --no-video

Otherwise post the output.

hi. I tried this but nothing happens. It doesn’t comeback in the prompt. I just <ctrl+C> it.

How long do you wait? Do you have a slow connection?

more than 2 minutes sir. I have a decent connection.

Try this:

mpv "https://www.youtube.com/watch?v=XnzxEGLaPxs" -v

it says here in the end:

[ytdl_hook] full hook [ytdl_hook] No youtube-dl found with path yt-dlp in config directories [ytdl_hook] youtube-dl with path yt-dlp not found in PATH or not enough permissions [ytdl_hook] No youtube-dl found with path yt-dlp_x86 in config directories [ytdl_hook] youtube-dl with path yt-dlp_x86 not found in PATH or not enough permissions [ytdl_hook] No youtube-dl found with path youtube-dl in config directories

I don’t have youtube-dl installed, but yt-dlp and it works here. Just tested. So try installing that.

pamac install yt-dlp

To install it from the community repository.

Perhaps it works.

3 Likes

There should be another check in PATH for youtube-dl, that’s where mine is found.

...
[ytdl_hook] full hook 
[ytdl_hook] No youtube-dl found with path yt-dlp in config directories 
[ytdl_hook] youtube-dl with path yt-dlp not found in PATH or not enough permissions 
[ytdl_hook] No youtube-dl found with path yt-dlp_x86 in config directories 
[ytdl_hook] youtube-dl with path yt-dlp_x86 not found in PATH or not enough permissions 
[ytdl_hook] No youtube-dl found with path youtube-dl in config directories 
[ytdl_hook] Found youtube-dl with path youtube-dl in PATH 
[ytdl_hook] youtube-dl succeeded! 
...

If you don’t get that far then as @Mirdarthos said yt-dlp should be found, since we can see it checks for it first.

How did you install youtube-dl?

Same. Always had yt-dlp installed.

mpv with or without --no-video works on the YouTube link you provided.

yt-dlp is preferred over youtube-dl. It’s a forked version that has more active maintenance, features, and supported sites.

2 Likes

I installed it like this:

yay -S youtube-dl

:point_down:


EDIT: Marking @Mirdarthos post as the solution instead, since it was first posited. (Yes, “posited”. It’s a cool word that is not used enough.) :sunglasses:

2 Likes

thank you so much guys!
it works now. i followed all of your instructions and just… wait. maybe because of the connection.

I would also remove youtube-dl if you haven’t already. You’re better off sticking with only yt-dlp from now on.

I’m not entirely sure of what’s going on in the background, but unlike streaming with VLC, I believe when mpv uses the yt-dlp hook to play YouTube videos, it needs to download enough of the video to your local cache before it starts to play anything. I don’t believe it uses the same streaming method as does VLC.

thanks. I’ll remove it.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.