PLEASE NOTE: This tutorial is now significantly out of date. I've provided it only for historical reference, and am currently working on a followup. The instructions below WILL NOT WORK with current versions of VapourSynth.
It took me about a morning to get everything I needed and set up a sample script for QTGMC conversion. I decided to try to keep the setup as bloat-free as possible by using "portable" versions of the apps involved.
Here was my ultimate workflow. I won't try to explain everything since I'm not totally fluent in Python, but adapting the following settings should allow you to get it work:
BIG DISCLAIMER: This process may not work, may crash, or do other things to your system. Virus scanning all files is strongly encouraged, but not a 100% guarantee of safety.
You have been warned.
If you're on a deadline (and using Premiere Pro, After Effects, or Final Cut Pro) probably your best best is to use a paid plugin like FieldsKit. And no, they aren't paying me to say that.
Also, this tutorial is for Windows 10. Most of the steps work for other OSes, but I won't cover the differences here.
Here's a video version of the tutorial:
First, grabbed the embeddable version of Python 3.7.X:
https://www.python.org/downloads/
(Click on the name of the latest version of Python 3.7, then scroll down to find the embeddable version.)
Then, downloaded the portable VapourSynth:
https://github.com/vapoursynth/vapoursynth/releases
(I'm using the 64-bit portable version.)
Then, grabbed VapourSynth Editor (VSEdit):
https://bitbucket.org/mystery_keeper/vapoursynth-editor/downloads/
Extracted the Python archive to a directory. Extract both VapourSynth and VSEdit to the same directory, in that order.
Now, for the needed plugins and VapourSynth Python modules:
FFmpegSource:
https://github.com/FFMS/ffms2/releases
havsfunc
https://github.com/HomeOfVapourSynthEvolution/havsfunc/releases
(The source code is what you want here.)
mvsfunc
https://github.com/HomeOfVapourSynthEvolution/mvsfunc/releases
adjust
https://github.com/dubhater/vapoursynth-adjust/releases
nnedi3_resample
https://github.com/mawen1250/VapourSynth-script
(Click on the "Clone or download button" and select "Download ZIP")
I also grabbed fmtconv for colorspace conversion:
https://github.com/EleonoreMizo/fmtconv/releases
Then, the VapourSynth versions of the needed QTGMC prerequisites:
https://github.com/dubhater/vapoursynth-mvtools/releases
https://github.com/dubhater/vapoursynth-nnedi3/releases
(You'll also need nnedi3_weights.bin from here. Left-click on the link, don't right-click/save)
Scanned all the above files for viruses.
Extracted the .py files in the main directory. Extracted the (64-bit) .dll files to the vapoursynth64/plugins directory
Opened VSEdit. Made the following initial script:
import vapoursynth as vsNote that the final backslash before the input file name needs to be "escaped" with another backslash.
import havsfunc as haf
core = vs.get_core()
clip = core.ffms2.Source(source='F:\directory\\input movie.mov')
clip = haf.QTGMC(clip, Preset='Slower', TFF=False)
clip = core.resize.Spline36(clip, 720, 540, matrix_in_s='709')
clip.set_output()
With the above settings, the source colorspace will be preserved, but the color matrix will be shifted to REC.709 on resize. To change both the output colorspace and color matrix, use:
clip = core.resize.Spline36(clip, 720, 540, format=vs.YUV422P10, matrix_in_s='709')If you're coming from a source file with a non-recognized colorspace, you can use:
clip = core.fmtc.resample (clip=clip, css="420")right after the ffms2 command.
clip = core.fmtc.bitdepth (clip=clip, bits=8)
Update: As UniveralAl1 mentions in a comment on the tutorial video, it may be possible to skip this by just converting once to YUV422p10 before QTGMC. The resulting script might look something like this:
import vapoursynth as vs
import havsfunc as haf
core = vs.get_core()
clip = core.ffms2.Source(source='E:\Archive\\input video.avi')
clip = vs.core.resize.Point(clip, format = vs.YUV422P10)
clip = haf.QTGMC(clip, Preset='Slower', TFF=False)
clip = core.resize.Spline36(clip, 720, 540)
clip.set_output()
Please try this first rather than the final script below.
All of the above ended up being necessary for the video file I selected for testing due to it using 4:1:1 chroma subsampling, so here is my final script:
import vapoursynth as vs
import havsfunc as haf
core = vs.get_core()
clip = core.ffms2.Source(source='E:\Archive\\input video.avi')
clip = core.fmtc.resample (clip=clip, css="420")
clip = core.fmtc.bitdepth (clip=clip, bits=8)
clip = haf.QTGMC(clip, Preset='Slower', TFF=False)
clip = core.resize.Spline36(clip, 720, 540, format=vs.YUV422P10, matrix_in_s='709')
clip.set_output()
Saving this script gives you a .vpy file.
To render it out, I used a combination of vspipe and FFMPEG as per the documentation. However, VapourSynth does not handle audio and video at the same time, so I had to use the mapping command in FFMPEG to copy over the audio separately:
vspipe --y4m Upscale.vpy - | ffmpeg -i pipe: -i "C:\pathto\inputmovie.mov" -c:v prores -profile:v 3 -c:a copy -map 0:0 -map 1:1 "F:\Temp\output file.mov"
Preliminary testing gives me 67 fps average for VapourSynth and 77fps average for AVS+ using the following script:
SetFilterMTMode("QTGMC", 2)
FFmpegSource2("ITVS Trailer.avi", atrack=1)
ConvertToYV12()
AssumeBFF()
QTGMC(Preset="Slower", EdiThreads=3)
Spline36Resize(720, 540)
Prefetch(10)
The only difference I noticed in the resulting files was that bright red colors bled upwards in the VS encode, and downwards in the AVS+ encode. If I figure out more, will report back.
If you have any input or suggestions, feel free to leave a comment below.