-
Notifications
You must be signed in to change notification settings - Fork 37
Document encoder setup and report mpv startup failures #222
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
+125
−1
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Windows encoder setup | ||
|
|
||
| mpv-webm starts a second `mpv.exe` to encode your clip. Windows must be able to | ||
| find it through the `Path` environment variable, even when you open the player | ||
| by double-clicking a video. | ||
|
|
||
| ## 1. Locate mpv | ||
|
|
||
| If needed, get a Windows build from the [mpv installation page](https://mpv.io/installation/). | ||
| Extract the archive into a permanent folder, for example `C:\Tools\mpv`. | ||
| Check that `mpv.exe` is directly inside that folder. Use your actual folder in | ||
| the steps below; do not add the archive or the executable filename to `Path`. | ||
|
|
||
| ## 2. Add that folder to your user Path | ||
|
|
||
| 1. Open **Start**, search for **Edit environment variables for your account**, | ||
| and open that settings dialog. | ||
| 2. Under **User variables for your account**, select **Path**, then **Edit**. | ||
| 3. Click **New** and enter the folder containing `mpv.exe`, for example | ||
| `C:\Tools\mpv`. Keep the existing entries. Do not put quotes around the folder. | ||
| 4. If your account has no `Path` variable yet, click **New** in the User variables | ||
| section, use `Path` as the name and the mpv folder as the value. | ||
| 5. Click **OK** in each dialog to save the change. | ||
|
|
||
| ## 3. Verify and restart the player | ||
|
|
||
| Close existing Command Prompt and mpv windows. Open a **new Command Prompt** | ||
| from Start and run: | ||
|
|
||
| ```bat | ||
| where mpv | ||
| mpv --version | ||
| ``` | ||
|
|
||
| `where mpv` should print the path to your `mpv.exe`, and `mpv --version` should | ||
| print version information. If Windows cannot find it, check that the folder | ||
| from step 2 really contains `mpv.exe` and that the change was saved. | ||
|
|
||
| Open mpv again and try encoding. If a terminal launch works but opening a video | ||
| from Explorer still fails, sign out of Windows and sign back in so Explorer | ||
| and other launchers inherit the updated environment. Restart third-party | ||
| launchers too. File associations alone do not put mpv on `Path`. | ||
|
|
||
| If `where mpv` lists multiple copies, Windows normally selects the first one. | ||
| Check that it is the build you intended to use. | ||
|
|
||
| ## 4. If mpv starts but an encoder is missing | ||
|
|
||
| Run: | ||
|
|
||
| ```bat | ||
| mpv --ovc=help | ||
| mpv --oac=help | ||
| ``` | ||
|
|
||
| These list the video and audio encoders in your mpv build. Select a supported | ||
| format or install an mpv build with the required codec. Installing a separate | ||
| FFmpeg executable does not change the codecs compiled into mpv. | ||
|
|
||
| The message **Cannot start the mpv encoder** points to an executable startup | ||
| problem; the message **mpv encoder failed its startup check** means mpv was | ||
| launched but returned an error. Run `mpv --version` and inspect the player logs | ||
| for the underlying diagnostic. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import os | ||
| import shutil | ||
| import tempfile | ||
|
|
||
| from .base_test_case import BaseTestCase, ROOT | ||
|
|
||
|
|
||
| class TestMissingEncoder(BaseTestCase): | ||
| def setUp(self): | ||
| # Start a real player by absolute path, but make its child mpv lookup | ||
| # fail. This reproduces a desktop launch with an incomplete PATH. | ||
| self.mpv_executable = shutil.which("mpv") | ||
| self.assertIsNotNone(self.mpv_executable) | ||
| empty_path = tempfile.TemporaryDirectory(prefix="mpv-empty-path-") | ||
| self.addCleanup(empty_path.cleanup) | ||
| self.mpv_env = {**os.environ, "PATH": empty_path.name} | ||
| super().setUp() | ||
|
|
||
| def test_missing_encoder_reports_actionable_error_in_all_launch_modes(self): | ||
| self.openTestVideoFile(ROOT / "tests/videos/big_buck_bunny_10s.mp4") | ||
| self.setRange(0, 1) | ||
| for mode in ({"display_progress": False, "run_detached": False, "twopass": False}, | ||
| {"display_progress": True, "run_detached": False, "twopass": False}, | ||
| {"display_progress": False, "run_detached": True, "twopass": False}, | ||
| {"display_progress": False, "run_detached": False, "twopass": True}): | ||
| with self.subTest(mode=mode): | ||
| self.updateScriptOptions({**mode, "output_template": "missing"}) | ||
| event = self.scriptMessage("mpv-webm-encode", event="webm-encode-finished") | ||
| self.assertEqual(event.args[:2], ["webm-encode-finished", "fail"]) | ||
| self.assertIn("Cannot start the mpv encoder", event.args[2]) | ||
| self.assertIn("PATH", event.args[2]) | ||
| self.assertIn("restart the player", event.args[2]) | ||
| self.waitUntil(lambda: event.args[2] in self.getLog(), "actionable encoder error log") | ||
| self.assertFalse((self.tempdir / "missing.webm").exists()) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.