Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development
Register FAQ Calendar Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 5th November 2019, 21:40   #1  |  Link
AvengerOne
Registered User
 
Join Date: Oct 2019
Posts: 3
Script to scale videos with waifu2x.

Script to scale videos with waifu2x.

It allows you to scale your videos using Waifu2x, without the need to export all images(10Gb-50Gb), as well as the possibility to detect duplicate frames, and save processing time.

Work with any command line program(Windows), such as:

waifu2x-conver-cpp, waifu2x-caffe, waifu2x-ncnn-vulkan. (This is supported by CUDA,CUDNN, GPU AMD, Vulkan)

"waifu2x.- Image Super-Resolution for Anime-style art using Deep Convolutional Neural Networks. And it supports photo"
https://github.com/nagadomi/waifu2x


Note: The code can be easily modified to work with any program, including gimp.
The script exports a single image, then it is processed with the program, and then the processed image is loaded.



Link Tutorial.
https://www.youtube.com/watch?v=kdbhFVZ4vIM
In the description of the YouTube video, comes a compressed file with all the necessary files (dlls)

Code:
#~ SAMPLE CODE
LoadPlugin("ffms2.dll")
LoadPlugin("CALL_25.dll")

NameVideo= "c:\My path\My Video.mp4"
FFIndex(NameVideo)
FFVideoSource(NameVideo,fpsnum=24000,fpsden=1001)

Scale=2
Noise=0
#~ directory Temp
InputImage="c:\temp\Temp.bmp"
OutputImage="c:\temp\Temp.png"


Space=" "
DirectoryProgram=""" "C:\Program Files\waifu2x-converter\" """
NameProgram="waifu2x-converter-cpp.exe"
PImageInOut = "-i" + Space + "'" +  InputImage + "'" + Space + "-o" + Space + "'" + OutputImage + "'" + Space
Parameters ="-m noise-scale -v 3 --noise-level" + Space + string(Noise) + Space + "--scale-ratio" + Space + string(Scale)
LineCommand= DirectoryProgram + Space + NameProgram + Space + Parameters + Space + PImageInOut

ConvertToRGB32()
ScriptClip("""ImageWriter(InputImage+"%n",start =current_frame, end =current_frame)""",after_frame = true)
#~ Same scale and color necessary
BilinearResize(last.Width*Scale,last.Height*Scale)
ScriptClip("""Call( "cmd /C title Frame:" + string(current_frame)+ "/" + string(last.FrameCount) + " & start /wait /B /D " + LineCommand, string(current_frame))""",after_frame = True)
ScriptClip("""ImageSourceAnim(OutputImage).BilinearResize(last.Width,last.Height)""",after_frame =true)
You can easily include the audio as well as video clippings.
Code:
AudioDub(last,A).trim(0,0)
Attached Files
File Type: zip OnlyScriptAvsWaifu.zip (5.7 KB, 129 views)
AvengerOne is offline   Reply With Quote
 

Tags
anime, cuda, vulkan, waifu2x


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.