Thann / play-with-mpv

Chrome extension that allows you to play videos in webpages like youtube with MPV instead
https://chrome.google.com/webstore/detail/play-with-mpv/hahklcmnfgffdlchjigehabfbiigleji
The Unlicense
349 stars 80 forks source link

How to pass youtube-dl preferences? #22

Closed akosyrev closed 5 years ago

akosyrev commented 5 years ago

Hi Jon

I have installed play-with-mpv and youtube-dl

sudo pip install git+git://github.com/thann/play-with-mpv sudo pip install youtube-dl

and installed plugin for chrome. Also I created config file for youtube-dl:

cat ~/.config/youtube-dl/config -f bestvideo[height<=?1080]+bestaudio/best

as I don't want to get highest video quality, FullHD is enough.

But when I play some High Quality videos, youtube-dl chooses highest resolution, so my config file was ignored:

$ play-with-mpv serving at port 7531 ['play_url', 'https://www.youtube.com/watch?v=Bey4XXJAqS8'] 127.0.0.1 - - [10/Jun/2019 19:22:38] "GET /?play_url=https://www.youtube.com/watch?v=Bey4XXJAqS8 HTTP/1.1" 200 - Playing: https://www.youtube.com/watch?v=Bey4XXJAqS8 (+) Video --vid=1 () (vp9 3840x2160 29.970fps) (+) Audio --aid=1 --alang=eng () 'DASH audio' (opus 2ch 48000Hz) (external) Subs --sid=1 --slang=en 'vtt' (webvtt) (external) AO: [pulse] 48000Hz stereo 2ch float VO: [gpu] 3840x2160 yuv420p AV: 00:00:03 / 00:29:36 (0%) A-V: 0.000 Cache: 33s+51MB

Do you know how to fix this?

Thann commented 5 years ago

You want to pass the options through MPV like this: mpv "https://www.youtube.com/watch?v=LXb3EKWsInQ" "--ytdl-format=bestvideo[height<=?1080]+bestaudio/best"

You can hack the server to add the argument on this line: https://github.com/Thann/play-with-mpv/blob/master/play_with_mpv.py#L39

I'm planning on adding an "options" page to the extension to make this easier for everyone =]

Thann commented 5 years ago

Actually I'm going to keep this open until I release that feature

Thann commented 5 years ago

You can now set this in the options GUI =]