Could someone please help me to detect what type of source I have in this video and how to deinterlace de video appropriately, using avisynth script
I don't need help with any program to do it automatically I need help with "using avisynth script" thanks for the help.
here is a small piece of the video remux
https://www.mediafire.com/file/fvke9h04xqzd4jt/Taste_00006_%25281%2529.mkv/file
could someone recommend me some method to use in these difficult cases where it requires a lot of experience and a good eye, some method to follow, etc, (I am talking about the difficult cases not the simple ones, thanks)
Thanks for the help![]()
+ Reply to Thread
Results 1 to 30 of 45
-
-
Not really sure whether this helps, but here are my 2cents.
What counts as difficult cases?
As basics, I would say, one should:- understand what interlacing is.
- understand what different deinterlacing methods there are.
- understand what 'pull down / scan' patterns are (especially what telecine means).
- know how to:
- deinterlace a source using some bob deinterlacer.
- use SelectEvery, SeparateFields, Weave and understand what they do.
- use field matchers and understand what they do.
- use decimation filters and understand what they do.
What I usually do is:- look what the content looks like when ignoring the interlaced flags and is treated as progressive.
This should help determine whether some scenes are progressive. - look what happens when I assume (soft) telecine.
- look at the frame patterns when bob deinterlaced.
This should help to determine:- whether some pulldown pattern (i.e. telecine) is used
- what the field order is
- whether the content is field shifted
- whether the content is mixed
Alternative to looking at the frame patterns, one could also look at the separated fields.
Things I might call difficult, are:- to determine how to treat the source in a decent way, especially when it's some mixed content.
(or tweak deinterlace/ivtc settings)
If you have the motivation, you might want to look at something like Yatta/Wobbly (https://github.com/hatt/Yatta) when handling animes/cartoons. - sometimes not trying to seek out whoever authored some content and try to ... them.
- have the insight to know when it's not worth it trying to undo some messed up stuff.
- use the lesser of multiple evils on how to treat a source.
Cu Selur
Ps.: TFM().TDecimate(mode=7) seems fine for your sample.Last edited by Selur; 26th Dec 2024 at 02:41.
users currently on my ignore list: deadrats, Stears555, marcorocchini -
My understanding is...
Originally Posted by Hippy
What I do is open the file to be examined in VDub2 (it will open just about anything). Then, step through the video, frame by frame, in an area where there's movement. You'll be able to spot the particular interlacing pattern pretty easily. In your case, it's PPPPII, meaning there are 4 progressive frames, followed by 2 interlaced frames; this indicates a PAL source, converted to 29.97 (NTSC). Other common NTSC variants are PPPII, and all P but 123455. All of these are variations of "Pulldown", where 24fps film movies or 25fps PAL video are converted to 29.97fps video (for TV and DVD).
The AVISynth filter that usually clears up the Pulldown is the TIVTC filter, which actually has two components, TFM and TDecimate.
Note that QTGMC shouldn't be used on Pulldown, only on continuously interlaced video such as from a VHS capture.
So, for your video, I tried this (I couldn't get the MKV to open so I did a smart recode to MP4):
Code:ffms2("D:\VH\Hippie\Taste_00006 (1).mp4") ConvertToYV12() TFM() Tdecimate(Cycle=6, CycleR=1) Prefetch(8)
You'll see the fps has been reduced to the original of 24.975 (close to the original 25fps); File>File Information.
For the more common NTSC PPPII pattern, Virtual Dub's IVTC filter works well with "Reduce frame Rate, Autodetect, Adaptive". The default mode for NTSC back to 34fps is 5/1, so there is no need to include any Cycle details in TDecimate().Last edited by Alwyn; 27th Dec 2024 at 16:38. Reason: Edited to include later information provided by Jagabo and manono.
-
The base rate of that clip is 25 fps (or 25000/1001).
Code:TFM() TDecimate(Cycle=6, CycleR=1) # remove 1 of every 6 frames, fps=~24.975
-
Thank you very much for your help, but your example is not quite right, **TFM().TDecimate(mode=7)** some parts of the video does not look very fluid, as you need to remove those extra frames, I do not know how to explain it but it is not totally fluid in some parts. also thank you very much for your help and all the information you sent me.
-
-
-
You find a section with movement and step through it frame-by-frame. The fact there are 4 progressive frames followed by 2 interlaced frames in every six frame cycle is the proof of it being originally 25fps. Alwyn already explained three common examples (while suggesting an incorrect solution).
-
Originally Posted by Manono
-
I started by looking at the interlaced frames. Some sections of the video showed four progressive frames followed by two interlaced frames. Some showed three progressive frames followed by three interlaced frames. Both indicate 25p pulled down to 30i (or 29.97i) fps. To verify I used TFM(pp=0) to field match each interlaced frame to a progressive frame. The result was five different frames followed by a duplicate. Again that indicates 25p to 30i. So I added the appropriate TDecimate arguments. Motion was now smooth.
I believe the actual frame rate should be 25, not 24.975. But it's going to be very hard to get that one more frame in every 1000 frames. You could try TDecimate(mode=2 (or 7), rate=25). -
2:2:3:2:3 pulldown (or a cyclic shift of it) is used for converting 25 -> 30 fps, or 24.975 -> 29.97fps with very little audio pitch shift. It would produce repetitive PPPPII patterns though (4 progressive followed by 2 combed frames). The OP's clip had PPPIII patterns as well. Maybe this was the telecine trick for 25 (exact) -> 29.97fps conversion?
-
-
Could AssumeFPS(25) play a role here, getting the frame rate from 24.975 to 25, or is that similar to rate=25 in TDecimate?
-
-
Thank you very much for the help, I am trying to apply everything you explained and I wanted to ask you if it is the same case for this video?
https://www.mediafire.com/file/9n9khpce4oumart/00002_%25281%2529_%25281%2529.mkv/file -
Yes, that clip is the same. It alternates between the same two patterns; four progressive, two interlaced, and three progressive, three interlaced, every 500 frames. You can see the changes around frames 500, 1000, 1500
-
Hello everyone, could you please help me deinterlace this PAL video (using avisynth script)
https://www.mediafire.com/file/wqpem528gb7kjd0/MPEG_Video_0xE0_%25281%2529.mkv/file
Thanks for your help. -
Last edited by Hippie_forever; 22nd Feb 2025 at 19:40.
-
You need to bob de-interlace as it's field blended. After QTGMC de-interlaces to 50fps, converting the fields into full frames, SRestore picks out the frames without blending for the original frame rate. You could use Yadif(mode=1) or something similar instead, but QTGMC will probably look better (it's personal preference).
It looks bit washed out to me. Changing the transfer function with AVSResize (z_ConvertFormat) seems to help. Or you can increase the contrast by lowering the black level with Levels(). I used the latter in the sample encode attached. The more you increase the first number, the more the black level will be lowered. A value of 24 would be about the max as by then the dark areas are pure black.
Code:mpeg2source("O:\MPEG_Video_0xE0 (1).d2v") QTGMC(EzDenoise=1.5, Preset="very slow") SRestore(frate=30000.0/1001.0) CropResize(0,0, 22,6,-20,-6, InDAR=15.0/11.0, ResizeWO=true, Resizer="Resize8") Levels(12, 1.0, 255, 0, 255, coring=false) # z_ConvertFormat(colorspace_op="601:470bg:470bg=>601:601:470bg") GradFun3() # from the dithertools plugin to help with color banding/blocking. Prefetch(8)
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
Thanks a lot for the help, but I have this error, do you have any idea how to fix it, thanks.
[Attachment 85698 - Click to enlarge]Last edited by Hippie_forever; 23rd Feb 2025 at 03:41.
-
users currently on my ignore list: deadrats, Stears555, marcorocchini
-
Last edited by Hippie_forever; 23rd Feb 2025 at 04:17.
-
Is it possible to run it with MT ?
Prefetch(32)
when I try to use it with MT I get this error
[Attachment 85699 - Click to enlarge] -
If you're using Avisynth Plus you might need to show or specify where the error message is coming from.
The first error you posted showed it was being produced by CropResize. Does the second error message show anything similar?
I don't think it's DitherTools, but have you used it before? If I remember correctly DitherTools had a problem with more recent versions of Avisynth+. Someone compiled an updated 64 bit dll at some stage, so just in case, it's attached. DitherTools also has other dependencies, but I can't think of where an argument or variable called "dm" would be used.
Does the error only occur when you add Prefetch to the script?
Maybe try commenting out everything but the source filter and uncommenting each function individually. It might help to find the culprit.
PS Prefetch(32) is a lot of threads. What CPU are you using?Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
I meant to add, there's definitely some color banding in the sample I uploaded (areas in places that have been flattened out to a single shade of grey etc). If you don't mind a bit of noise, removing QTGMC's denoising from the script I posted will probably prevent much of that, as noise helps prevent banding.
In case it's the Levels function contributing to it, you could try changing the levels in 16 bit, and maybe even add dithering with both the Levels and ConvertBits functions. Something like:
ConvertBits(16)
Levels(3072, 1.0, 65280, 0, 65280, coring=false, dither=true) # multiplying the original values by 256 for 16 bit
ConvertBits(8, dither=0)
If you do that, maybe Gradfun3 won't be necessary (it requires 8 bit video). You'll have to play around. You could even try converting to 16 bit before any of the other filters. Doing everything in 16 bit may result in an improvement, although it'll probably be a fair bit slower.Last edited by hello_hello; 23rd Feb 2025 at 07:48.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
I was looking for the solution and found this Forum post where they say that SRestore() is not compatible with MT or Avisynth+, another guy mentions something related to Grunt plugin, etc, maybe if you check the link you can understand it better, thanks for the help.
I have Ryzen 5950x
https://forum.doom9.org/showthread.php?t=174121&page=6
Similar Threads
-
Deinterlace video , help
By Hippie_forever in forum Video ConversionReplies: 0Last Post: 25th Dec 2024, 16:46 -
Is it possible to deinterlace a YouTube video?
By Eddles999 in forum Video ConversionReplies: 2Last Post: 24th Aug 2022, 13:06 -
How to deinterlace this video properly?
By coolgit in forum RestorationReplies: 5Last Post: 24th Sep 2021, 14:22 -
Deinterlace video - help needed
By kilnlast in forum EditingReplies: 2Last Post: 30th Jan 2021, 00:07 -
How to deinterlace video?
By ACKR in forum Video ConversionReplies: 9Last Post: 28th May 2020, 02:26