Saturday, April 15, 2017

An SD interlaced to HD progressive Conversion Tutorial, or A Long-delayed Video

After all the time (see here and here) I've put into getting the AVISynth+QTGMC+FFMPEG deinterlacing workflow working properly on my system, I figured it was about time for a video tutorial. In my spare time, I've been trying to record one.

It's taken a lot longer than I thought.

Partly, this was due to finding new tricks/plugins that improved the process. Partly, it was due to finding unexpected bugs.

However, the main delay came from me not just wanting to do a "do this, then this' tutorial where you come away with no context whatsoever about what's actually happening. I want people who watch the video to get a good idea of what AVISynth is, and what FFMPEG brings to the process.

So, I'd start recording a tutorial, then get caught up in a tangent. An hour and a half later, I still haven't finished the video.

Plus, I make mistakes. There's a lot of material to cover, and I found myself leaving out crucial points (or ones that clear up confusing areas). I could have tried writing out a script, or just patching over my mistakes. However, it turned out that just repeating the actions so many times that you can practically do them in your sleep eventually got me to the right place. I still had some audio issues to address in post, but my overall presentation quality is much improved from earlier attempts.

I could try adding more production values than just a screencast. But at a certain point, you just have to release a project. So, here without further ado is my first full-length tutorial. Because the total video is around 45 minutes, I will probably add chapter links on the video at a later point. For now, though, here is my work. Constructive criticism is welcome.

UPDATE: The AVISynth wiki has been updated in the last couple of weeks with new download links for many of the filters, and the plugin pack is no longer in a place I can easily link to. I've updated the instructions below to reflect this, and made an update video to the tutorial (linked below), but the instructions for setting up QTGMC in the above video are now outdated. I will try to keep this page updated if other significant changes occur in the future. Anyways...

Here's a written description of the process, including links:

BIG DISCLAIMER: This process may not work, may crash, or do other things to your system. I've had an issue with intermittent audio dropouts in the resulting files, but it seems to only happen with Quicktime ProRes files from a certain source. Always check your files before submitting/uploading them. 

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.

Also, this tutorial is for Windows 10. Most of the steps work for previous versions of Windows, but may require slight modifications. Users of MacOS and other OSes should look elsewhere.

So, where do you go to get all this goodness? Here's some web links:

AVISynth (You will need both the 32-bit "Official" build and the 32-bit "Unofficial" build)

AVISynth source filters (Get the source filter for the format/codec you want to load. In the above script, I use the built-in AVISource filter, but if in doubt, get FFmpegSource.)

QTGMC (Get the QTGMC download, then get both the "required" and "optional" filters as listed on the page. If there's a choice, get the 32-bit [x86] version of filters.)

For the .avsi pastebin links, select the text of the link and copy it, then click on the link, right-click and do Save Page As, select All Files in the Save As drop-down box, paste the name of the file, delete any spaces from the front of the filename, then save the file. For a demonstration, check out this update to my video tutorial:

LimitedSharpen (Get the x86 version in order for it to work within a script using QTGMC. )

FFMPEG Windows Binaries (Get the current 32-bit static version)



  1. Run the main AVISynth installer. 
  2. Put the AVISynth filters you downloaded (.dlls and .avsi files) in the AVISynth Plugins directory. Make sure to use the 32-bit (x86) versions of any filters if there is a choice. Make sure you're using version 2.2.7 (or later) of MaskTools2.
  3. Copy the multithreaded build of avisynth.dll to your system folder (Usually C:/Windows/SysWow64/) and replace the existing file.
  4. Copy the libfftw3f-3.dll file your system folder.
  5. Extract FFMPEG and AvsPmod to their own folders. Keep the folder with the ffmpeg.exe binary open.
  6. Set up FFMPEG to run from any directory on your PC by adding it to your PATH variable:
    1. Press the Windows and R keys.
    2. Type "control sysdm.cpl,,3". Click "Run".
    3. Click on "Environment Variables".
    4. Select "Path" under "System variables" and click "Edit".
    5. Go back to your open folder where ffmpeg.exe is located. Select and copy the folder's path address from the address bar towards the top of the window.
    6. Back in the "Edit environment variable" window, click "New" and paste in the folder path. Click OK on all the windows you opened to get here.


In the same directory as your video file that you want to process, make an .avs script with the settings listed below. Change the filename, source filter, and crop settings as necessary.

Here's my boilerplate .avs script settings for QTGMC deinterlacing:

SetMTMode (5, 10)
AVISource("videofile.avi", audio=true)
QTGMC(preset="Slower, SourceMatch=3, Lossless=2, EdiThreads=1)
And here's what to add if you want to upscale to HD:

I've also found an awesome conservative sharpening filter that can be added at the end for a little extra punch:


Loading this script in AvsPmod will let you preview your results, and change to your preference. When you're done, don't forget to save your work.

Create a new text file in the same directory and change its extension to .bat. Add the FFMPEG commands of your choice. For example, here's a command to encode an .avs script to a ProRes 422HQ Quicktime file:

ffmpeg -i "videofile.avs" -c:v prores_ks -profile:v 3 -qscale:v 9 -pix_fmt yuv422p10le ""

Change where necessary. The quotes around the filenames in the FFMPEG command allow you to enter path addresses and filenames with spaces in them.

No comments: