Friday, January 1, 2021

Deinterlacing with AVISynth and QTGMC - Updated yearly

Welcome to the new home of my QTGMC deinterlacing tutorial. This post will be updated periodically as new changes happen and new info comes out, or until a better option comes along.

Changes since last post/video:

  • I've switched to an entirely 64-bit workflow
  • QTGMC has some new requirements
  • I've dropped FFMPEG as the recommended rendering program in favor of VirtualDub2
  • AVISynth Info Tool is now the recommended way to check and make sure that you've installed AVISynth correctly.

BIG DISCLAIMER: This process may not work, may crash, or may do other things to your system. Virus scan everything you download. It's not a 100% guarantee that you'll avoid getting a malware infection, but it's a lot better than not checking at all.

If you're doing professional work, always watch any files you create using this process before submitting/uploading them to check for audio and/or video glitches.

Follow this tutorial at your own risk. 

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.

Here's the video version of the setup and basic QTGMC deinterlacing workflow:


7-zip (optional)

If you don't have 7-zip already installed, you won't be able to open many of the downloaded archives. The stable, 64-bit version should be fine.

Next, we're going to need to get AVISynth+. You can grab it from here:

If you don't already have the MSVC 2019 Redistributable installed, grab the version ending with "vcredist".

Then, we'll need to get all the filters (plugins) needed:


Note: Version 2.40 has been shown to corrupt video frames. Please either use a different version, or use LSMASHSource as linked below.

