Repository: streamlink/streamlink

Issue:
Streamlink cannot find player executable on Windows 11
### Checklist

- [X] This is a bug report and not [a different kind of issue](https://github.com/streamlink/streamlink/issues/new/choose)
- [X] [I have read the contribution guidelines](https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink)
- [X] [I have checked the list of open and recently closed bug reports](https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22bug%22)
- [X] [I have checked the commit log of the master branch](https://github.com/streamlink/streamlink/commits/master)

### Streamlink version

6.5.0

### Description

On Windows 11, build 22631, I'm trying to use Streamlink with MPC-HC64, but it cannot find the player executable despite being copy pasted into configuration as shown in the image.

![image](https://i.imgur.com/024PsVz.png)

This worked some small number of months ago.

### Debug log

```text
PS C:\Users\anthony> streamlink https://www.youtube.com/watch?v=grdawJ3icdA best --loglevel=debug
[cli][debug] OS:         Windows 10
[cli][debug] Python:     3.11.7
[cli][debug] OpenSSL:    OpenSSL 3.0.11 19 Sep 2023
[cli][debug] Streamlink: 6.5.0
[cli][debug] Dependencies:
[cli][debug]  certifi: 2023.11.17
[cli][debug]  isodate: 0.6.1
[cli][debug]  lxml: 4.9.3
[cli][debug]  pycountry: 23.12.11
[cli][debug]  pycryptodome: 3.19.0
[cli][debug]  PySocks: 1.7.1
[cli][debug]  requests: 2.31.0
[cli][debug]  trio: 0.23.2
[cli][debug]  trio-websocket: 0.11.1
[cli][debug]  typing-extensions: 4.9.0
[cli][debug]  urllib3: 2.1.0
[cli][debug]  websocket-client: 1.7.0
[cli][debug] Arguments:
[cli][debug]  url=https://www.youtube.com/watch?v=grdawJ3icdA
[cli][debug]  stream=['best']
[cli][debug]  --loglevel=debug
[cli][debug]  --player="C:\Program Files (x86)\K-Lite Codec Pack\MPC-HC64\mpc-hc64.exe"
[cli][debug]  --ffmpeg-ffmpeg=C:\Program Files\Streamlink\ffmpeg\ffmpeg.exe
[cli][info] Found matching plugin youtube for URL https://www.youtube.com/watch?v=grdawJ3icdA
[plugins.youtube][debug] Using video ID: grdawJ3icdA
[stream.ffmpegmux][debug] ffmpeg version n6.1-20231112 Copyright (c) 2000-2023 the FFmpeg developers
[stream.ffmpegmux][debug]  built with gcc 13.2.0 (crosstool-NG 1.25.0.232_c175b21)
[stream.ffmpegmux][debug]  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20231112
[stream.ffmpegmux][debug]  libavutil      58. 29.100 / 58. 29.100
[stream.ffmpegmux][debug]  libavcodec     60. 31.102 / 60. 31.102
[stream.ffmpegmux][debug]  libavformat    60. 16.100 / 60. 16.100
[stream.ffmpegmux][debug]  libavdevice    60.  3.100 / 60.  3.100
[stream.ffmpegmux][debug]  libavfilter     9. 12.100 /  9. 12.100
[stream.ffmpegmux][debug]  libswscale      7.  5.100 /  7.  5.100
[stream.ffmpegmux][debug]  libswresample   4. 12.100 /  4. 12.100
[stream.ffmpegmux][debug]  libpostproc    57.  3.100 / 57.  3.100
[plugins.youtube][debug] MuxedStream: v 137 a 251 = 1080p
[plugins.youtube][debug] MuxedStream: v 135 a 251 = 480p
[plugins.youtube][debug] MuxedStream: v 133 a 251 = 240p
[plugins.youtube][debug] MuxedStream: v 160 a 251 = 144p
[cli][info] Available streams: audio_mp4a, audio_opus, 144p (worst), 240p, 360p, 480p, 720p, 1080p (best)
[cli][info] Opening stream: 1080p (muxed-stream)
[cli][info] Starting player: "C:\Program Files (x86)\K-Lite Codec Pack\MPC-HC64\mpc-hc64.exe"
[stream.ffmpegmux][debug] Opening http substream
[stream.ffmpegmux][debug] Opening http substream
[utils.named_pipe][info] Creating pipe streamlinkpipe-25744-1-7320
[utils.named_pipe][info] Creating pipe streamlinkpipe-25744-2-2945
[stream.ffmpegmux][debug] ffmpeg command: C:\Program Files\Streamlink\ffmpeg\ffmpeg.exe -nostats -y -i \\.\pipe\streamlinkpipe-25744-1-7320 -i \\.\pipe\streamlinkpipe-25744-2-2945 -c:v copy -c:a copy -map 0 -map 1 -f matroska pipe:1
[stream.ffmpegmux][debug] Starting copy to pipe: \\.\pipe\streamlinkpipe-25744-1-7320
[stream.ffmpegmux][debug] Starting copy to pipe: \\.\pipe\streamlinkpipe-25744-2-2945
[cli][debug] Pre-buffering 8192 bytes
[warnings][streamlinkwarning] The --player argument has been changed and now only takes player path values:
  Player paths with spaces don't have to be wrapped in quotation marks anymore.
  Custom player arguments need to be set via --player-args.
error: Failed to start player: "C:\Program Files (x86)\K-Lite Codec Pack\MPC-HC64\mpc-hc64.exe" (Player executable not found)
[cli][info] Closing currently open stream...
[stream.ffmpegmux][debug] Closing ffmpeg thread
[stream.ffmpegmux][debug] Pipe copy complete: \\.\pipe\streamlinkpipe-25744-1-7320
[stream.ffmpegmux][debug] Pipe copy complete: \\.\pipe\streamlinkpipe-25744-2-2945
[stream.ffmpegmux][debug] Closed all the substreams
PS C:\Users\anthony>
```



Discussion:
It looks like quotes are not optional now (even if not by explicit design); using a path without quotes seems to work for me, but with quotes does not.

Does without quotes work for you?
Hah, you nailed it right on the head.

Yep, that fixed it. I removed the quotes from my config file and it launched correctly.

Thanks!
More recent versions of Streamlink for Windows install an initial default config that does not include quoted paths in the commented-out example  `player` options.

I will reopen this, as the warning message leaves open the possibility that quotes may still be used even if unnecessary, therefore, either the message should be changed or the failure when quotes are used should be investigated and possibly fixed.

> it cannot find the player executable despite being copy pasted into configuration as shown in the image.

Please read the 6.0.0 changelog and the migration guide:

- https://streamlink.github.io/changelog.html#streamlink-6-0-0-2023-07-20
- https://streamlink.github.io/migrations.html#streamlink-6-0-0

Streamlink's Windows installer never updates the user's config file. You however have the option to overwrite it with a new config file.
https://github.com/streamlink/windows-builds#notes

> or the failure when quotes are used should be investigated and possibly fixed

This can't be fixed, as explained in https://github.com/streamlink/streamlink/issues/5305#issuecomment-1527696916

We can change the warning message though: `s/don't have to/must not/`

Resolving patch:
diff --git a/src/streamlink_cli/output/player.py b/src/streamlink_cli/output/player.py
--- a/src/streamlink_cli/output/player.py
+++ b/src/streamlink_cli/output/player.py
@@ -235,8 +235,11 @@ def _open(self):
                 warnings.warn(
                     "\n".join([
                         "The --player argument has been changed and now only takes player path values:",
-                        "  Player paths with spaces don't have to be wrapped in quotation marks anymore.",
-                        "  Custom player arguments need to be set via --player-args.",
+                        "  Player paths must not be wrapped in additional quotation marks",
+                        "  and custom player arguments need to be set via --player-args.",
+                        "  This is most likely caused by using an old config file from an ealier Streamlink version.",
+                        "  Please see the migration guides in Streamlink's documentation:",
+                        "  https://streamlink.github.io/migrations.html#player-path-only-player-cli-argument",
                     ]),
                     StreamlinkWarning,
                     stacklevel=1,


Test patch: