Friday, September 21, 2018

Tutorial - Deinterlacing and upscaling with 32-bit QTGMC revisited

Hey folks - just wanted to let you know that this tutorial is now officially outdated.  I'm leaving it up here are for up historical interest, but here's a link to a post that I will maintain from this point forward with the current instructions for setting up AVISynth and QTGMC:



================================================


After more than a year and a lot more experience with my SD to HD workflow, I’ve made a few changes. That means it’s time for an update.

Some of the larger changes include switching to AVISynth+ instead of standard AVISynth plus AVISynth MT, dropping the “source match” and “lossless” presets from QTGMC, and updating a whole mess of plug-ins. In total, these changes result in better speed, stability, and image quality.

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.

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.

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 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 a basic QTGMC deinterlacing workflow:



And here's a video about cropping and upscaling:



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

https://github.com/pinterf/AviSynthPlus/releases

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

FFMPEGSource

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. Also, don't bother with the "10-bit hack version", as we won't be working in 10-bit color.

11/6/2018 Update: looks like Jiangmin antivirus is currently flagging FFMpegSource with a warning on VirusTotal. Given that no other antivirus engines have spotted anything, I'm cautiously calling this a false positive, especially because one of the top search results for Jiangmin on Google is a post about the problems with reporting false positives to them.

QTGMC