This is what will allow AVISynth+ to load our video files. Works with almost any container/codec combination, but read the "Known Issues" section for things to look out for (hint: don't use interlaced h.264 video with it).

Note: If you do need to work with interlaced h.264 video, try LSMASHSource instead. It requires two commands rather than one to work (technically three if you count AudioDub(video, audio) to combine the two together), but can support some non-standard formats. Thanks to neonfrog for the heads up.


The deinterlacing plugin of choice. Requires a whole host of additional plugins, of which you will be using the 64-bit versions (if an option is given). For most uses, only the "Core Plugins and scripts" are necessary.

For the "Zs_RF_Shared.avsi" link, right-click on the link and do "Save Link As", or whatever the equivalent is in your browser of choice.

DO NOT forget to download the 32-bit FFTW3 library as well. Without it, QTGMC will not run.

Note: Since ALL major web browser makers have now - in their infinite wisdom - decided to drop support for FTP links, you will be unable to download FFTW3 using Firefox, Chrome, or Edge without either installing additional programs or monkeying with the browser settings.

For example, if you use Chrome, you can enter chrome://flags and search for "enable-ftp". Change it from "default" to "enabled" and Chrome will now now download from FTP links. (Thanks to penguingulp for the tip).

Alternatively, you can download and install WinSCP with minimal options (after virus scanning it). Once it runs for the first time, close the login window, then go to the Options menu up above. Find the Integrations item in the list of Options, then click on "Register to handle URL addresses", then "Make WinSCP default handler". This will open Windows' Default Apps control panel. Select "Choose default apps by protocol", scroll down to the entry for FTP, change it to WinSCP. 

When finished, Close WinSCP. Then, re-start your browser, go to the page listed above and try to download the library archive. When prompted, allow FTP access for links on the site, then select WinSCP as your FTP handler program in the prompt that comes up. You should then get a login window. Enter "anonymous" (without the quotes) for the username, and leave the password field blank when asked. Click through, and the file should now be downloaded. 

With all the AVISynth filters and scripts grabbed, it's time to get the supporting software:


This is like an IDE for AVISynth scripts, and is pretty much essential IMO. Grab the 64-bit version for this tutorial.

This allows us to detect processor features and check to see if AVISynth is properly installed.

Finally we need to grab a rendering program.  For ease of use, I now recommend VirtualDub2 - a fork of the original program used to render AVISynth scripts. 


When finished downloading, virus scan all the things.


AVISynth+ has a simple installer. I recommend installing into whatever your user folder is (for example C:\Users\Me\) rather than the default of Program Files(x86) so you don't have to deal with authentication requests every time you add a plugin. Also, I highly recommend checking the "Add AVISynth Script to New items menu" option. Otherwise, you can stick with the defaults.

Then, go to the plugins64+ directory for AVISynth+. For example, the default install creates a plugin folder at:

C:\Program Files(x86)\AVISynth+\plugins64+\

Extract all "x64" versions of the .dll and .avsi files to the plugins directory (if given a choice) from all plugins EXCEPT the fftw-3*.dll archive. If there's a choice between AVX, AVX2 and a version without AVX, you'll need to know what instruction sets your processor supports. CPU-Z  or AVISynth Info Tool can tell you this if you're not sure.

Now, open the fftw-3*.dll archive, then (as noted on the QTGMC page) extract the libfftw3f-3.dll file. Make a copy of it and rename it as "FFTW3.dll". Place the files "libfftw3f-3.dll" and "FFTW3.dll" in the SysWow64 folder. Don't ask me why you have to do this, I agree that it seems pointlessly tedious.

Please note: If you're only using AVISynth+ (not older versions of AVISynth) and only need to use QTGMC, you can skip the above step and just download/put the 64-bit version of libfftw3f-3.dll in the plugins64+ directory. Despite the error message in 32-bit AVSInfoTool, QTGMC will now work in both modes (although you can drop the 32-bit version of libfftw3f-3.dll in the plugins+ director to clear the error if you like, and to clear the Zf_RF_Shared error, you need to do the regular install method above)

Also, if you want to be able to run QTGMC's "EZDenoise" & "Sharpness" functions, put the 64-bit version of "fft3dfilter.dll" into the plugins64+ directory.

Thanks to Spammy Family for pointing this out.

Speaking of tedious, if you want to use the "Very Slow" or "Placebo" preset for QTGMC, it looks like you need to install the 64-bit version of FFTW in your System32 directory using the same method mentioned above.

Extract the AvsPMod archive to wherever you want to run it from - again, I recommend your user folder.

Extract AVISynth Info Tool in the same way. If you like, you can install it more officially by clicking on the AVSInfoToolInstaller.exe file, but I generally just run it directly from the "AVSInfoTool_FilesOnly" folder. 

Go ahead and run it now, making sure to select the "AVISynth 64-bit" option once loaded.  If you get errors that are not about the FFTW3 library or Zs_RF_Shared.avsi (to fix those errors, install the 64-bit version of FFTW in your System32 directory using the same renaming/copying process listed above), then double-check and make sure you followed all the previous steps correctly. You might also want to take note of how many cores and logical processors you have, along with what instruction sets are supported by your CPU. 

Finally, create a folder for VirtualDub2 and extract its archive there.

Making your .avs script

Now that everything's ready, let's go to the directory with your video files and make an .avs script. Right-click anywhere in the directory, select New, then AVISynth Script and rename it however you want. If that option doesn't show up, you can just create a new text file and change the .txt extension to .avs.

Open AvsPMod, then go to the Options menu and click on "Associate .avs files with AvsPMod". You should now be able to double-click on .avs scripts and have them open directly in AvsPmod. Do so with the script you just created.

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

    SetFilterMTMode ("QTGMC", 2)
    FFMPEGSource2("videofile.avi", atrack=1)

The "atrack=1" option for FFMPEGSource selects the track of audio that is passed through during processing. If the default option doesn't give you audio in the results, try "atrack=-1" instead.

Please note that by default both FFMPEGSource and (certain modes of) LSMASHSource index your video file the first time you load the .avs script into either AvsPMod or your rendering program of choice. This may take a while and give the appearance of freezing the program. When it's finished, you'll see an .ffindex or .lwi file appear in the same directory as your video with the same name as your video.

Also note that LSMASH requires separate commands for video and audio along with a dub command to recombine them. for example:

a=LWLibavAudioSource(source="yourfile.m2ts", stream_index=-1, cache=true, av_sync=true, rate=0, decoder="")

For more info, check out the wiki page here:

If you're trying to load an .avi file, you should probably try:

AVISource("yourfile.avi", audio=true)

instead of FFMPEGSource, as AVISource has better performance and can support some edge case .avi codecs that FFMPEGSource struggles with.

AssumeBFF/TFF deals with interlaced field order.  Simple rule of thumb here: home videos are probably going to be BFF, commercially released dvds or professional video are probably going to be TFF. You'll know if you get this wrong if you preview the video and it "jumps" every other frame.

You may or may not need either




commands before QTGMC depending on the type of video that you're feeding into FFMPEGSource2. I used to use ConvertToYV12() frequently on older versions of QTGMC that didn't support other color formats, but the current version seems to be a lot more forgiving. 

The main difference between YV12 and YUY2 has to do with chroma subsampling (which is a whole other rabbithole to go down)  but to simplify - some older AVISynth plugins only support YV12, while other support both YV12 and YUY2. If a plugin complains about your source footage not being in either color format, convert to YUY2 if you can.

It's a good idea to try previewing the script without a Convert command and see if it works first, if not then add it in. Thanks to ENunn for the suggestion about adding interlaced=true, which should reduce chroma smearing errors.

The resize I use in this case is to correct the pixel aspect ratio of the footage. I explain in more detail in the video tutorial, but basically SD video was designed to be shown on TVs that slightly vertically stretched the image (or very slightly horizontally in the case of PAL). On "square pixel" displays (pretty much every display except for analog TVs), you need to correct for this in order for the image to have the right proportions. I enlarge the image to retain some detail and create a new "master" version that I can use in different ways, but if you're trying to convert something for a major streaming service, they usually want 640x480 for SD content (and 29.97 or 25 fps rather than 59.94 or 50fps). You can do a different resize method here like Lanczos or Spline64 if you'd like to add some light sharpening.

If you want to upscale slightly to correct the pixel aspect ratio instead (like I did in the example script above), then 720x540 is correct for NTSC, and 768x576 is correct for PAL.

The Prefetch number should be set to 1 or 2 less than the number of "logical processors" in your system. To check what that is, go to Task Manager in Windows, select the Performance tab, then click on the CPU item. You'll see down below in the window an entry for the number of logical processors in your system. For some people, it will be the same as the number of physical cores, for others it might be double that if your CPU supports Hyperthreading. In my case, I have 12 logical processors, so I set Prefetch to 10.

On the other hand, EdiThreads is supposed to be set to half the number of physical cores in your system, and if so can give a mild speed boost. With the current workflow, I've been able to set it to 3 with no issues (only my 6-core system), but your mileage may vary. If you experience any random rendering freezes (not overall system freezes), then lower this number first before restarting the render. 

Update: Looks like EdiThreads can now use all cores without stability issues, so I'm removing my advice about it. If you run into render freezes, you might try adding EdiThreads=1, otherwise leave it out.

If you need to output 29.97fps (25fps for PAL) rather than 59.94fps (50fps for PAL) at this stage, then add FPSDivisor=2 to the QTGMC command like so:

    QTGMC(preset="Slower", FPSDivisor=2,)


Instead of using command-line FFMPEG, I'm now recommending VirtualDub2 for rendering out AVISynth scripts. This is partially because Zeranoe has stopped making Windows FFMPEG binaries, but also because VirtualDub2 is a lot easier for most people to work with and seems to be staying around. You can also use Shutter Encoder if you like.

Working with AVISynth scripts in VirtualDub2 is pretty simple - launch VirtualDub2, drag your script into the main window, then wait for the preview to appear. Set your desired compression settings under the video and audio menus. Please note: the audio menu defaults to "direct stream copy", which you should change to "full processing mode", then you can select compression afterwards.

I personally use ProRes for most conversions, but you can choose from a variety of other codecs.  I might go into details about the particular settings in a separate blog post/video. 

To export the video, go to the file menu, then select "save video".  Make sure you select the correct file type for the codecs that you're using (For example, you can put H.264 video in an .mp4, .mov, or .mkv container, but ProRes will only go in .mov or .mxf).

Watch your video before sending it out anywhere to make sure that there are no glitches.  I've gotten burned by this in the past when exporting out multiple episodes of a TV series that had random audio dropouts.

PS: VirtualDub2 doesn't generate "official" ProRes files, so if it will be the last stop in your export chain, consider using a different workflow if the file is going to a major TV channel. Some channels have reportedly (at least according to editors on Reddit's /r/editors subreddit) said that FFMPEG ProRes files won't pass QC with them.

Optional - Cropping and resizing to HD resolutions

Here's what to add if you want to upscale SD to HD with a center crop:


Note that the numbers in the crop command refer to left,top,right,bottom respectively, and the right and bottom numbers are negative, while the left and top numbers are positive. Don't ask me why AVISynth does this, it just does.

The above settings will give you as close to a 16x9 frame as you can get out of this resolution. Technically, 720x405 is true 16x9, but the chroma subsampling options supported by QTGMC don't like odd numbers, so 720x404 is the closest you can get.

Also, this may crop off more than you want, so feel free to play around with the settings. If you want to frame a different part of the image (like the top or bottom versus the middle), then just adjust the crop numbers accordingly by adding what you subtract from one number to the other, or vice versa. For example, to use just the top part of the frame, you would do:


