Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I pass video ID as an argument? #13

Closed
asakura42 opened this issue Mar 29, 2021 · 7 comments
Closed

How can I pass video ID as an argument? #13

asakura42 opened this issue Mar 29, 2021 · 7 comments

Comments

@asakura42
Copy link

I write mpv addon to use sponsorblock with local database and I need to get video IDs. But I didn't found that option in code. So can I pass video ID as an argument?

@trizen
Copy link
Owner

trizen commented Mar 29, 2021

Do you mean passing the YouTube URL directly to mpv?

This can be done by modifying the mpv section in the config-file, to:

 mpv => {
          arg => "--really-quiet *URL*",
          audio => "",
          cmd => "mpv",
          fs => "--fullscreen",
          novideo => "--no-video",
          srt => "--sub-file=*SUB*",
        },

Additionally, there is also the *ID* special token, if needed. For more tokens, see pipe-viewer -T.

@asakura42
Copy link
Author

Thank you.

@trizen
Copy link
Owner

trizen commented Sep 6, 2022

A small hack to no longer pass the *URL* to mpv, but still having sponsorblock working:

  1. Place mpv_sponsorblock_minimal in ~/.config/mpv/scripts.
  2. Add the following entry in the list of urls: "[?&]v=([%w-_]+).*" inside the function file_loaded()

And now in the configuration of pipe-viewer, change the mpv section to:

mpv => {
        arg     => "--really-quiet --force-media-title=*TITLE* --no-ytdl *VIDEO*\\&v=*ID*",
        audio   => "--audio-file=*AUDIO*",
        cmd     => "mpv",
        fs      => "--fullscreen",
        novideo => "--no-video",
        srt     => "--sub-file=*SUB*",
       },

@sun95n
Copy link

sun95n commented Dec 11, 2022

The first method worked for me with pipe-viewer 0.4.4 / mpv 0.32.0 / mpv_sponsorblock I replaced: "--really-quiet --force-media-title=*TITLE* --no-ytdl --no-terminal *VIDEO*", with: "--really-quiet --force-media-title=*TITLE* --no-terminal *URL*",

@bipox
Copy link

bipox commented Aug 16, 2023

The fix works, but now everything plays at max resolution instead of 720p which I use.

@trizen
Copy link
Owner

trizen commented Aug 17, 2023

The fix works, but now everything plays at max resolution instead of 720p which I use.

Try this workaround instead, which allows pipe-viewer to select the resolution.

Otherwise, add in ~/.config/mpv/config the following line:

ytdl-raw-options-append="format-sort=ext,res:720"

@xsoalokinx
Copy link

Does not appear to be working here for me with pipe-viewer, but works with mpv by itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants