Skip to content

Add option to run mpv command on successful encode #206

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

Merged
merged 1 commit into from
Jul 14, 2025

Conversation

defaultxr
Copy link
Contributor

@defaultxr defaultxr commented Jul 14, 2025

This PR adds an option completion_command, which, when set, will cause mpv-webm to run the specified mpv command when the encoding completes successfully.

The string %{output} will be replaced with the path to the output file.

This may be useful, for example, to automatically copy the path to the system clipboard, i.e.:

completion_command=set "clipboard/text" "%{output}"

(Note that set "clipboard/text" only works on Windows, Wayland, and macOS).

Alternatively, if you have a script that copies its arguments to the clipboard (as I do, since I use X11):

completion_command=run "script-for-copying-args-to-clipboard" "%{output}"

(Unfortunately, xclip and xsel don't seem to have the ability to copy from arguments, and I'd rather not invoke a subshell if possible just for piping to their stdin. Thus I wrote a small script that pipes into them itself, from its arguments. I find this a cleaner and less hacky solution, personally.)

`%{output}` will be replaced with the path to the output file.

This may be useful, for example, to automatically copy the path to the
system clipboard, i.e.:

`set "clipboard/text" "%{output}"`

(note that `set clipboard/text` only works on Windows, Wayland, and
macOS)

or, if you have a script that copies its arguments to the clipboard:

`run "script-for-copying-args-to-clipboard" "%{output}"`
@ekisu
Copy link
Owner

ekisu commented Jul 14, 2025

looks good

@ekisu ekisu merged commit e152345 into ekisu:master Jul 14, 2025
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

Successfully merging this pull request may close these issues.

2 participants