It has a ton of additional features listed on the wiki page, which you can play around with if the defaults don't work for you.

One other thing to note: If you notice a color or gamma shift in your upscaled image on render, try adding:


after the resize step.

Optional - FFMPEG

If you want to use command-line FFMPEG instead of VirtualDub2, here's some setup instructions:

Open whatever ffmpeg archive you've grabbed, navigate to the "bin" directory, and extract the ffmpeg.exe file to whatever directory your video file/files are located in.

Alternatively, you can extract the archive to somewhere on your system and then set up FFMPEG to run from any directory by adding it to your PATH variable:
  1. Press the Windows and R keys.
  2. Type "control sysdm.cpl,,3". 
  3. Click "Run".
  4. Click on "Environment Variables".
  5. Select "Path" under "System variables" and click "Edit".
  6. Go to where you extracted ffmpeg.exe. 
  7. Select and copy the folder's path address from the address bar towards the top of the window.
  8. 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.
Create a new text file in the same directory as your video(s) 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 -profile:v 3 -pix_fmt yuv422p10le ""


Unknown said...

Thank you for the update.
I just happened to dive back into Hi8 conversions that I'd started last Spring.
I was backtracking to figure out what my workflow was and WOW, you just updated the process. Great timing!

After following the steps and confirming via the AVSInfoTool, I fired up AVSPmod and pasted the script with my .avi file/path. In the past, this worked well.
But now, pressing play (F5) starts a spinning (no response) event that doesn't resolve and I end up having to force quit the program. Any suggestions on how to troubleshoot that? Task manager was no help.
Is there a logging or verbose mode I can use to gather clues?
Thanks again - excellent work and information on a mind-numbingly difficult subject.

Unknown said...

Update - I was able to get it working via dragging the script to VirtualDub2.
Perhaps it's the original AVI file size of 40+ GBs?

Unknown said...

Sadly -
I'm dead in the water again.
All efforts to render via QTGMC quickly end in a hung app.

A problem caused this program to stop interacting with Windows.
Faulting Application Path: E:\AvsPmod\AvsPmod.exe

Problem signature
Problem Event Name: AppHangB1
Application Name: AvsPmod.exe
Application Version:
Application Timestamp: 4918017b
Hang Signature: 8f6c
Hang Type: 134217728
OS Version: 10.0.19041.
Locale ID: 1033
Additional Hang Signature 1: 8f6c4481abd0f2b765fe8b6e88191bd9
Additional Hang Signature 2: 1e68
Additional Hang Signature 3: 1e6851415aafb333628b9c7937ea53cf
Additional Hang Signature 4: 8f6c
Additional Hang Signature 5: 8f6c4481abd0f2b765fe8b6e88191bd9
Additional Hang Signature 6: 1e68
Additional Hang Signature 7: 1e6851415aafb333628b9c7937ea53cf

Extra information about the problem
Bucket ID: f45cf0062a4c94d63654779cba8b07cf (1609042481906386895)

Andrew Swan said...

Could you paste your .avs script up into a comment?

christina said...

Hi Andrew, thanks again for these tutorials. I found the original immensely helpful in getting myself set up and I don’t think there’s anything else like this on the internet.

One thing that I wanted to point out / ask you about is your colorspace conversion in your boilerplate avs script. If you’re not using any filters that require the YV12 colorspace (qtgmc no longer needs it), and you’re converting to prores, my understanding is that the conversion to YV12 is unnecessary. Prores uses the YUV colorspace so you’re basically converting twice for no reason, which could cause some minor degradation of your video (although it is probably mostly unnoticeable). Also, I am not sure if this has been updated in VirtualDub2 but the last I knew, VirtualDub requires a RGB colorspace. If that is still true, you’re converting from YUV->YV12->RGB->YUV for no reason (if you’re solely using VirtualDub for rendering purposes only).

Now, I’m no expert but I’ve done so much (too much) research for my purposes so the above is more of a question than a statement. It’s possible that VitualDub no longer requires RGB colorspace or perhaps that’s only if you’re adding filters in it... but my workflow is nearly identical to yours and if I am converting to prores, I don’t have any colorspace conversions at all. And I render with ffmpeg command line or batch scripts that process a whole folder at a time, which is easier to me than opening each file in VirtualDub. The only time I convert to YV12 in my script is if I am converting directly to x264/mp4 or if I use a filter that needs it. My understanding is that colorspace conversions, although mostly harmless, should generally be avoided unless necessary.

Correct me if I am wrong on any of the above, please! And thank you!!


Unknown said...

SetFilterMTMode ("QTGMC", 2)
FFMPEGSource2("K:\11071995-02241996.avi", atrack=1)
QTGMC(preset="Slower", EdiThreads=3)

#########Additional Comments/clues
One avi will successfully load. All others crash AvsPmod.
That one avi has an (filename).avi.ffindex that has a recent creation date (since I updated per guide).
All other avi files, including those with older .avi.ffindex files crash.
So I suspect this has to to with AviSynth+ plugin locations and some 'ghost in the machine' of past installs.


Andrew Swan said...


You are correct about the ConvertToYV12() command not being necessary if your video uses either 4:2:0 (YV12) or 4:2:2 (YUY2) chroma subsampling. I said that explicitly in the video tutorial, but I will amend the blog post to make it clear there as well.

As to colorspace conversions in VDub2 - I wasn't aware that it does a lossy colorspace conversion unless you tell it to, but I'll check and see. Thanks.

Unknown said...

Hello. Thank you so much for putting these tutorials together. As someone very new to converting video formats for editing, I was not having much fun (and zero success) with trial and error trying to piece information together from posts on various forums. Now I'm happily deinterlacing and transcoding sd minidv footage for editing in Resolve thanks to your blog and vids!

I did run into a problem with some .mts footage I have. It's AVCHD format, 1920x1080, 29.970fps, YUV 4:2:0, 8-bit interlaced with Separated fields, Top Field First. Using the same Avisynth+ script from your tutorial in VirtualDub2 (saving video as pro res, .mov) I get very jerky video jumps forwards and backwards when playing back the output file. I've tried both AssumeTFF() and AssumeBFF() in the script and the result is the same.

I did see an older posts on Doom9 that mentioned QTGMC not playing nicely with .mts files. I was able to deinterlace using the "built-in" filter (Yadif) in VirtualDub2 but the output file had some strange ghosting when played back. Using a free 7-day trial of Premier Pro and Adobe Media Encoder I was able to deinterlace and transcode the .mts files to pro res, but I have a lot of .mts footage and was hoping to avoid Adobe's subscription pricing. Are you aware of an issue with QTGMC and .mts files? Or could you suggest an alternate method of deinterlacing .mts files for editing in Davinci Resolve?



