View Full Version : Help fixing bad deinterlacing, perform inverse telecine
wizoomer95
3rd October 2020, 08:16
Hello,
I'm working on a fan edit (https://en.wikipedia.org/wiki/Fan_edit) of Thomas and the Magic Railroad, using the newly released deleted scenes from the Shout! Factory Blu-ray. Shout is normally good at outputting quality video, but this appears to be an exception. The footage is at 29.97 frames per second, progressive framerate, and the deinterlacing that was performed is extremely poor. There is a lot of combing and horizontal artifacts galore. You can find a small snippet of the Blu-ray rip here: https://drive.google.com/file/d/1QqZjgn8BFDFLHW0UPG9epQiG420znKyA/view?usp=sharing. Ideally, I would also like to perform inverse telecine to get an NTSC film framerate, as it was originally shot on film.
I currently loading the Blu-ray rip into Avisynth using VirtualDub2 and frame serving it into Avisynth. However, try as I might, I can't seem to get any deinterlacing fixes to work properly. If I had access to the original source, this would be the time I would go back to it and attempt digitizing it again. But obviously, this isn't an option. Seeing this is a specific video file with specific needs, I would prefer to get individualized advice on this as opposed to googling for suggestions and praying something works for me. Can someone help me with this? Or is the issue so far gone at this point, that I can't reasonably fix the issue? Any help would be appreciated. Thank you in advance!
johnmeyer
3rd October 2020, 21:26
That came from a Blu-ray disc? It looks like it has been compressed multiple times and, has no detail left whatsoever.
Remember that deinterlacing and inverse telecine are two completely different things. For film that has been converted to 29.97, you simply have to remove the repeated fields (inverse telecine). No deinterlacing is needed, and doing deinterlacing is the wrong thing to do and will make your video worse.
wizoomer95
3rd October 2020, 21:52
That came from a Blu-ray disc? It looks like it has been compressed multiple times and, has no detail left whatsoever.
Remember that deinterlacing and inverse telecine are two completely different things. For film that has been converted to 29.97, you simply have to remove the repeated fields (inverse telecine). No deinterlacing is needed, and doing deinterlacing is the wrong thing to do and will make your video worse.
Yes, that's directly from a Blu-ray disc, ripped with MakeMKV. My guess is that the footage itself was sourced from a VHS tape that the director had in her collection, and then it was upscaled to HD using whatever process they did. The process must have been terrible for it to come out like that, I agree. Very disappointing, to say the least.
Yes, I should have just said inverse telecine. This is a 29.97 fps video that was shot on film. What's weird, I should say, is that when I play the video frame by frame, it looks like it just needs inverse telecine (a pattern of 2 interlaced frames followed by 3 progressive frames). But the results I get when attempting to do so result in artifacts such as combing. And that's not to mention some interlace-related (I think?) artifacts that appear when just playing the original video. I'm not as concerned about it looking like a miracle 4K high-quality detailed video as I am just getting it to look like a decent progressive video with a 23.976 frame rate, mainly because I want to edit it with video already at 23.976 frames per second.
wonkey_monkey
3rd October 2020, 21:55
I've no idea what the proper width is (720 looks roughly right but still has borders), but if you resize down to 360 pixels in height with, let's say, spline16resize, that almost puts the interlaced fields back where they should be ready for deinterlacing.
That just leaves you with a mixture of repeated and blended frames to sort out...
johnmeyer
5th October 2020, 18:17
I finally got onto my main editing computer and looked again at this video. It is NOT telecined nor is it interlaced. It is 29.97 progressive footage that, at one point, probably was telecined. It was also probably re-sized without deinterlacing, which is why you have those "teeth" that are taller than one scan line. They look a little like interalced "teeth", but are multiple scan lines high.
Katie Boundary
14th October 2020, 21:39
It was also probably re-sized without deinterlacing, which is why you have those "teeth" that are taller than one scan line.
https://i.imgur.com/k2Lgxie.png
videoh
15th October 2020, 02:22
@Katie
Are you too good to follow forum rules against profanity? Or are you just a jerk? Suspecting the latter.
johnmeyer
15th October 2020, 04:54
Neglecting the pointless profanity, I did manage to figure out a way to significantly reduce the artifact:
repair bad deinterlacing (https://forum.doom9.org/showthread.php?p=1685187#post1685187)
So, it is not entirely hopeless.
wizoomer95
23rd October 2020, 06:04
I've no idea what the proper width is (720 looks roughly right but still has borders), but if you resize down to 360 pixels in height with, let's say, spline16resize, that almost puts the interlaced fields back where they should be ready for deinterlacing.
That just leaves you with a mixture of repeated and blended frames to sort out...
This makes sense. It was probably sourced from a 4:3 analog video source (so 480p) and then cropped to 16:9 before being resized up. Before the resize, that would make it roughly 640x360 in resolution. As to why there are black bars around it is beyond me. But I have since added that into my script (see below), and it has helped immensely. But, as you said, there still are blended frames and artifacts throughout.
Neglecting the pointless profanity, I did manage to figure out a way to significantly reduce the artifact:
repair bad deinterlacing (https://forum.doom9.org/showthread.php?p=1685187#post1685187)
So, it is not entirely hopeless.
Sorry for not responding to your suggestion. After the profanity-laced meme, I was never notified of any further updates on this thread. Weird.
As I stated before, this was shot on film. This footage is from recently-released deleted scenes for a 2000 theatrical film as a Blu-ray extra. I'd be very surprised if the footage is truly 29.97 frames per second. The footage, however, is sourced from a telecined video. From dailies perhaps? Chances are that whoever digitized the footage deinterlaced the footage instead of doing inverse telecine, and then scaled it up to 1080p.
As to your suggestion, I have read through the thread you linked to. One thing I will say, though, is that I'm basically a noob when it comes to AVISynth. I've only dabbled in basic scripts in the past, and the most complex thing I've done is doing IVTC on another video that didn't pose any issues. I'm sure there's a learning curve involved in getting this done, and I'm not expecting all of you to do it for me. After all, the linked-to footage is only a small snippet of a much larger file. The total running time is just a little over an hour.
If I can be pointed in the right direction, I'd be happy to learn and take the wheel from there. I could be wrong, but I foresee this as something to be repaired frame-by-frame. I have a few questions, but first, I want to go over my process as to how I get the video into AVISynth:
I open the MKV file into VirtualDub2.
I then start the frameserver from VirtualDub2.
Finally, I load in the frameserved video via AVISource.
And here is the in-progress AVISynth script (I don't load the plugins in the script as I've copied the plugins to the plugin folder of the AVISynth+ Installation):
AVIFileSource("C:\path\to\frameserver.avi")
ConvertToYUY2()
Spline16Resize(640,360)
Telecide()
Decimate()
My questions: First, should I be using the MVTools2 repairs before or after the inverse telecine? Second, how exactly do I use the functions in MVTools2 to attempt to repair the file? Which sample script in the linked thread is the closest to what can fix my problem?
Sorry if I'm being such a noob; I'm primarily a Mac user who's switched to a Windows box just for the purposes of doing this repair. I have the patience to repair this once I know how to do so.
wizoomer95
3rd January 2022, 19:07
(Blows dust off of my old thread)
Hi, guys. I'm back because I've gotten a bit better at using AviSynth, and I'm looking for help still with this same exact Blu-ray video title. Mods, feel free to splinter this off into a new thread if you feel this deserves one of its own. Anyway, with the help of a few others elsewhere, I managed to come up with two different script types that work for the video, albeit with each section needing to be treated separately.
Basically, I think they used different tape sources when preparing these deleted scenes for the Blu-ray release. Some were properly telecined (i.e., repeating fields), while others instead relied on blended frames to get from 24 to 30 frames per second. Additionally, the video was upscaled for the Blu-ray without any additional processing (i.e., IVTC), resulting in a 29.97 frames per second video with combing artifacts larger than a single scan line.
For the ones that were properly telecined, the first script can be used, which basically uses debicubic to undo the upscaling and resize the footage back down to its original size, and then it bob-deinterlaces the footage before using srestore to bring the footage down to 23.976 frames per second.
But for the blended telecine footage, it got a bit more complicated. Consider this small scene: https://drive.google.com/file/d/1Jnv44avV_OCjlsPQyIWa22BwPZ7ffDYv/view?usp=sharing
(https://drive.google.com/file/d/1Jnv44avV_OCjlsPQyIWa22BwPZ7ffDYv/view?usp=sharing)
That link is the footage directly ripped from the Blu-ray with MakeMKV and trimmed without re-encoding. When using AviSynth to restore it, the same base script works, but I have this sort of hack that gets pretty good results at undoing the blended telecine. This is done instead of using srestore as I noted above. The hack requires me to select 5 frames out of 10 from the bob-deinterlaced footage before using ExBlend to undo the blended telecine. Here's the full script with comments explaining my process:
#TATMR Deleted Storylines - Restoration Example: Chapter 18
#Note: This isn’t the exhaustive list of plugins needed for this script to work, as some plugins are installed in my AviSynth+ plugins folder.
Import("C:\Return to Shining Time\santiag.avsi")
LoadPlugin("C:\Return to Shining Time\yadifmod26-0.0.0\yadifmod.dll")
LoadPlugin("C:\Return to Shining Time\nnedi3\nnedi3.dll")
#I find that loading MKV files from lossless Blu-ray rips works best using the LSMASHSource plugin. Other methods won’t load fields correctly.
LoadPlugin("C:\Return to Shining Time\LSMASHSource.dll")
LWLibavVideoSource("W:\Deleted Storylines\Thomas and the Magic Railroad-018.mkv")
#Next we crop out the black bars.
Crop(38,54,-38,-54)
AssumeTFF()
#This best restores the fields to their original size, thus allowing for better IVTC results.
#Then, we bob-deinterlace. This script command seems to bob-deinterlace this footage nicely.
debicubic(614,324)
i=Last
i.yadifmod(mode=1,edeint=i.nnedi3(-2))
#Now, we’re at roughly 60 frames per second (59.94 fps). We need it to be 24 for a true inverse telecine.
#First, we need to see whether this chapter has a blended telecine or field-based telecine.
#To do so, copy and paste the above script only, and walk through the cut portion of the clip, frame by frame.
#Here, we see it is blended telecine, which means we have work to do.
#First, we need to get this down to 30 frames per second which best represents the original progressive frame pre-IVTC.
#The footage seems to follow a pattern. You just need to look and figure out the pattern for yourself.
#Remember: We need to pick 5 out of every 10 frames.
#Here, the three progressive frames are 4, 6, and 7. 6 might be slightly blended, but I haven’t been able to get better results otherwise.
#The two blended frames are 8 and 0.
#It may be different from other chapters, but the pattern you’re looking for is progressive, slight blend, progressive, drastic blend, and drastic blend.
#Also worth noting is that frames ending in 0 and 1 are identical to frames ending in 2 and 3, respectively.
#How this exactly happened is beyond me, but this hack seems to work perfectly prior to our next step.
#Example screenshots: https://imgur.com/a/ishuuPI
#Once you find the frame, use SelectEvery to make your frame selections.
SelectEvery(10,0,4,6,7,8)
#The penultimate step is performing blend IVTC.
#I find the plugin ExBlend (designed for poorly deinterlaceds VCDs where IVTC should have occurred) works the best.
#First, copy and paste the following command, uncomment it, and run an analysis pass. This will generate the files with blend and decimation info.
#ExBlend(mode=1,pal=0,Exbfile=".\DeletedStorlines18_v7.XBD")
#Then, change 1 to 2, like below, to use generated files to perform IVTC, thus reducing the frame rate from roughly 30 fps (29.97) to 24 fps (23.976).
ExBlend(mode=2,pal=0,Exbfile=".\DeletedStorlines18_v7.XBD")
#Last but not least, I find this plugin helps clean up some leftover blending artifacts. The final result won’t be perfect, but it works the best.
santiag(nns=4)
Now, other sections with blended telecine will follow the exact same pattern, but the numbers of the frame will be different. The script still results in a handful of blended frames, but it's light years better than anything else I've tried so far. As I said, I don't know why this works, but here is the result I get from the same script above: https://drive.google.com/file/d/1x73FWFKhFFTJCjcN9cQ_qRNLStE8VjqI/view?usp=sharing
One thing that I'm still wondering, though is if there's a way to algorithmically select the 5 frames for me so I don't have to rely on SelectEvery each time and manually determine which frames to keep. Or perhaps there's a better way to handle this all together? I'd like to see if this is possible for a v2 of my aforementioned fan edit. Any insights would be appreciated!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.