The deinterlacing plugin of choice. Requires a whole host of additional plugins, of which you will be using the 32-bit versions (if there's a choice). For most uses, however, only the "Core Plugins and scripts" are necessary. Thaks to one anonymous commenter, I should mention that if you're trying to import YUY2 colorspace video (some pro video codecs use this) without converting, you'll also need the AnimeITVC plugin.

Update: the 64-bit version of QTGMC and related programs are now stable, and slightly faster. You can find info on how to install those versions here:

https://macilatthefront.blogspot.com/2018/10/64-bit-avisynth-and-qtgmc-update-and.html

For the SmDegrain link, go to the page and click on the tiny "download" link next to the "raw" link. When you save the file to your computer, rename the .txt extension to .avsi.

If you decide to grab the optional plugins, then for the AnimeITVC pastebin link, select the text of the link and copy it, then right-click on the link 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. Most people won't need this plugin, thankfully.

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

If you need to sharpen the image, I recommend LimitedSharpen (Technically "LimitedSharpenFaster"). Get the x86 version in order for it to work within a script using 32-bit QTGMC.

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

AvsPMod

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

FFMPEG

Update: since Zeranoe has shut down, I will be recommending compiling 32-bit FFMPEG from source using https://github.com/m-ab-s/media-autobuild_suite . Since this tutorial is getting a little long in the tooth any ways, I'll just leave this here as a placeholder until I create a newer and better version. 


7-zip

If you don't have 7-zip already installed, you won't be able to open many of the downloaded archives. The version you get here doesn't matter, so maybe just do the 64-bit one.

After virus scanning everything, install:

7-zip
AVISynth+

Just follow the default options in both cases. Then, go to the plugins directory for AVISynth+. On my system, the default installer creates a plugin folder at

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

Extract all .dll and .avsi files to the plugins directory from all plugins EXCEPT the fftw-3*.dll archive. If there's a choice between x86 and x64, use the x86 version. 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 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 is seems pointlessly tedious.

Extract the AvsPMod archive to wherever you want to run it from.

Finally, open the ffmpeg archive, 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.
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. Alternatively, you can just create a new text file and chance the .txt extension to .avs.

Right-click on the .avs script, choose "Open With", then "Choose Another App", then check "Always use this app to open .avs files", then scroll down the list of apps until you see "More Apps". Click on that, scroll some more until you see "Look for another app on this PC". Click on that, navigate to where you extracted AvsPmod, select avspmod.exe and click OK. Your .avs scripts will now automatically open in AvsPMod when you double-click on them.

In a few moments, you should now see your blank script open in AvsPmod.

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

    SetFilterMTMode ("QTGMC", 2)
    FFMPEGSource2("videofile.avi", atrack=1)
    ConvertToYV12()
    AssumeBFF()
    QTGMC(preset="Slower", EdiThreads=1)
    BilinearResize(720,540)
    Prefetch(10)


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, but your mileage may vary. If you experience any random rendering freezes (not overall system freezes), then lower this number first.

Also, a quick note here: Amazon and some other streaming services prefer 640x480 over 720x540 for SD content. I use the latter because I consider the resulting file a new "master" file that can be used to create future derivative versions, but if you're going to send the file directly to a distributor or service, read/ask for their deliverables spec to see what resolution and framerate they want.

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

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

Anyways, here's what to add if you want to upscale to HD with a center crop:

    Crop(0,68,0,-68)
    Spline64Resize(1280,720)

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 crop command doesn'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:

    Crop(0,0,0,-136)

If your initial video has noticeable compression artifacts, you might want to do BilinearResize instead of Spline64Resize to avoid accentuating said artifacts. If it's clean and you want to sharpen even more, LimitedSharpenFaster does a a good job of this.

    LimitedSharpenFaster()

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.

Loading this script in AvsPmod will let you preview your results, and change to your preference. To preview your settings, click anywhere on the playback bar at the bottom of the window. The first time you do this, FFmpegSource will index your file, so be patient. 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 -profile:v 3 -pix_fmt yuv422p10le "output.mov"

If you need to convert to a different video format, search for options and further instructions on the FFMPEG Wiki.

PS: FFMPEG 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.

40 comments:

Unknown said...

Thank you for documenting all of this. Just today I was planning on revisiting your old video tutorial to set up my own workflow. Now I think I will wait until your new video tutorial is available.

However, for archival reasons, I recommend making the old video tutorial available again.

Cheers!

Andrew Swan said...

Thanks!

I'm making the old tutorial video "unlisted", which means essentially you can only get to it from the original blog post now, rather than a general YouTube search. This is to prevent people from finding it, watching it without paying attention to the notifications and text warnings I put up about it being out of date, and complaining that it doesn't work.

The new tutorial video should be out soon.

Unknown said...

Hey, nice tutorial. Typo in your script SetFilterMode should be SetFilterMTMode.

Unknown said...

Hi mate, 2 typo in your script on blog page, correct in the video.
SetFilterMode --> SetFilterMTMode
and
EdiThreads=1") --> EdiThreads=1)

also I found that AnimeIVTC.avsi is required. I was getting errors without this.

Unknown said...

Thanks! This is a brilliantly clear explanation of a pretty complex install.

There's a typo in your boilerplate example. There's an extraneous double-quote mark in 'EdiThreads=1")'.

Also, on my install with AviSynth+ v2772, 'SetFilterMode' produces an error. I changed it to 'SetFilterMTMode' (as guided by AvsPMod) and it works.

Andrew Swan said...

To both of the folks who caught my typo: belated thanks. Your comments were flagged for some reason, and so I just got them today. I'll be checking moderated comments daily now. :/

Andrew Swan said...

And to the person who said AnimeITVC is required, you must be importing YUY2 colorspace video. I'll put a mention of that in the blog. Thanks.

Emil said...

Thank you for doing this step by step installation tutorial. As a Mac user lost in the Windows world it's quite confusing what goes where. However...

I'm installing this on a new Windows 10 build 1809 installation. After everything is installed and rebooted, I get an error from AvsPmod 2.5.1 when trying to open the Test.avs. "The specified module could not be found. Loading avisynth.dll failed! Make sure that AviSynth is installed. Alternately, specify now its directory." Even after showing it to the SysWOW64 directory, it still shows the error.

If I uninstall AviSnth+ an d install the plain AviSynth 2.6, the AvsPmod opens correctly. However, since I'm new to AviSynth and QTGMC I don't know how closely I can continue to follow your video or if I have the right versions of the plugins. Any idea what may be happening with AviSynthPlus-MT-r2772?

Emil said...

Hi, I sent a comment yesterday about an avisynth.dll error message.

Never mind, I figured it out. Apparently I didn't have all the required C++ and .Net framework flavors installed. So now I have C++ 2010, 2012, 2013, 2015, 2017, .Net 3.5 and 4.7. I have no idea which ones were not installed properly, I just reinstalled them all and now AvisynthPlus-MT-r2772 and AvsPmod run without errors.

You may want to add a note for first time installers and those new to this kind of thing that those are requirements before some of the programs and plugins will work.

Andrew Swan said...

Good catch. I've installed a lot of stuff over time, so I think I just already had the necessary frameworks installed. I'll check on the AVS+ homepage and see if I can find the specific version it requires.

Steve Kauzlarich said...

Hi Andrew: I looked at some of your videos and checked your blog. You really know what you're talking about, but it's still a heck of a learning curve for me that I would have taken at 30, but at 64 not so much. I have over 300 hour+ videos that I shot of WWII vets (plus many other aviation related videos) that I need to capture from their source tapes of Hi8, DV, DVCAM and HDV60i. In many cases I need to capture the audio on a second pass because it's PCM and can't be read by my digital 8 player. Then I need to edit and and send somewhere where they can be preserved (Library of Congress??). As an editor yourself you can imagine how much work is involved even with simple titles, grading, audio sweeting, etc.

I'm in loose touch with the guy who wrote DV Avi helper and he said that he was working on an upgrade that would work even better, but he stalled out (one can only give so much time to hobbies). I'd imagine that this upgrade may have to do with the newer avsynth and other plugins thaty you're familiar with.

Have you ever considered creating a set of scripts that would deinterlace, upscale, denoise and frame double within some form of an interface? Or is that what all your tutorials combined would do if I took a deep dive into it? I was telling Al that this is something that could be marketed. I'd easily pay $200 if it was available, and probably more. But of course the market is limited.
Thanks, Steve

Andrew Swan said...

Hey Steve,

Thanks for the kind words. I appreciate the offer, but part of the reason I show the "hard way" is to avoid issues like the above mentioned where a compilation pack maintainer can't continue to update their custom solution. If I was to put out something, *I'd* be the one having to maintain it, and I don't feel right charging for a few scripts that are used by free software.

However, I do appreciate your perspective. Not everyone has the time to put into setting up this workflow. If you want more of an interface, I'm looking into doing a video in the next few months about FFATrans, which is something similar to what you're looking for. It's not quite plug-n-play, but it has a simpler workflow, can do batch encoding fairly easily, and is designed for professional usage.

There's also wrapper programs like Hybrid and MeGUI that can provide some level of abstraction from the underlying text files, but I still feel that understanding what they're actually doing is important so you can troubleshoot in the event of something going wrong.

If you really need a simpler solution, the FieldsKit plugin can handle the deinterlacing side of the workflow really well, or you can find a post studio with a realtime conversion box like a Teranex that might work. Both cost money (especially the latter), but are pretty battle-tested in professional workflows.

If I find a simpler solution, I'll be sure to post/make a video about it.

minh nghia said...

Thank you. I'm planning to upscale a famous film in my country (Cyclo 1995) and your docs help me a lot! I passed out a lil bit when I came across the documentation for QTGMC but your post made it clear to me. Thanks!

Andrew Swan said...

You're quite welcome. Glad I could help. :)

AGiLiT said...

Thank you, thank you, thank you! I am just getting around to processing some old avi files created from a DV camcorder that are interlaced and come out in the wrong display aspect ratio. I have tried several different methods of deinterlacing them before processing for storage back on my media server and nothing was quite good enough. QTGMC does wonders, but I don't think I ever would have gotten it set up without your guide.
I'm sending you something in return via. email: I wrote a macro for AvsPmod that can read a directory of files and output scripts for processing with FFmpeg. I had split the tapes by scene when I first processed them, so each one could have hundreds of files and there's no way I would have been able to process them individually. I'm going to post it in the Doom9 forum as well once my 5 day new member lockout expires, if anybody follows this thread.

Bassquake said...

Thought its worth mentioning you'll need to install and add other plugins to get this to work thats not mentioned here. I'll just list the files I have in the C:\Program Files (x86)\AviSynth+\plugins+ folder, you can search for each to get latest one. Don't forget to only use 32bit versions! You might already have some of them installed.

AnimeIVTC.avsi
colors_rgb.avsi
colors_rgb.txt
ConvertStacked.dll
DePan.dll
DePanEstimate.dll
DirectShowSource.dll
FFMS2.avsi
ffms2.dll
ImageSeq.dll
LimitedSharpenFaster.avsi
masktools2.dll
mvtools2.dll
nnedi3.dll
QTGMC.avsi
RgTools.dll
Shibatch.dll
SMDegrain.avsi
TimeStretch.dll
VDubFilter.dll

Took a long time time to get this up and running!

Andrew Swan said...

What wasn't working before you added the other plugins? I tested the install from scratch, and I only needed the core plugins and the FFTW3 library to get QTGMC working.

Bassquake said...

I kept getting errors about missing functions. So had to add the extra plugins.

Did you have the original AviSynth 2.6 already installed? It seems AviSynth+ uses plugins from the 2.6 plugins folder too so you might already have them.

Either way, I got it working now.

Andrew Swan said...

Nope. I just had AVS+ installed. If you have AVS 2.6 installed at the same time as AVS+, though, that can lead to weirdness.

If you've already got it working, then you probably won't want to mess with it, but if you ever decide to reinstall for some reason, I would recommend only installing one or the other. Alternatively, you could also install the 64 bit version of AVS+ and just have the 32-bit version of AVS 2.6 installed for compatibility with older plugins.

Bassquake said...

Ended up using VirtualDub with Deinterlace Yadif as got better results. This was effect I was getting in QTGMC: image

Can see halos or ghosting and repeating patterns (see around leaves). Tried all sorts of different settings for QTGMC.

Oh well. Yadif serves it purpose anyway.

Andrew Swan said...

Fair enough. I personally don't like Yadif because of the sacrifice in resolution, but you're absolutely right that QTGMC will generally have a certain amount of ghosting.

It's pretty similar to the different variants of motion interpolation in general, where you sacrifice detail for smoothness of motion or vice versa.

If you're interested in trying deinterlacing in FFMPEG, they have another algorithm available called bwdif that's similar to Yadif, but may provide better results in some circumstances. I've tried using it on high definition interlaced material with some decent results.

Peter said...

Hi Andrew,

Thanks for all the work you did! I have now moved from using MeGUI to your method. Learning a lot. I did manage to create good upscaled videos from my avi's. Now I am trying to use your script for creating a video from an avi produced via frameserver in Vegas Pro. This is the method I have been using successfully with MeGui. However, when I run your script example, I am get an error indicating "FFIndex: Audio codec not found". I have done searches for a solution, but no luck. Any thoughts on what script I should add to pull the audio from my frameserver produced avi?

Thanks again!

Peter

Andrew Swan said...

Peter,

First, thanks for your kind words.

As to the frameserver - I haven't used it in many years.

My guess is that you should try using AVISource to load it versus Ffmpeg2Source, as that's probably the source filter that the frameserver was built to use. If that doesn't work, I'd suggest exporting your project out using an intermediate video codec (ProRes, Cineform, DNxHR, etc) first, then performing any desired processing on that file instead without using the frameserver.

Peter said...

Thanks for the quick response Andrew! Much appreciate it.

Your suggestion of "AVISource" works, thanks! I did have to remove the "atrack=1" that was used for Ffmeg2Source, since I wasn't getting sound. I just removed it and let the routine apply a "guess".

Following is what I have, and the output looks good. I need to tweak it a bit yet, but am getting better results than what I had with MeGui, thanks to you!

-------------------------
SetFilterMTMode("QTGMC",2)
AVIsource("v:\fs.avi") #removed atrack=1 since it did not work. But "guess" is applied and it works.
ConvertToYV12()
AssumeBFF()
QTGMC(Preset="Slower", Edithreads=2)
BilinearResize(720,540)
Crop(12,6,-8,-8) # for cleaning edges of video.
AddBorders(126, 10, 126, 10) # allows full video within 1280 x 720 without image cut off.
Spline64Resize(1280,720)
Prefetch(3)
-------------------------

Peter

Steve Kauzlarich said...

Go to this link and scroll down until you find a guy named Al. He wrote some drag and drop scripts called "avi helper". It will deinterace avi files by creating frames from fields and produces 60p mp4s. If you want, it will up scale the videos as well. It's simple with unbelievable results. It also batches. https://forum.videohelp.com/threads/370304-How-do-convert-a-Digital8-AVI-to-play-on-a-Roku3

Anonymous said...

Thank you for the tutorial. I converted a video using this method and now the skin color has a purple tint. However, it looks right in the viewer. Any ideas?

Thanks, Josh

Andrew Swan said...

That's a tough one to answer without narrowing down some things first.

1) What video playback software are you using? VLC? Windows Media Player? MPC?

2) Did you encode your video to ProRes, or some other codec? If the latter, which one, and what settings did you use?

Anonymous said...

I tried VLC and Premiere Pro.

The videos original format was m2ts. I converted them to ProRes 422 HQ using Adobe Media Encoder. I did this because QTGMC was having trouble with the m2ts.

The color appears correct in the AviSynth previewer.

SetFilterMTMode("QTGMC", 2)
FFmpegSource2("video.mov", atrack=1)
ConvertToYV12()
AssumeTFF()
QTGMC(Preset="Fast", FPSDivisor=2, Edithreads=2)
Prefetch(6)

It is messed up after conversion. The color is high in contrast and has a purple tint.

ffmpeg -i "video.avs" -c:v prores -profile:v 3 -pix_fmt yuv422p10le -c:a pcm_s16le "video.mov"

Is there something obvious I did wrong. If not don't worry about it.

Thanks, Josh

Andrew Swan said...

I don't see anything obvious. Maybe try proes_ks instead of prores for -c:v?

degmet said...

Hello Andrew, this post was very helpful to me. I have some DV files from my JVC camera and I wanted to deinterlace them with the best quality. At first, I made several attempts with Shotcut, but I was not convinced with quality.


After reading somethin on Internet, I foundyour post and I've followed the tutorial in Youtube. I have some issue with AvsPmod 32bits, it couldn't find avisynth.dll. I tested with AvsPmod 64bits, and it worked fine. I copied 64bits filters to folder plugins64+, just in case.
The camera has a 16:9 wide aspect with resolution 720x480 so, as I understand, it used a non square pixel.
I'm not a video expert, so I want you to look at my script.
The source file information is:

General
Complete name : C:\Users\dario.egea\Videos\dvgrab-2018.04.22_22-49-41.dv
Format : DV
Commercial name : DVCPRO
File size : 129 MiB
Duration : 37 s 537 ms
Overall bit rate mode : Constant
Overall bit rate : 28.8 Mb/s
Recorded date : 2018-04-22 22:49:41.000

Video
Format : DV
Commercial name : DVCPRO
Duration : 37 s 537 ms
Bit rate mode : Constant
Bit rate : 24.4 Mb/s
Width : 720 pixels
Height : 480 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 29.970 (29970/1000) FPS
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:1:1
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Bottom Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 2.357
Time code of first frame : 00:17:15;28
Time code source : Subcode time code
Stream size : 109 MiB (85%)

Audio
ID : 0
Format : PCM
Format settings : Big / Signed
Duration : 37 s 537 ms
Bit rate mode : Constant
Bit rate : 1 536 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Bit depth : 16 bits
Stream size : 6.87 MiB (5%)

-My Avisynth file is:

SetFilterMTMode("QTGMC", 2)
FFmpegSource2("dvgrab-2018.04.22_22-49-41.dv", atrack=1)
ConvertToYV12()
AssumeBFF()
QTGMC(Preset="Slower", EdiThreads=1)
BilinearResize(1280,720)
Prefetch(threads=2)

-My bat file:

ffmpeg -i "test.avs" -c:v prores -profile:v 3 -pix_fmt yuv420p10le -c:a pcm_s16le "output.mov"

My idea after deinterlacing all videos is put some of them together, not to much editing, just combine them in a sequence. I planned to do that with Shotcut, what do you think about it?

Thanks.

Andrew Swan said...

Degmet - that sounds/looks good, if you’re using a dual-core processor. I’m assuming you’re using the 64-bit version of FFMPEG, otherwise the render wouldn’t work from 64-bit AVISynth+. As long as you have the drive space to render out to ProRes, go with that and you can edit those together in pretty much any editing program. ShotCut works, as would KDEnlive or LosslessCut (if you wanted to just append the files together).

I’d say try rendering the script via FFMPEG, and see how it goes.

degmet said...

Hi Andrew. Thanks for your answer. Can I use another codec similar to source quality (DV) for the output?. I understand I'm doubling FPS, and enlarging size, but I find the output file too big (1.74GB per min). Do you recommend me another choice?
Why Windows doesn't recognize that mov file?. I can open with VLC.

Andrew Swan said...

You can, but remember that every recompression step reduces quality, so if you intend to edit the footage and *then* export it out, that would be two compression steps. If you're only going to be doing cuts (no titles, dissolves, or other effects), then you could export out to h.264 or h.265 from FFMPEG, then use LosslessCut to put the files together. If you're looking for settings recommendations, here's links to the FFMPEG wiki:

https://trac.ffmpeg.org/wiki/Encode/H.264

https://trac.ffmpeg.org/wiki/Encode/H.265

Care2Mooch18 said...

Do you have a tutorial/video that explains how to convert 1080i/25 .ts files to 1080p/50.mp4 or mkv?

Andrew Swan said...

Damo,

Depends on what codec you want to use, but the standard QTGMC plus FFMPEG workflow should be fine, although I would recommend using AVS+ 64-bit instead of 32-bit due to memory issues. I would also consider reducing the quality preset a bit as well (even as high as "fast"), as the "slower" preset will take forever to render. For 64-bit setup, check out this post:

https://macilatthefront.blogspot.com/2018/10/64-bit-avisynth-and-qtgmc-update-and.html

If that's too slow, you could always use FFMPEG and do a bwdif deinterlace, which wouldn't have the same quality, but would be much faster. Here's an example command for that:

ffmpeg -i "input.mov" -vf "bwdif" -c:v libx264 -preset slow -crf 18 -maxrate 13000k -bufsize 1835k -profile:v main -level 4.2 -c:a aac -b:a 320k -pix_fmt yuv420p "output.mp4"

This is for an h.264 .mp4, but you can look at the FFMPEG wiki links in the comment above yours for other encoding settings. I believe bwdif should auto-detect field order, but if you get twitchiness, you can look up the settings here:

https://ffmpeg.org/ffmpeg-filters.html#bwdif

degmet said...

Hi Andrew, I could get a razonable file size using FFMPEG. Now, I need to do this in batch. Is it possible to sue AvsPmod in batch mode?

Regards.

AGiLiT said...

Yes, it is possible. I had a similar situation as yours and also found my way to Andrew's blog. (You may find some of my posts in this thread above.) After getting my basic workflow down, I also had the desire to do batch processing.
I found that AvsPmod has macro capabilities and a sample script that demonstrates how it works. I wrote a macro to that will read a directory of video files and produce an AvsPmod script for each one. I posted and explained it in another forum, here: AvsPmod Macro for batch deinterlacing with QTGMC.
I also found a program, FFmpeg Batch AV Converter that can then read the directory of scripts and apply the ffmpeg processing that you want. There's a bit of a learning curve to get up to speed on that program, but it's not too steep and the program is well documented. Essentially, you just have to figure out the ffmpeg parameters you want to use and pass them through the program.
Hope this helps.

Megan-a-bit-lost said...

Hi
Just started on a job of converting some old mini-dv and vhs tapes to digital. As a first step to deinterlacing before enhancing the video - decided to follow your tutorial and installed and running on windows 10 Home in one old laptop (my trial laptop).
However, I have a more powerful MSI windows 10 pro laptop where I've run into problems. Followed the same rules and was able to check the video with the test.avs script to decide on TFF or BFF and the crop. But after writing the test.bat script and double clicking it, suddenly I get a message saying this app cannot run on this machine! Where have I gone wrong? Any suggestions for me ? Megan
Thanks.

Andrew Swan said...

Megan,

Sorry for the absurdly long delay. If you get this comment, I would need to know more about how you've set up AVISynth on your system.

AS a first step, I would recommend downloading AVSInfoTool and running it to see if there's any issues with your installation.

https://forum.doom9.org/showthread.php?t=176079

Unknown said...

Newbie here to Avisynth and ffmpeg. Your tutorials have been great so far.
All installed correctly.

I have a bunch of events filmed on VHS and minidv.
Here is how I am capturing the footage:
VCR to minidv as pass through and firewire to pc.
Using Windv as capturing software to save to avi file.

I have some people who would like the footage on DVD and others want an mp4 for streaming services or file sharing.

In general what coomands or workflow will produce the best possible file for my needs?
I understand will need to take this file and then convert to DVD structure.

Any help is appreciated.

Thanks
Geoff

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 ...