Av1an icon indicating copy to clipboard operation
Av1an copied to clipboard

Allow specially formatted vmaf_path on Windows

Open kripod opened this issue 4 years ago • 12 comments

Due to some issues documented in the Netflix/vmaf repository, the vmaf_path forwarded to ffmpeg is only accepted in a special format.

Unfortunately, when I currently try using the --target_quality option on Windows, I cannot specify a vmaf_path without coming across the following error:

av1an.exe --input ProductVideoC3Web60.mp4 --output test100.avif --target_quality 85  --vmaf_path "C\\:/Users/kripod/Desktop/vmaf_float_v0.6.1.pkl"
Traceback (most recent call last):
  File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python39\Scripts\av1an.exe\__main__.py", line 7, in <module>
  File "c:\python39\lib\site-packages\av1an\__main__.py", line 12, in main
    startup_check(project)
  File "c:\python39\lib\site-packages\av1an\startup\setup.py", line 95, in startup_check
    set_target_quality(project)
  File "c:\python39\lib\site-packages\av1an\startup\setup.py", line 26, in set_target_quality
    if not Path(project.vmaf_path).exists():
  File "c:\python39\lib\pathlib.py", line 1407, in exists
    self.stat()
  File "c:\python39\lib\pathlib.py", line 1221, in stat
    return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C\\:\\Users\\kripod\\Desktop\\vmaf_float_v0.6.1.pkl'

kripod avatar Jan 20 '21 21:01 kripod

This line is the root cause of this issue:

https://github.com/master-of-zen/Av1an/blob/287f213918b30a7e32937306a6c890655825729d/av1an/startup/setup.py#L26

As a temporary solution, this check could be omitted when Windows is the OS in use.

kripod avatar Jan 20 '21 21:01 kripod

@kripod on windows I usually recommend to put both model and .pkl in the same folder from where av1an called

master-of-zen avatar Jan 20 '21 21:01 master-of-zen

@master-of-zen Thank you for your quick response, it’s put inside the same folder. The issue doesn’t seem to be about that.

It turns out that "C\\:/Users/kripod/Desktop/vmaf_float_v0.6.1.pkl" cannot be validated by the Path() function. I haven’t had success running Av1an on Windows with --target_quality specified.

kripod avatar Jan 20 '21 21:01 kripod

Even after omitting that check in the package’s source, I encounter the following error when executing the command:

av1an.exe --input ProductVideoC3Web60.mp4 --output test100.avif --target_quality 85  --vmaf_path "C\\:/Users/kripod/Desktop/vmaf_float_v0.6.1.pkl"

: Encoder encountered an error: 1
:: Chunk: 7libvmaf INFO compute_vmaf() is deprecated and will be removed in a future libvmaf version
libvmaf WARNING could not read model from path: "UserskripodDesktopvmaf_float_v0.6.1.pkl"
libvmaf WARNING pkl model files have been deprecated, use json
libvmaf ERROR problem loading model file: UserskripodDesktopvmaf_float_v0.6.1.pkl
[Parsed_libvmaf_6 @ 000001ab7f948c40] libvmaf encountered an error, check log for details
Error while filtering: Invalid argument
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
:: Chunk #7 crashed with:
:: Exception: <class 'Exception'>
 Error in processing pipe
:: Restarting chunk

:: Encoder encountered an error: 1
:: Chunk: 5libvmaf INFO compute_vmaf() is deprecated and will be removed in a future libvmaf version
libvmaf WARNING could not read model from path: "UserskripodDesktopvmaf_float_v0.6.1.pkl"
libvmaf WARNING pkl model files have been deprecated, use json

kripod avatar Jan 20 '21 21:01 kripod

@kripod --vmaf_path "vmaf_v0.6.1.pkl" (Also I didn't yet make vmaf2 work for my FFmpeg, so av1an still use FFmpeg with vmaf1.5.3) I will give you everything packed

master-of-zen avatar Jan 20 '21 21:01 master-of-zen

Thank you, I would highly appreciate a distrubution packaged with everything required to encode videos on Windows. You’re doing an awesome job maintaining this project, keep it up! 🙌

kripod avatar Jan 20 '21 22:01 kripod

@kripod I struggle to find statically build ffmpeg with vmaf 1.5.3, which should work just fine. I will return to this issue as soon as I'm will be able to obtain that build.

master-of-zen avatar Jan 20 '21 23:01 master-of-zen

@kripod here it is av1an.zip Works like this 2021-01-21 12_52_34-C__Windows_System32_cmd exe jpg

master-of-zen avatar Jan 21 '21 12:01 master-of-zen

Thank you, it works great! 😊

Unfortunately, I couldn’t get it to work with Vapoursynth and ffms2 on Windows. However, those work just fine on a mac. I would appreciate if you could help debugging why the console says “Vapoursynth is not installed”, although it is – along with Python 3.

kripod avatar Jan 21 '21 20:01 kripod

@kripod Vapoursynth on windows requires having system-wide install and pip install to be usable. Here is install Not sure if it's enough or additional install of ffms2/lsmash-source is required.

master-of-zen avatar Jan 21 '21 20:01 master-of-zen

I’ve installed that with system-wide access and it didn’t work for some reason.

kripod avatar Jan 21 '21 20:01 kripod

@kripod Vapoursynth on windows requires having system-wide install and pip install to be usable.

This seems to be outdated, I've set up a purely portable av1an with portable Vapoursynth (and the advised 2 plugins in the local portable path), copied python 3.10 to the portable directory - works fine i.e. I didn't encounter an issues.

gitoss avatar Aug 19 '22 14:08 gitoss