Log in

View Full Version : Soft-interlace hard-interlaced footage?


audiohominis
23rd April 2015, 01:01
Hi fellas.

I have some hard-interlaced/hard-telecined videos, which are a mess, and I was wondering if there'd be a way to encode them back to their original fields.
So, for instance, I'd like to convert hard-interlaced 29.97p footage back to 29.97i, so that I may then perform better de-interlacing using Yadif.
As for the hard-telecined film footage, (which suffers for both combing and duplicate frames :scared:), I'd like to soft-interlace it back to 29.97i to then de-telecine it to its original 23.976p/24p. (Unless there happens to be a solution to do it in one step).

I should mention that none of this is anime; it's all live action stuff.

Any thoughts as to how this can be accomplished, if at all?
AVS snippets and/or links to threads would be much appreciated.

Thanks.

johnmeyer
23rd April 2015, 02:25
If I understand what you are asking, then if your goal is to improve quality, then there is no point to the exercise. Once video has been deinterlaced, quality has been lost, and you can never "get back" what was thrown away. This is why I always recommend that no one deinterlace video unless: 1. They are going to upload it to YouTube; 2. They are re-sizing the video.

You can easily use MVTools2 to create 29.97 interlace footage from 29.97 progressive, and this can be useful if you are attempting to make the video motion look smooth and fluid. However, no matter what settings you use, there will be small spatial distortions because, like I said, you cannot go back to interlaced once the video has been deinterlaced: all that temporal information has been thrown out and cannot be perfectly recreated.

Here is some code that I created years ago to do exactly what you are asking. I just tested it with some 30p video I had lying around and it does work. You might have better luck with blksize of 16. You can also try playing around with the overlap. To test how well it is working, I suggest you temporarily enable the "separatefields()" last line so you can see each individual field. The even fields are from the original, and are unchanged, but the odd fields are created using motion estimation and will, occasionally, be yucky looking. That's just the nature of motion estimation.# This script converts 29.97 fps progressive footage
# into 720x480 29.97 interlaced (NTSC SD) video

loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")

AVISource("e:\fs.avi")
source=AssumeFPS(29.97, false)
source_fields=source.separatefields()

super_odd=MSuper(source_fields.selectodd(),pel=2)
backward_vec_odd = MAnalyse(super_odd,blksize=8, overlap=2, isb = true, search=3, dct=0 )
forward_vec_odd = MAnalyse(super_odd,blksize=8, overlap=2, isb = false, search=3, dct=0 )

estimated_odd=MFlowFps(source_fields.selectodd(),super_odd,backward_vec_odd, forward_vec_odd, num=60000, den=1001, mask=2, ml=100)

interleave (estimated_odd.selectodd(),source_fields.selecteven())

final=weave().assumebff() # Put fields back together into full frame of video

return final

#return final.separatefields()

hello_hello
23rd April 2015, 05:56
If I understand what you are asking, then if your goal is to improve quality, then there is no point to the exercise. Once video has been deinterlaced, quality has been lost, and you can never "get back" what was thrown away. This is why I always recommend that no one deinterlace video unless: 1. They are going to upload it to YouTube; 2. They are re-sizing the video.

It does seem like maybe he's wanting to un-interlace video that's been de-interlaced and is now progressive, so to speak, assuming the de-interlaced video is what he's referring to with "hard-interlaced".

I tend to sit on the "it's okay to de-interlace" side of the fence myself, as long as you de-interlace to double frame rate (ie de-interlace NTSC to 59.94fps progressive) and even more okay if you use QTGMC as it'll probably de-interlace better than a hardware player. Most Bluray player/TV de-interlacing looks like Yadif double frame rate de-interlacing quality to me.

audiohominis,
It might pay to upload a couple of small samples for someone to check if your analysis of the problem is correct, but if video has been de-interlaced badly and encoded that way it can be hard/impossible to fix, especially if it's been resized.
For video that was de-interlaced badly you might try QTGMC (http://forum.doom9.org/showthread.php?t=156028). As your video is now technically progressive you'd theoretically run it in progressive mode, something like this:

QTGMC(InputType=1)

However I've found sometimes breaking the rules and de-interlacing again with QTGMC can do a better job at repairing badly de-interlaced video than running it in progressive mode, so it's worth trying it that way as a comparison (followed by a deletion of every second frame otherwise you'll end up with every frame repeated).

QTGMC()
SelectEven()

Sometimes one method might do a better job at fixing combing while it makes jagged lines worse while for the other method it's the other way around, but it's worth a try.

For the telecined video maybe decimation followed by QTGMC? It's hard to know.

TDecimate()
QTGMC(InputType=1)

If you want to try it, download the plugins zip file attached to the QTGMC post I linked to (the standard one should be fine unless you want to brave multi-threaded Avisynth), and that'll contain all the required plugins with instructions, but it might pay to update some (many) of them to newer versions. There's a list here with links:
http://forum.doom9.org/showthread.php?t=156028&page=93

When you get to dfttest (http://forum.doom9.org/showthread.php?p=1386559#post1386559) download the dfttest and MVTools2 zip files and where there's plugins in common with QTGMC, use those versions.

There's several versions of masktools2/mt_masktools2/masktool2-26 etc etc. I'd go with the appropriate flavour from here.
https://github.com/tp7/masktools/releases

QTGMC is very slow.

johnmeyer
23rd April 2015, 06:50
... It might pay to upload a couple of small samples for someone to check if your analysis of the problem is correct, but if video has been de-interlaced badly and encoded that way it can be hard/impossible to fix, especially if it's been resized. ... Yes, a short clip would be very useful. If indeed the problem is caused by resizing before deinterlacing, several of us explored possible solutions to this problem in this thread:

repair bad deinterlacing (http://forum.doom9.org/showthread.php?t=170813)

We actually managed to make quite a bit of improvement, although the result was still not close to what the video would have looked like if it had been handled correctly in the first place.

audiohominis
28th April 2015, 19:28
Thank you so much for the replies, guys.
I'll be back with the short sample clips.