The generated command line for encoding contains varies parameters, where a bunch of --vf-add were added via get_video_encode_flags() function (in src/encode.moon). While filters for contrast/saturation/brightness/etc. always work, apply_current_filters() can meet edge cases. And in my case, it's something like:
Note the space in path, which ultimately break the workflow in Windows.
The log:
[ 9.765][v][webm] Command failed! Reason: nil Killed by us? no
And if I ran the command manually, mpv threw error messages like this:
Invalid length 51 for 'file'
Error parsing option vf-add (option parameter could not be parsed)
Setting commandline option --vf-add=vapoursynth:file=%51%C:\Users\End failed.
Exiting... (Fatal error)
Apparently, special chars like space break mpv argument parsing in Windows. A little bit of digging and I found its manual page about arguments handling, so I manually ran it as
if string.find(v, " ") then
v = "\"" .. v .. "\""
end
And encoding... well, let's say just didn't break. However, when checking logs, vapoursynth's just silently skipped:
[ 7.875][v][webm] [vapoursynth] Script evaluation failed:
[ 7.875][v][webm] [vapoursynth] File reading exception:
[ 7.875][v][webm] [vapoursynth] [Errno 22] Invalid argument: '"C:\\Users\\End User\\Documents\\src\\vs\\preprocessing.py"'
[ 7.875][v][webm] [vapoursynth] could not init VS
[ 7.875][v][webm] Disabling filter vapoursynth.00 because it has failed.
Now it converts to another problem. /facepalm
Anyway, here's how to reproduce the original issue, in case interested:
Reproduction
Prepare a Windows environment, a working mpv compiled with vapoursynth support (with webm.lua and logging set up in mpv.conf), and a video file for playback.
Create C:\a test.py with following content:
video_in.set_output()
run mpv "--vf-add=vapoursynth:file=%12%C:\a test.py" "C:\sample_video.mp4"
encode with webm.lua
encode fails in OSD and log from mpv contains [webm] Command failed! Reason: nil Killed by us? no
mpv version and platform
On Windows 11 21H2 22000.282
Description
The generated command line for encoding contains varies parameters, where a bunch of
--vf-add
were added viaget_video_encode_flags()
function (insrc/encode.moon
). While filters for contrast/saturation/brightness/etc. always work,apply_current_filters()
can meet edge cases. And in my case, it's something like:Note the space in path, which ultimately break the workflow in Windows. The log:
And if I ran the command manually, mpv threw error messages like this:
Apparently, special chars like space break mpv argument parsing in Windows. A little bit of digging and I found its manual page about arguments handling, so I manually ran it as
And
Both way works. I then add following to here
And encoding... well, let's say just didn't break. However, when checking logs, vapoursynth's just silently skipped:
Now it converts to another problem. /facepalm
Anyway, here's how to reproduce the original issue, in case interested:
Reproduction
C:\a test.py
with following content:mpv "--vf-add=vapoursynth:file=%12%C:\a test.py" "C:\sample_video.mp4"
[webm] Command failed! Reason: nil Killed by us? no