Selur's Little Message Board

Full Version: Waifu2x Resulting in crash
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hybrid version: Win64 2017.10.05.1 Vapoursynth

What happened: Crashed while attempting to encode. Vapoursynth preview also does not work.

What did I do to get the bug: Attempt to use waifu2x resizing on any video. I first encountered it while trying to encode a DVD, but I also tested other files and the result is the same. If I choose to downscale the problem does not happen (no surprise :| ).

This is the script:
Code:
# Imports
import vapoursynth as vs
core = vs.get_core()
import ctypes
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("Support/fmtconv.dll")
# Loading Plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/vsfilters/ResizeFilter/Waifu2x/Waifu2x-w2xc.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading X:\!!!temp\[HorribleSubs] Kiznaiver - 10 [1080p].mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="X:/!!!temp/_3E47R~N.MKV", format="YUV420P8", cache=0)
# making sure input color matrix is set as 709
clip = core.resize.Point(clip, matrix_in_s="709")
# Making sure input color range is set to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# resizing to 2800x1576
# adjusting bit depth to 32bit
clip = core.fmtc.bitdepth(clip=clip,bits=32)
# resizing using Waifu2x
clip = core.w2xc.Waifu2x(clip=clip, scale=2, noise=1, block=512, photo=False, processor=-1, gpu=1)
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=2800, h=1576, kernel="lanczos", interlaced=False, interlacedd=False)
# adjusting bit depth back to 16bit
clip = core.fmtc.bitdepth(clip=clip,bits=16)
# adjusting output color from: YUV420P16 to YUV420P8
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8)
# Output
clip.set_output()


Vapoursynth gives me following error:

Code:
Failed to evaluate the script:
Python exception: [WinError 126] The specified module could not be found

Traceback (most recent call last):
 File "src\cython\vapoursynth.pyx", line 1810, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:36455)
 File "C:\Users\mmokk\AppData\Local\Temp\tempPreviewVapoursynthFile00_40_44_540.vpy", line 6, in <module>
   Dllref = ctypes.windll.LoadLibrary("Support/fmtconv.dll")
 File "ctypes\__init__.py", line 422, in LoadLibrary
 File "ctypes\__init__.py", line 344, in __init__
OSError: [WinError 126] The specified module could not be found


I performed a clean installation of hybrid two times, with "delete user settings". I also checked if fmtconv.dll is in the directory (it is).

The debug log is in the attachment.

Hope you can help
Will look into it. Thanks for reporting, I never use Waifux2 since it's way to slow and seems only to be useful for anime content.
I can reproduce the issue here. Smile
-> will report back once I figured out what's causing this.

Cu Selur
Got it! The way ffmconv was loaded was wrong due to a small typo.
Will send you a link to a dev version via PM. (simply extract the content of the download into your Hybrid folder)

Cu Selur
(10.12.2017, 09:40)Selur Wrote: [ -> ]Got it! The way ffmconv was loaded was wrong due to a small typo.
Will send you a link to a dev version via PM. (simply extract the content of the download into your Hybrid folder)

Cu Selur

Thanks for quick reaction, but this version also seems to have a problem. This time I'm unable to get an error directly from vapoursynth, the window does not even appear when I click "preview". It's working fine without the Waifu2x, as well as with other resizers, so I assume this is a correlated issue. As for encoding I'm getting a CRASHED at encoding step.

This time I only have the debug output.
If the preview already doesn't work it would have been nice to have a debug output of the preview,...

Vapoursynth script used during encoding seems fine:
Code:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/vsfilters/ResizeFilter/Waifu2x/Waifu2x-w2xc.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading X:\!!!temp\[HorribleSubs] Kiznaiver - 10 [1080p].mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="X:/!!!temp/_3E47R~N.MKV", format="YUV420P8", cache=0)
# making sure input color matrix is set as 709
clip = core.resize.Point(clip, matrix_in_s="709")
# Making sure input color range is set to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# resizing to 2888x1626
# adjusting bit depth to 32bit
clip = core.fmtc.bitdepth(clip=clip,bits=32)
# resizing using Waifu2x
clip = core.w2xc.Waifu2x(clip=clip, scale=2, noise=1, block=512, photo=True, processor=-1, gpu=1)
# adjusting resizing
clip = core.fmtc.resample(clip=clip, w=2888, h=1626, kernel="lanczos", interlaced=False, interlacedd=False)
# adjusting bit depth back to 16bit
clip = core.fmtc.bitdepth(clip=clip,bits=16)
# adjusting output color from: YUV420P16 to YUV420P8 for x264Model (i420)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8)
# Output
clip.set_output()
and the encoding call:
Code:
"C:\PROGRA~1\Hybrid\VAPOUR~1\vspipe.exe" "C:\Users\mmokk\AppData\Local\Temp\encodingTempSynthSkript_15_06_18_3210.vpy" - --y4m | "C:\PROGRA~1\Hybrid\x264.exe" --qp 18 --profile high --direct auto --partitions i4x4,p8x8,b8x8 --no-fast-pskip --subme 5 --trellis 0 --weightp 1 --sar 1:1 --non-deterministic --range tv --colormatrix bt709 --demuxer y4m  --fps 2381000/100000 --output "C:\Users\mmokk\AppData\Local\Temp\15_06_18_3210_04.264" -
also looks fine.
Still there seems to be a problem with the color space, since x264 crashes due to:
Code:
y4m [error]: bad sequence header magic

-> can't reproduce this here, need a small sample of the source that you are using to reproduce this here.

Cu Selur
Think I found the problem.
There was a bug related to the 'Photo' option, since Waifu2x then requires RGB input.
-> think I fixed it, will send you a PM with a link to a dev version for testing

Cu Selur
This version seems to be working just fine using the default settings. I'm off my encoding rig and tested on a laptop, but I assume this problem is fixed. I am having the encode crash when using opencl. This is on intel graphics though (HD4400), so I understand that this might not be programs fault. Opencl seems to be working fine in other cases though, avisynth scripts that used opencl worked just fine. I also had no problem using standalone waifu2x opencl.

In the log I'm getting a similar error:
Code:
y4m [error]: bad sequence header magic
I agree this doesn't look like a bug in Hybrid.
Tried on my system and there forcing OpenCL doesn't cause a crash, so it's probably a driver issue.
-> Try whether updating the CPU drivers for your CPU/GPU helps.

Cu Selur