VideoHelp Forum




+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 45
  1. 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
    Quote Quote  
  2. 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.
    Assuming these basics are known and understood.

    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
      see: [INFO] Interlacing patterns
      Alternative to looking at the frame patterns, one could also look at the separated fields.
    Also interesting might be https://forum.doom9.org/showthread.php?t=176104.

    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
    Quote Quote  
  3. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    My understanding is...
    Originally Posted by Hippy
    could someone recommend me some method to use in these difficult cases where it requires a lot of experience and a good eye
    Don't sell yourself short. In a lot of cases, the issues are "standard" and are easily deduced and corrected.

    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)
    Edit: "Cycle=6, CycleR=1" added on advice from Jagabo in the next post.

    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.
    Quote Quote  
  4. 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
    Quote Quote  
  5. Originally Posted by Selur View Post

    Ps.: TFM().TDecimate(mode=7) seems fine for your sample.
    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.
    Quote Quote  
  6. Originally Posted by Alwyn View Post
    PPPII pattern.
    Hello, with the information you sent me I have learned to identify the sequences more efficiently, in the end it's all about practice and a good eye. I hope to have a well trained eye little by little. Thanks for your help.
    Quote Quote  
  7. Originally Posted by jagabo View Post
    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
    Hello and thanks for your help, I have a doubt how do you know that the base of the video is 25 ? could you send me some method to learn please or is it all based on your experience and good eye ? Thank you.
    Quote Quote  
  8. 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).
    Quote Quote  
  9. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    Originally Posted by Manono
    Alwyn already explained three common examples (while suggesting an incorrect solution
    Fixed: I've edited my post #3. Your comment also applies to Selur.
    Quote Quote  
  10. Originally Posted by Hippie_forever View Post
    Originally Posted by jagabo View Post
    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
    Hello and thanks for your help, I have a doubt how do you know that the base of the video is 25 ? could you send me some method to learn please or is it all based on your experience and good eye ? Thank you.
    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).
    Quote Quote  
  11. Originally Posted by jagabo View Post
    I believe the actual frame rate should be 25, not 24.975
    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?
    Quote Quote  
  12. Originally Posted by Sharc View Post
    Originally Posted by jagabo View Post
    I believe the actual frame rate should be 25, not 24.975
    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?
    Yes. Every 1001 fields one field is discarded to make up the difference between 30 and 29.97 fps.
    Quote Quote  
  13. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    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?
    Quote Quote  
  14. Originally Posted by Alwyn View Post
    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?
    You can change the frame rate that way but it doesn't restore the missing frames (there will be a little jerk every 40 seconds). And you'll have to shorten the audio accordingly to keep A/V sync.
    Quote Quote  
  15. Originally Posted by jagabo View Post
    Originally Posted by Alwyn View Post
    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?
    You can change the frame rate that way but it doesn't restore the missing frames (there will be a little jerk every 40 seconds). And you'll have to shorten the audio accordingly to keep A/V sync.
    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
    Quote Quote  
  16. 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
    Quote Quote  
  17. 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.
    Quote Quote  
  18. Originally Posted by Hippie_forever View Post
    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
    Remux back to VOB (or MPG), Use DgIndex to index video, then something like:

    Code:
    Mpeg2Source("MPEG_Video_0xE0 (1).d2v", Info=3) 
    QTGMC()
    SRestore(frate=29.97)
    Needs lots of other fixed too.
    Last edited by jagabo; 22nd Feb 2025 at 16:54.
    Quote Quote  
  19. Originally Posted by jagabo View Post
    Originally Posted by Hippie_forever View Post
    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
    Remux back to VOB (or MPG), Use DgIndex to index video, then something like:

    Code:
    Mpeg2Source("MPEG_Video_0xE0 (1).d2v", Info=3) 
    QTGMC()
    SRestore(frate=29.97)
    Needs lots of other fixed too.
    Thank you very much for helping, you mean that the image can be improved a lot ? but that the deinterlacing is ok ?

    and how would it be without using QTGMC() , thanks .
    Last edited by Hippie_forever; 22nd Feb 2025 at 19:40.
    Quote Quote  
  20. 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)
    I remuxed your sample as a TS file with TSMuxer so I could open it with DGIndex.
    Image Attached Files
    Quote Quote  
  21. Originally Posted by hello_hello View Post
    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)
    I remuxed your sample as a TS file with TSMuxer so I could open it with DGIndex.
    Thanks a lot for the help, but I have this error, do you have any idea how to fix it, thanks.

    Image
    [Attachment 85698 - Click to enlarge]
    Last edited by Hippie_forever; 23rd Feb 2025 at 03:41.
    Quote Quote  
  22. users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  23. I've solved it, I'll try it and let you know , thank you very much
    Last edited by Hippie_forever; 23rd Feb 2025 at 04:17.
    Quote Quote  
  24. Is it possible to run it with MT ?

    Prefetch(32)

    when I try to use it with MT I get this error

    Image
    [Attachment 85699 - Click to enlarge]
    Quote Quote  
  25. best use Avisynth+ instead of old Avisynth or AvisynthMT
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  26. Originally Posted by Selur View Post
    best use Avisynth+ instead of old Avisynth or AvisynthMT
    I use this version all the time
    Quote Quote  
  27. 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?
    Image Attached Files
    Quote Quote  
  28. 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.
    Quote Quote  
  29. Originally Posted by hello_hello View Post
    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?
    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
    Quote Quote  
  30. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    they say that SRestore() is not compatible with MT or Avisynth+
    SRestore works perfectly with AVISynth+. I use it for cine often, with Prefetch. Re MT, I have this as my first line (for QTGMC?):

    Code:
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!