Unknown said...

Andrew -
I want to make sure that BilinearResize(720,540) is correct for my workflow.
I'm starting with AVI 720x480 HuffYUV, 29.970 (30000/1001) FPS 4:2:2 Interlaced captured in VirtualDub.
The desired output would be progressive .mp4.
My confusion/concern is to ensure the aspect ratio doesn't stretch or compress the content.
When I play the AVI in VLC and take a screenshot, the image is 1.5.
After encoding via QTGMC/Virtualdub workflow outlined here, the .mp4 screenshot is of course 1.33.
I've searched forums until my eyes cross, but find little reference to the 720x540 output, other than DV file sources.
Are the settings here recommended for an analog source (Hi8)? NTSC.
Thank you!

igoriando said...

Andrew, just wanted to say thanks, this is very useful workshop/introduction for the Avisynth newcomers, I've tried it on my DV clips and result is very appealing, this is encouraging!

Sim22 said...

Thanks for the excellent video. I wish all tutorials could be this good.

I've tried this on two PCs (one Win7 and one Win10) and on both I get no sound.

My AvsInfoTool gives the same result as yours (except my OS build is "Windows 10 (x64) (Build 19041)" whereas yours is Build 19042, and my CPU is 4 physical cores / 8 logical cores. My Win10 is up to date.

In case AviSynth+ uses Ffmpeg internally I've tried it with both the zeranoe build (which I already had) and the build (changing the PATH as appropriate).

I am using Media Player Classic HC (MPC-HC.1.9.8.x64).

I've tried it with three video files (an mkv, an mp4 and an avi). All have sound when played in MPC-HC directly.

I've tried searching the Doom9 forum, and general 'googling'.

I've tried playing the avs file both directly (MPC-HC opens) and in VirtualDub2.

FFMpegSource2 plays the video but with no sound.
DirectShowSource could not open any of the files.
AviSource could not open any of the files.

My avs script is a single line (I uncomment one line to test it):

# FFMpegSource2("video.mkv") # no sound
# DirectShowSource("video.mkv") # could not open
# AviSource("video.mkv") # could not open
# FFMpegSource2("video.mp4") # no sound
# DirectShowSource("video.mp4") # could not open
# AviSource("video.mp4") # could not open
# FFMpegSource2("video.avi") # could not open
# DirectShowSource("video.avi") # could not open
# AviSource("video.avi") # could not open

Is there something I could check? Being new to this it's possible I've done something stupid. But after five hours I'm out of ideas and I'm beginning to wonder if there's something affecting the sound on both my PCs.

Sim22 said...

It's important to note that, without the "atrack=-1" switch on FFmpegSource2(), there is no sound. Disabled audio is the default.

Andrew Swan said...

First of all, I'm really sorry for the delay on responding to comments. I keep trying to convince Blogger up to send me a notification emails whenever someone comments, and it keeps not doing it, and then I forget about it for awhile, check and notice that there's a bunch of comments unanswered. I think I've actually fixed it this time, but there's no guarantee. I'm seriously considering switching to a different blog platform in the future.

That being said, let me address the oustanding comments in order of submission:

@Chris: I haven't messed around with .mts files for a while, but pretty much every form of interlaced h.264 supposedly has issues with FFMPEGSource. You might consider transcoding to ProRes first using VirtualDub2 or Shutter Encoder, then running the results through AVISynth/QTGMC. Realize that full high definition video is going to be really slow to deinterlace in QTGMC, so you might consider dropping a little bit of visual quality and going for the "fast" or "faster" preset.

For the bilinear resize question: either 640x480 or 720x540 should be fine in your case. If you want to add a little bit of extra sharpening, try LanczosResize or Spline64Resize instead.

@igoriando: You're very welcome. :)

@Sim22: Yup. I mentioned that in the video tutorial, but I'll try and make it clearer in the blog post.

Dean said...


Thank you for your efforts, much appreciated!

Can anyone offer advice on troubleshooting the issue AVSinfo is finding (libfftw3f-3.dll)? I've tried redownloading and reinstalling the components involved. I tried adding the dll's to the System32 folder.

[OS/Hardware info]
Operating system: Windows 10 (x64) (Build 19042)

CPU: Intel(R) Core(TM) i5 CPU M 560 @ 2.67GHz / Arrandale (Core i5)
2 physical cores / 4 logical cores

[Avisynth info]
VersionString: AviSynth+ 0.1 (r2772, MT, x86_64)
VersionNumber: 2.60
File / Product version: /
Interface Version: 6
Multi-threading support: Yes
Avisynth.dll location: C:\WINDOWS\SYSTEM32\avisynth.dll
Avisynth.dll time stamp: 2018-12-20, 18:55:16 (UTC)
PluginDir2_5 (HKLM, x64): C:\Users\dean\AviSynth+\plugins64
PluginDir+ (HKLM, x64): C:\Users\dean\AviSynth+\plugins64+

[C++ 2.6 Plugins (64 Bit)]
C:\Users\dean\AviSynth+\plugins64+\ConvertStacked.dll [2018-12-20]
C:\Users\dean\AviSynth+\plugins64+\DePan.dll []
C:\Users\dean\AviSynth+\plugins64+\DePanEstimate.dll []
C:\Users\dean\AviSynth+\plugins64+\DirectShowSource.dll [2018-12-20]
C:\Users\dean\AviSynth+\plugins64+\ffms2.dll [2020-08-22]
C:\Users\dean\AviSynth+\plugins64+\ImageSeq.dll [2018-12-20]
C:\Users\dean\AviSynth+\plugins64+\masktools2.dll []
C:\Users\dean\AviSynth+\plugins64+\mvtools2.dll []
C:\Users\dean\AviSynth+\plugins64+\nnedi3.dll []
C:\Users\dean\AviSynth+\plugins64+\RgTools.dll []
C:\Users\dean\AviSynth+\plugins64+\Shibatch.dll [2018-12-20]
C:\Users\dean\AviSynth+\plugins64+\TimeStretch.dll [2018-12-20]
C:\Users\dean\AviSynth+\plugins64+\VDubFilter.dll [2018-12-20]

[Scripts (AVSI)]
C:\Users\dean\AviSynth+\plugins64+\colors_rgb.avsi [2016-07-05]
C:\Users\dean\AviSynth+\plugins64+\QTGMC.avsi [2021-02-06]
C:\Users\dean\AviSynth+\plugins64+\Zs_RF_Shared.avsi [2021-02-06]

[Uncategorized files]
C:\Users\dean\AviSynth+\plugins64+\colors_rgb.txt [2016-07-05]

[Plugin errors/warnings]

Function duplicates:

"undefined" : "[InternalFunction]"
"Undefined" : "C:\Users\dean\AviSynth+\plugins64+\Zs_RF_Shared.avsi"


"C:\Users\dean\AviSynth+\plugins64+\DePanEstimate.dll" requires the FFTW library for some functions.

Note: 'libfftw3f-3.dll' can be downloaded here:

'libfftw3f-3.dll' should be placed in "System32" and/or "SysWoW64"

"C:\Users\dean\AviSynth+\plugins64+\mvtools2.dll" requires the FFTW library for some functions.

Note: 'libfftw3f-3.dll' can be downloaded here:

'libfftw3f-3.dll' should be placed in "System32" and/or "SysWoW64"

Andrew Swan said...


If you're just using QTGMC, then this error doesn't necessarily mean anything.

If you want to use other plugins that require the FFTW library (or just to make the error go away), then try installing the 64-bit version of FFTW in your System32 directory in addition to the 32-bit version of FFTW in your SysWOW64 directory (same basic process for both, covered in the post).

Dean said...

That did the trick, thank you!

Kind of funny how the 64bit version goes in System32 and 32bit version goes in SysWOW64???

FranzLiebkind0 said...

Hi Andrew - fantastic blog and tutorial - I have been able to successfully deinterlace, sharpen, and lower the file size of a couple of my home videos following your guidance

I did run into an issue with one video - the source video is a VHS of a cousin's birthday shot by a professional vendor, that I had captured via my VCR to PC set-up using OBS (this is what I have done for all my videos)

This video however becomes "wavy" when there is motion after running QTGMC script - reference images in this link:

The top image is the interlaced original and the bottom image is the wavy QTGMC output

Below is my current script:
SetFilterMTMode ("QTGMC", 2)
FFMPEGSource2("First Birthday 98.mp4", atrack=1)
QTGMC(preset="Slower", EdiThreads=3)

I have tried AssumeTFF() as well as commenting out the resize/sharpening function but I still get the wavy output

Is there anything I can modify, or should I use an alternate deinterlacer


Andrew Swan said...

Frank - That looks suspiciously like your video was re-recorded from another source and possibly resized. When that happens, the interlacing becomes "baked in" to the image and can't be easily removed.

You might try a second QTGMC command with the progressive repair option like so:

Otherwise, good luck!

FranzLiebkind0 said...

Thanks Andrew - turns out the issue was the OBS capture output - no matter what I did I couldn't fix the issue. I have re-captured from VCR via Virtualdub capture function and QTGMC works perfectly now - thanks

neonfrog said...

Andrew, thank you for your work on this. I’m really new to this type of work, but as a technologist I’m keen to solve problems. I don’t speak the language of video processing beyond, “May I have a glass of water?” or “Where’s the bathroom?” but I’m getting better.

I spent a lot of time looking for deinterlacing solutions for Digital8 captures and VHS captures made through a Digital8 camera. Your steps are easy enough to follow and made for pleasing results, both high quality and streamable. Definitely helpful as I work through a theater organization’s decades of footage for a durable digital archive.

Like Chris above, I have a lot of footage in m2ts files from a Panasonic AVCHD camcorder. It’s all 1920x1080/29.97i. It plays just peachy in VLC which deinterlaces on the fly - hardly any noticeable artifacts. But lately we’ve had the opportunity to stream some of this footage over Zoom, and that’s where the interlacing becomes visually problematic. It is just nicer to have a progressive file for that. I’ve had some luck using Handbrake and EEDI 2 Bob, but the processing time is excessive (like 24 hours of 100% CPU for one hour of video (on an old 4-core machine)) and the end results were ... meh. Good enough, I guess. Considering my success with your instructions, I *really* wanted to use QTGMC as the deinterlacer for my AVCHD material.

I discovered the exact thing you mention: FFmpegSource2 does not play well with interlaced m2ts/h.264 files. Lots of image jumping. Telling it AssumeBFF/AssumeTFF didn’t work. I went down many rabbit holes, including briefly venturing into Hybrid. I was unsuccessful there, but a suggestion for fixing a similar processing problem in Hybrid led me to search for a bunch of terms that eventually led here. That page had some intriguing and simple AVS code for processing AVCHD files similar your workflow.

I installed the 64bit LSMASHSource dll into the plugins64+ directory of AviSynth+. Here’s the script I used:

a=LWLibavAudioSource(source="C:\Users\neonfrog\Desktop\Pirates\Act1.m2ts", stream_index=-1, cache=true, av_sync=true, layout="DL+DR", rate=0, decoder="")

It works! You can probably ignore my audio arguments (I have my reasons for downsampling 5.1 to stereo). I just drag that AVS script into VirtualDub2, monkey with my output settings to taste, and I go from 1920x1080/29.97 interlaced to 1920x1080/59.94 progressive via QTGMC. Looks nice! It cut my processing time down by 66%. I will say that playing it back locally, I don’t see a lot of difference between VLC’s on-the-fly deinterlacing and my QTGMC files, so deciding if it’s worth the effort is a personal decision. I just thought someone might appreciate this alternative workflow for these specific kinds of files.


Links used above:

LSMASHSource =

Hybrid =

Interesting forum posts:

Andrew Swan said...


Sorry for the days-later reply - your comment got flagged as spam for some reason.

Anyways, this is great info. I haven't really messed with LSMASH, but I'll look into it now.

In the past, I've used FFMPEG with the bwdif filter to deinterlace 29.97i HD content, which looks decent and is substantially faster than QTGMC. However, if you like QTGMC's results, you might consider using the "fast" preset for HD material - at that resolution, the difference between presets is a lot less noticeable, and "fast" is a lot faster than "slower".

Vodkomotornik Pictures said...

Hello teacher!
Well written - everything is clear and understandable.
I used to use Avisint 2.6 and QTGMC 3.32, but now I just can't configure it!
I did everything as described, but I have an error when opening the file in VirtualDub.
No function QTGMC!

My script:
AviSource ("E: \ 000 \ 2016-cineform.avi")
QTGMC (Preset = "Slow")
SelectEven ()

Avisynth Info Tool:

[OS/Hardware info]
Operating system: Windows 10 (x64) (Build 19042)

CPU: Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz / Ivy Bridge (Core i7)
4 physical cores / 8 logical cores

[Avisynth info]
VersionString: AviSynth+ 3.7.0 (r3382, 3.7, x86_64)
VersionNumber: 2.60
File / Product version: /
Interface Version: 8
Multi-threading support: Yes
Avisynth.dll location: C:\Windows\SYSTEM32\avisynth.dll
Avisynth.dll time stamp: 2021-01-11, 13:47:06 (UTC)
PluginDir2_5 (HKLM, x64): C:\AviSynth+\plugins64
PluginDir+ (HKLM, x64): C:\AviSynth+\plugins64+

[C++ 2.6 Plugins (64 Bit)]
C:\AviSynth+\plugins64+\ConvertStacked.dll [2021-01-11]
C:\AviSynth+\plugins64+\DePan.dll []
C:\AviSynth+\plugins64+\DePanEstimate.dll []
C:\AviSynth+\plugins64+\DirectShowSource.dll [2021-01-11]
C:\AviSynth+\plugins64+\ImageSeq.dll [2021-01-11]
C:\AviSynth+\plugins64+\masktools2.dll []
C:\AviSynth+\plugins64+\mvtools2.dll []
C:\AviSynth+\plugins64+\nnedi3.dll []
C:\AviSynth+\plugins64+\Shibatch.dll [2021-01-11]
C:\AviSynth+\plugins64+\TimeStretch.dll [2021-01-11]
C:\AviSynth+\plugins64+\VDubFilter.dll [2021-01-11]

[Scripts (AVSI)]
C:\AviSynth+\plugins64+\colors_rgb.avsi [2021-01-11]
C:\AviSynth+\plugins64+\Zs_RF_Shared.avsi [2021-03-11]

[Uncategorized files]
C:\AviSynth+\plugins64+\colors_rgb.txt [2021-01-11]

[Plugin errors/warnings]

Function duplicates:

"undefined" : "[InternalFunction]"
"Undefined" : "C:\AviSynth+\plugins64+\Zs_RF_Shared.avsi"

Andrew Swan said...

Did you actually put the QTGMC.avsi file in your plugins64+ directory? I don't see it listed in AVSInfoTool's output.

Vodkomotornik Pictures said...

Yes that's right! I forgot about him - everything works!

Plubbingworth said...

Are you sure that EdiThreads refers to physical cores and not logical cores? The Avisynth wiki page for QTGMC seemed kind of ambiguous about it. In one instance it just says "cores" and one time it says "logical cores".

Andrew Swan said...

@Plubbingworth - On review, you're correct, and I'm not 100% sure.

I think I could probably eliminate EdiThreads from my script template entirely, as the default of 0 - which just uses all cores - seems to be stable now. It could be that the switch to 64-bit did that, or improvements to AVISynth+'s memory management, or just updates to QTGMC itself.

Regardless, good point - I'll update the blog post.

DroneOps SA said...

I ran across something interesting that might be a quick fix for someone looking to deinterlace and get "59.94" progressive footage from captured HDV tapes.

First off, I freely admit I know almost nothing about interlaced footage. I've been editing for about 8 years, but exclusively DJI, GoPro, Canon & Sony footage, progressive, AVCHD, XAVC, 1080p & 4K. Recently, someone dumped a hard drive on me & asked if I could produce some nice "memory lane" videos for them. It was amateur sports / extreme sports content, shot on a couple different Sony HDV tape cameras circa 2008-2010. I tried using the standard best practice technique for Premiere Pro that I could find, and the results were pretty underwhelming.

I took one of the master files and ran it through the process described in this post, while simultaneously taking the opportunity to to a temporal up sample (what is the proper word for this?) to 59.94 progressive, and the edited result was much better. However, it took a long time, a lot of processor activity and electricity in my country is frightfully expensive. The idea of processing several hundred gigs of files this way was financially unappealing.

By random chance, I tried doing this, using Premiere Pro CC 2019:

Load the master files in to PP2019. Master files in my case are are MPEG2 HDV 1080i 24.3Mb/s 1440x1080, 29.97 Top Field First BT.709 according to MediaInfo.

Without conforming the master files in any way, drop one on the time line. A 29.97 interlaced sequence is automatically created. Do NOT right click on the clip and modify "Field Options" to "Deinterlace Always". They *must* stay at "None". Edit the file as desired. Add slow motion using Optical Flow if desired, all the way down to 50% still looks fine.

Now for the crazy part. Bring up the export screen, select H.264, for an easy head start, select the YouTube 1080p Full HD preset. But now unlock the frame rate by unchecking the box, and set it to 59.94. Field order should already be progressive from this preset, and so should Aspect Square Pixels. I also had Render Max Depth and Use Max Render Quality checked. I then exported the file...

I was shocked to find that the exported file plays like a real 59.94 progressive video. There are no combs when played in VLC with Deinterlace turned off, and it has the nice smooth look of 60fps action cam or Sony mirrorless video (desirable for sports, not so much by filmmakers). MediaInfo confirms that it is a progressive file, and it is not longer anamorphic 1.333 pixels, but an actual square pixels 1920x1080 video.

Further testing shows that a file exported this way looks **significantly** better than one exported using "Match Source, High Bitrate" (which sets frame rate to 29.97 and field order to interlaced), or using a 29.97 progressive preset. Also, modifying the clip "Field Options" to "Always Deinterlace" THWARTS this process completely. Exporting an Always Deinterlace modified clip using the customized preset I mentioned above comes out looking like it was recorded at 20 fps or something!! Also, this custom export takes about 2x longer than when Match Source is used (but is still 2x real time on my machine), and spikes the processor & CUDAs much, much harder, which would seem to indicate that some additional processing is taking place.

I realize my technique is probably the equivalent of high fructose corn syrup vs real Vermont / Quebec maple syrup, but does anybody much smarter than me know WHY this even works at all?? It is completely contrary to all the instructions in best practices tutorials. And it's going to save me a ton of kilowatt hours.

Note - I can't test this with any other type of content like SD, and since PP2020 slowmo is broken for over a year (no wonder The Slow Mo Guys use Final Cut), I don't feel like installing to see if it works in that version. But maybe this can work for you, if you are not doing broadcast work, and looking for a quick solution.

Andrew Swan said...

@DroneOps SA:

Thanks for the tip!

I went and did some testing, and can confirm that your hack works for HDV content. However, when I tried it on my (full HD) interlaced master of a documentary that I worked on, the interlacing lines remained. So my guess is that due to the goofball way in which HDV is encoded, your hack is tricking Premiere into displaying both fields instead of the usual Premiere deinterlacing method, which is to toss out every other field. In both cases, the results look line doubled, which loses some resolution versus interpolation. However, considering that most people don't pixel peep footage like this, I would consider it an acceptable hack.

To be a bit more fiddly, I tested and compared different deinterlace methods. I wish I could attach images easily, but basically, QTGMC smooths diagonal lines and cleans up some compression artifacts, even if you use the "Fast" preset - which I would recommend for HD footage to improve processing times.

DroneOps SA said...

Thank you for your response, Mr Swan. As you and several others have mentioned, this is a deeper rabbit hole than even Morpheus would admit!! Poor Neo, he will never get his editing done!

My initial tests using your method were on very short clips, probably created by a false start recording (press record, realize this is not the moment, press stop a few seconds later). I put some longer clips in, and on closer inspection, the skipping problem that @neonfrog discusses was all over the place in my output clips. This is SO obviously not a TFF / BFF problem, because it isn't wobbling back & forth across subsequent frames (I broke that too, just to see how it looks), it's like it forgot which frame in the GOP it is supposed to be working on & bounces back forth across many frames randomly.

I thought this was a little strange, because my source files are definitely not AVCHD, and definitely not H.264. It turns out I have 2 types of source files. One was created by the camera connected to a firewire card scanning into a computer running something called Ulead Video Studio (based on the file name & search results), which is now owned by Corel, and supported HDV literally years before Adobe did, so I assume that's why it was used. The other type of file is from the same camera, but with something called a "HVR-MRC1K flash recorder" attached, which appears to automatically "capture" everything coming out the firewire port, save it on a CF card, and eliminate the step of capturing the tape. Here is the relevant MediaInfo (from a flash recorder file, however a file recorded into Video Studio has absolutely identical meta-data as below, except for the record time):

[blogger is complaining about the MediaInfo copy / paste, I'll try putting another post below]

Anyway, these files look absolutely horrible when deinterlaced using FFmpegSource2, but come out perfectly when using Lsmash. So maybe it is not so much the compression method, but just the fact that it comes from a tape based camera? I certainly have no idea, but maybe this info will help someone else finding the same problem. Also, my hack method is not impeded by the problem, which I see as a bonus.

All that to say, I did a comparison of my Premier Pro hack (I upped the encoder rate to 50Mbps H264 on the export) versus Lsmash VirtualDub2 H264 with Quality 10, which worked out to 49.8Mbps. Played back with VLC full screen on a 43" 4K Samsung TV connected as a monitor (properly configured for computer use over the HDMI port), I finally was able to see what you are talking about... there is a subtle, but noticeable increase in quality using the Lsmash method.

But then I took a couple Lsmash deinterlaced files, imported them back into my Premiere project, and created a new 59.94fps 1080p project to export at a more reasonable 10-15Mbps like I would deliver a finished 1080p project to any client, and at that stage, there was no obvious difference. I don't know if that is a low number for you G8 nationers, but here in Latin America most people still use Core i3 laptops with 5400rpm 500GB hard drives, so you can't go around giving them videos with 50Mbps bit rates, or they tell you stuff like "it's too big", "my hard drive is full" "Can you put it on the cloud for me" or "it doesn't play on my computer".

Thank you so much for your time and tutorials, Mr Swan. I learned a lot. I'm going to use my hack for this job, but at least I know the right way if I ever need to get every last bit of quality. And maybe my hack will save some other people with lower quality requirements some time.

DroneOps SA said...

MediaInfo for a file from a Sony HDV camera with a Sony flash recorder HVR-MRC1K. The info is absolutely identical in every way to a file from the same camera captured to a computer via firewire (except clip length & recording time, obviously):

Format : MPEG-TS
Commercial name : HDV 1080i
File size : 58.4 MiB
Duration : 18 s 986 ms
Start time : UTC 2009-12-04 13:30:41
End time : UTC 2009-12-04 13:30:59
Overall bit rate mode : Variable
Overall bit rate : 25.8 Mb/s
Maximum Overall bit rate : 33.0 Mb/s
Encoded date : UTC 2009-12-04 13:30:41

ID : 2064 (0x810)
Menu ID : 100 (0x64)
Format : MPEG Video
Commercial name : HDV 1080i
Format version : Version 2
Format profile : Main@High 1440
Format settings : CustomMatrix / BVOP
Format settings, BVOP : Yes
Format settings, Matrix : Custom
Format settings, GOP : M=3, N=15
Format settings, picture structure : Frame
Codec ID : 2
Duration : 18 s 819 ms
Bit rate mode : Constant
Bit rate : 24.1 Mb/s
Maximum bit rate : 25.0 Mb/s
Width : 1 440 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 29.970 (30000/1001) FPS
Standard : Component
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.518
Stream size : 54.1 MiB (93%)
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

DroneOps SA said...

Wow, this is embarrassing to be back here again so soon.

But I think this is valuable information... there might be an issue / bug / problem with NEW versions of FFmpegSource2. Mr Swan, I went back to your tutorial from last year, and grabbed the version that came out around the time of your tutorial: ffms2-2.23.1-msvc

I replaced ffms2.dll in the avisynth+ directory, and **instantly** the MPEG2 HDV test files I was using played nicely in AvsPmod, and exported nicely from VirtualDub2. Switch back to the new dll, and back to skipping. In other words it's not a coincidence. Also re downloaded the new version ffms2-2.40-msvc just to be sure. To be clear, Everything else was using your new instructions, only the FFmpegSource2 dll was older, and the older version was perfect.

Then I found this guy on Doom9 forums who made a lot of tests, which seems to confirm that new FFmpegSource2 is not working properly. Also notice that he says Lsmash / LWLibavVideoSource is working perfectly (people say his computer is too weak, but I have 16 cores /32 threads + 128GB memory on mine which darn well better be strong enough, and it is broken for me too):

_______________ Start Doom9 Post
Posted by manolito:
I got curious and made a couple of tests using different source filters with Atak's SeekTester 1.2. I used the default frame limit of 1000 frames. As the source I took the "Letter - SHE'S.mkv" (VP9 Video 1080p). My CPU is a Core i5 third generation (2 physical cores plus hyperthreading). I used the default thread values for all source filters which would be 4 for this CPU.

FFMS2 StvG from Oct. 2020: There were 12 corrupted frames out of 1000 frames.

FFMS2 StvG from Aug. 2020: Same

FFMS2 StvG from April 2020: Same

FFMS2 StvG from Nov. 2019: Same

FFMS2 C-Plugin latest 2.31 by qyot27: Perfect

FFMS2 C-Plugin by Reino: Both available versions fail miserably.
Mainly corrupted or inserted frames

FFMS2 official version 2.40 by Myrsloik: Fails miserably.
Mostly corrupted or inserted frames

DirectShowSource with LAV Filters: Many inserted frames

DSS2Mod with LAV Filters (preroll=15): Perfect

LWLibavVideoSource by HolyWu: Perfect

Ok, these results are only for this specific VP9 source file. Other source formats may behave differently, but I find this very interesting. Any comments?
_______________ End Doom9 Post

Andrew Swan said...

@DroneOps SA

Great info. I'll update the post to warn downloaders about version 2.40 of FFMS2.

Ionut-Alexandru said...

Hi Andrew,

Thank you very much for your detailed blog post and the companion YouTube video! I was extremely impressed by QTGMC and it's performance on the Slower preset, even with horizontal and vertical motion in the frame.
I have one quick question: for BilinearResize, does it make sense to resize from HDV 1440x1080 to 1920x1080 or is there a flag that I should flip somewhere to adjust the PAR from 1.33 to 1?
I apologize in advance as I am still a newbie into the recording and processing scene.
Thank you for your great work and support!

Ionut-Alexandru said...

@DroneOps SA
I've captured multiple HDV files in .m2t format, source is a Sony HVR-Z1U using HDV Split without any issues. May I recommend checking the recording software and testing HDV Split in VCR mode over FireWire? My current setup uses a very old (2000) TI OHCI PCI card with Windows 10 x64 and the Legacy FireWire drivers and works as expected. QTGMC did the deinterlacing trick perfectly without any artifacts.

I've had some issues when the recording starts on tape, however I assume it's a known issue for the interlaced video frames to sync in the first few seconds of recording (I'm also looking into getting a head cleaning tape).

Andrew Swan said...


You're very welcome. I personally would just resize HDV to 1920x1080 unless you want to write back to HDV tape for some reason. Just remember that you can use a resizing method with some mild sharpening if desired such as Lanczos or Spline64, and wait until the final step to resize (before PreFetch() ).

Ionut-Alexandru said...

@Andrew Swan
Thank you for the tip, Andrew. Indeed, with Spline64 there is a proper increase in sharpness. Also, looks like my artifacts when changing scenes disappeared. Not sure if it's a QTGMC issue or just a resizer quirk. Splin64 seems to be the key for HDV conversion from 1080i60 to 1080p60.

Ionut-Alexandru said...

@Andrew Swan
One last rookie question: my original .m2t HDV file was recorded with BT.709, however the deinterlacer script output shows BT.470 System B/G. Is there a flag or additional function I can use to keep the same color space as the source?
Thank you for your support!

Andrew Swan said...


Do you notice a color or gamma shift? If not, I wouldn't worry about it. If it really bugs you, you could try either ConvertToYV12() or ConvertToYUY2(), but if you're rendering out using VirtualDub2, it should convert to whatever colorspace your rendering codec of choice uses automatically. If you want to use command-line FFMPEG, *then* it might be an issue.

DroneOps SA said...

@Ionut-Alexandru - I'm sorry my posts were kind of long, so maybe you didn't see it. Some of the files I am working with are from a Sony HVR-MRC1K. If you search it (like I had to), you see it is a box Sony made that connects directly to the camera and captures the transport stream from the firewire to a file on a CF card every time REC is pressed. I think it even works with your camera. On a Z5U it has a connector to clip on behind the battery so it is almost part of the camera. So files from this box are the **purest** form of MPEG2 TS that can possibly exist, I think. They are literally made by Sony themselves. If Sony don't know how to make the file, what hope do any of us have?

We ended up discovering that FFMS2 2.40 (and maybe versions near it) are broken. The TS files I have are fine.

Also, I appreciate your suggestion sir, but it is a customers files, and he sold his V1U and Z5U cameras many years ago. What I have on his hard drive is all there will ever be. I will use the quick hack I describe above to give him memorable results, without burning too many kilowatt hours, and spending too much time he won't pay extra for.

I also had the same question about REC709 becoming BT470 System B/G. It definitely comes from something in the deinterlace process. When I forced it to REC709 in VDub2, it would not play in the Win10 built in player, and Windows wouldn't make a thumbnail for it. I had to use VLC. I haven't tried forcing it in ProRes yet, but it definitely goes to legacy BT470 in ProRes too. Then when you put the Prores in Premiere, then export from Premiere Pro, it is back to REC709 again - which they say is correct for HD Video. I would have thought that the deinterlace process would just pass through this info, but apparently not, it is making it's own, incorrect info. To be fair, I do not see any color shifts, but I also have no scientific tools to check.

All this stuff makes me appreciate my 100% progressive drones, GoPros and Sony A7S-iii 1000x what I did a week ago!!!

Ionut-Alexandru said...

@Andrew Swan
You're right, I didn't check the Pixel Format option in the Video Compression settings. It defaults to 601, however it can easily be changed to 709.

Ionut-Alexandru said...

Apologies for my ignorance, I unfortunately did not read all your comments in entirety. I stand corrected.

@Andrew Swan
I'm sorry to bother you again. While I was able to force BT709 into the x264-mp4 output through the encoder settings, I can still see color discrepancies between my transport file and the final mp4. Notably, reds, yellows and bright shades of colors look off in the final output, washed out and bland.

I have tested this behavior on VLC, MPC and Mplayer, side-by-side on my monitor calibrated less than 2 weeks ago (granted, I am aware that some media players ignore part/full ICC profiles in Win10; however, even if that is the case, I assume it would impact both player windows in the same fashion, essentially outlining the actual color difference between the two streams open in the same program, if that makes sense).

I am unsure what I'm doing wrong or how I can fix this behavior. My only thought is to try to re-deinterlace, with "No change" selected for the Color Space and Component range in the VirtualDub Compressor settings. In addition, I've noticed that the transport stream has more properties (Color primaries, Transfer characteristics) than the final deinterlaced file (Matrix coefficients). Unsure if that makes any difference for rendering and playback.

Apologies in advance for my rookie questions. While I can build a phone or a computer from the semiconductor fab level all the way to the application interface, I'm still learning the art of video recording, deinterlacing and post-production.

Ionut-Alexandru said...

@Andrew Swan
I was able to fix the colorspace conversion issue.
For x264, in Pixel Format, Color Space -> No Change, Component range -> No change.
In the x264 configuration, Extra command line -> --colorprim bt709 --transfer bt709 --colormatrix bt709.
This will force the encoder to honor all VUI settings and help VLC/MPC/Mplayer to render it properly, as well as dictate the proper matrix for NLEs.
In Hybrid it's easier, just select the proper values in x264 -> VUI.
Thanks for all your help and happy de-interlacing :)

Which deinterlacing algorithm is the best? Part 1 - HD interlaced footage

Before I began, I'd like to give a special thanks to Aleksander Kozak for his help in testing and providing the HD footage used in this ...