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

Automatically create an mpv.conf file so that the system does not use the user's own mpv.conf file #670

Closed
DeltaForCain opened this issue Aug 16, 2021 · 3 comments
Labels
enhancement New feature or request working on it

Comments

@DeltaForCain
Copy link

When using mpv already, most users will have an mpv.conf (likely in %appdata%/mpv/), that gets read first.
If that mpv.conf has somewhat niche options, the Lively mpv option will show a blue screen instead of the video file. I believe the culprit option to be running Vulkan as the video renderer.

Putting a default, minimal config into the folder mentioned here solves this issue neatly without interfering with the user's regular mpv install.

As such, I believe an mpv.conf with minimal options (I use profile=gpu-hq and hwdec=auto only) should be created automatically on install (if there is not yet one at that location already) to avoid running into this issue at all.

@DeltaForCain DeltaForCain added the enhancement New feature or request label Aug 16, 2021
@rocksdanister
Copy link
Owner

rocksdanister commented Aug 16, 2021

As such, I believe an mpv.conf with minimal options (I use profile=gpu-hq and hwdec=auto only) should be created automatically on install (if there is not yet one at that location already) to avoid running into this issue at all.

No, I would prefer the config be handled by Lively itself:

var scalerArg = scaler switch
{
WallpaperScaler.none => "--video-unscaled=yes",
WallpaperScaler.fill => "--keepaspect=no",
WallpaperScaler.uniform => "--keepaspect=yes",
WallpaperScaler.uniformFill => "--panscan=1.0",
//WallpaperScaler.auto => "--keepaspect-window=no",
_ => "--keepaspect=no",
};
ipcServerName = "mpvsocket" + Path.GetRandomFileName();
StringBuilder cmdArgs = new StringBuilder();
//startup volume will be 0
cmdArgs.Append("--volume=0 ");
//disable window decorations
//cmdArgs.Append("--no-border ");
//alternative: --loop-file=inf
cmdArgs.Append("--loop-file ");
//do not close after media end
cmdArgs.Append("--keep-open ");
//open window at (-9999,0)
cmdArgs.Append("--geometry=-9999:0 ");
//always create gui window
cmdArgs.Append("--force-window=yes ");
//don't move the window when clicking
cmdArgs.Append("--no-window-dragging ");
//don't hide cursor after sometime.
cmdArgs.Append("--cursor-autohide=no ");
//allow windows screensaver
cmdArgs.Append("--stop-screensaver=no ");
//disable mpv default (built-in) key bindings
cmdArgs.Append("--input-default-bindings=no ");
//video stretch algorithm
cmdArgs.Append(scalerArg + " ");
//on-screen-controller visibility
cmdArgs.Append(!onScreenControl ? "--no-osc " : " ");
//alternative: --input-ipc-server=\\.\pipe\
cmdArgs.Append("--input-ipc-server=" + ipcServerName + " ");
//integer scaler for sharpness
cmdArgs.Append(model.LivelyInfo.Type == WallpaperType.gif ? "--scale=nearest " : " ");
//gpu decode preference
cmdArgs.Append(Program.SettingsVM.Settings.VideoPlayerHwAccel ? "--hwdec=auto-safe " : "--hwdec=no ");
//screenshot location, important read: https://mpv.io/manual/master/#pseudo-gui-mode
cmdArgs.Append("--screenshot-template=" + "\"" + Path.Combine(Program.AppDataDir, "temp", ipcServerName) + "\" --screenshot-format=jpg ");
//file or online video stream path
cmdArgs.Append(model.LivelyInfo.Type == WallpaperType.videostream ? Helpers.StreamHelper.YoutubeDLMpvArgGenerate(streamQuality, path) : "\"" + path + "\"");

or C:\Users\<UserName>\AppData\Local\Lively Wallpaper\mpv\mpv.conf file if present.

Creating auto-file may conflict with some of the Lively settings in the future due to human error etc..

https://mpv.io/manual/stable/#legacy-auto-profiles

Depending on what you do, passing --no-config or --config-dir may be a good idea to avoid conflicts with the normal mpv user configuration intended for CLI playback.

I think this approach would be better.

@DeltaForCain
Copy link
Author

Passing --no-config might also work I presume, or specifying the folder where to look for the config.

Good idea and thank you for the quick response!

@rocksdanister
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request working on it
Projects
None yet
Development

No branches or pull requests

2 participants