-
Notifications
You must be signed in to change notification settings - Fork 141
VapourSynth plugin
import vapoursynth as vs
core = vs.get_core()
src = core.lsmas.LWLibavSource(source=r"Your video path", threads = 8)
src = core.anime4kcpp.Anime4KCPP(src = src, GPUMode = 1, ACNet = 1, zoomFactor = 2, HDN = 1, HDNLevel = 2)
src.set_output()
Download the Anime4KCPP_VapourSynth_plugin package or build it from source, copy all the dll files to your vapoursynth64/plugins, that's it!
core.anime4kcpp.listGPUs()
This function will list the available platform IDs and device IDs, you can use them to specify the GPU for processing.
core.anime4kcpp.Anime4KCPP(src, passes, pushColorCount, strengthColor, strengthGradient, zoomFactor, ACNet, GPUMode, GPGPUModel, HDN, HDNLevel, OpenCLQueueNum, OpenCLParallelIO, platformID, deviceID)
This is the main function of Anime4KCPP.
- passes: Passes for processing (int [=2])
- pushColorCount: Limit the number of color pushes, make sure the edge won't be too thin (int [=2])
- strengthColor: Strength for pushing color,range 0 to 1,higher for thinner (double [=0.3])
- strengthGradient: Strength for pushing gradient,range 0 to 1,higher for sharper (double [=1])
- zoomFactor: upscaling ratio for resizing (double [=1])
- ACNet: Enable ACNet (int [=0])
- GPUMode: Enable GPU acceleration (int [=0])
- GPGPUModel: OpenCL or CUDA (string [="opencl"])
- HDN: Enable HDN mode for ACNet (int [=0])
- HDNLevel: Set HDN level, higher for better denoising but may cause blur, range 1 to 3 (int [=1])
- OpenCLQueueNum: Number of OpenCL queue, may affect performance, especially for NVIDIA graphics card (int [=4])
- OpenCLParallelIO: Use a separate OpenCL queue to handle IO, may affect performance, especially for AMD graphics card (int [=0])
- safeMode: usually faster, no extra pixels, but may use more memory, it must be enabled for YUV 8bit support, otherwise only RGB24 and YUV444 is supported (int [=1])
- platformID, deviceID: For specifying the GPU (int [=0])
Supported color format:
- "ACNet=0,safeMode=1", "ACNet=0,safeMode=0" and "ACNet=1,safeMode=0" :
- Gray8
- Gray16
- GrayS
- RGB24
- RGB48
- RGBS
- YUV444P8
- YUV444P16
- YUV444PS
- "ACNet=1,safeMode=1":
- Gray8
- Gray16
- GrayS
- RGB24
- RGB48
- RGBS
- YUV444P8
- YUV444P16
- YUV444PS
- YUV422P8
- YUV422P16
- YUV422PS
- YUV420P8
- YUV420P16
- YUV420PS
Extra pixels only appear when safe mode is turned off
Get weird border in the right side of output video?
That's not a bug, that because the VapourSynth required that the width of a frame must be a multiple of 32, so Anime4KCPP will align the width to 32, just cut it off manually, or you can convert the output video to YUV444 or just output as RGB24, that will make the extra pixel to be black. You can also resize input video manually by any other algorithms (make sure the width of output is a multiple of 32), and use Anime4KCPP with zoomFactor = 1 to process it.
eg:
input video: 720x480 (ntsc dvd), zoomFactor = 2
alignment: 720 / 32 = 22.5, align to 23, 23 * 32 * 2 = 1472
output video: you will get a video of`1472x960 ` instead of `1440x960`, just cut the extra 32px off manually, they are useless.