Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd August 2021, 17:19   #1  |  Link
alexVS
Registered User
 
Join Date: Sep 2004
Posts: 147
Advice on deinterlacing mpeg2 needed

Hi!
I'm trying to process hockey video PAL 720x576 25i
file
https://drive.google.com/file/d/1hzd...ew?usp=sharing

My task is to bob deinterlace to 50p, crop black border, and save via virtualdub to uncompressed (lagorith codec) to make some color corrections in adobe premierre, cut parts, save to h264

Usually i just use yadif deinterlacer yadif(mode = 1, order = 1) and it gives good result

It comes out that I receive very bad quality, flickering on every second frame, block, soap.
But it seems to me that source has very decent quality.

This working bad:
Code:
LoadPlugin("D:\tools\dgindex\DGDecode.dll")
LoadCplugin("D:\AviSynth 2.5\plugins\Yadif.dll")
DGDecode_mpeg2source("Untitle.d2v")
yadif(1, 1)
crop(30, 12, -16, -20)
lanczosresize(720, 544)
ConvertToYUY2()
directshowsource also doesn't help
I tried TDeint and QTGMC( Preset="slow")
All gives bad result, but that strange I can play this file in Media Player Classic smoothly without flickering and dirty noise

Can you help me with advice?
Thanks in advance for your help!
alexVS is offline   Reply With Quote
Old 3rd August 2021, 17:31   #2  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,153
Try
Code:
converttoyv16
AssumeTFF()
nnclip=nnedi3(-2)
BWDIF(-2,edeint=nnclip)
https://github.com/Asd-g/AviSynth-BWDIF
kedautinh12 is offline   Reply With Quote
Old 3rd August 2021, 19:18   #3  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Apart from the color mess in the first frames it seems to me that one of the fields has a tilted brightness (Y) dropping from bottom to top of the picture which causes the flicker.
There has been a fix for this some time ago (a script by jagabo in the videohelp forum if I remember this correctly) , but I couldn't find it right now.....

Last edited by Sharc; 3rd August 2021 at 19:28.
Sharc is offline   Reply With Quote
Old 4th August 2021, 10:23   #4  |  Link
alexVS
Registered User
 
Join Date: Sep 2004
Posts: 147
Quote:
Originally Posted by kedautinh12 View Post
Try
Code:
converttoyv16
AssumeTFF()
nnclip=nnedi3(-2)
BWDIF(-2,edeint=nnclip)
https://github.com/Asd-g/AviSynth-BWDIF
Is there ready-compiled BWDIF DLL for windows?
I don't know how to compile sources and it looks like it's for linux
alexVS is offline   Reply With Quote
Old 4th August 2021, 10:31   #5  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by alexVS View Post
Is there ready-compiled BWDIF DLL for windows?
I don't know how to compile sources and it looks like it's for linux
Binaries are in the released section: https://github.com/Asd-g/AviSynth-BWDIF/releases

But that script alone will not fix your problems. As Sharc pointed out, there is flickering in the source. In this case every other field has fluctuating levels. One way to do away with that problem is just to simply SelectEven() or SelectOdd, but that method drops half of the frames. Another way is to try to mitigate the flickering, you might be able to find a solution on the forum if you search. I remember coming across a thread with a similar problem and Didée came up with a solution. I quickly searched but did not find it, maybe tomorrow I'll dig deeper.
Reel.Deel is offline   Reply With Quote
Old 4th August 2021, 10:43   #6  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Donald Graft's vdub filter "Deflick.vdf" solves the flicker nicely.
http://rationalqm.us/deflick/flick.html

You can use it in a Avisynth script like
Code:
LoadVirtualDubPlugin("path to Deflick.vdf", "DeFlick")
MPEG2Source("Untitle.d2v", cpu=0)
QTGMC() #bob-deinterlace
MCDegrainSharp() #denoise
ConvertToRGB32() #required for VirtualDub filters
DeFlick(0, 12, 0, 256, 0)  #the second parameter (12) controls the strength; you may reduce it to say 6
ConvertToYV12() # YV12 for x264 encoding

Last edited by Sharc; 4th August 2021 at 11:06.
Sharc is offline   Reply With Quote
Old 4th August 2021, 12:18   #7  |  Link
patul
Registered User
 
Join Date: Sep 2005
Posts: 130
Probably just the same idea as Sharc's post, but with different filters, since you mentioned bobbing, I remember I found a function written by jagabo long back then, to do 'smart' bob deint using TFM, I think it is useful for your sample and it is not resource hog at all

PHP Code:
FFVideoSource("C:\Users\USER\Downloads\Untitle.mpg")

# bob deint
TFMBob()

# deflicking
# http://avisynth.nl/index.php/DeFlicker
Deflicker()

Crop(3012, -16, -20)

# remove any residual comb if any
# http://avisynth.nl/index.php/Vinverse
Vinverse()

# reduce horizontal lines
# http://www.avisynth.nl/index.php/DeScratch
TurnLeft()
DeScratch()
TurnRight()

# reduce banding
# http://avisynth.nl/index.php/Neo_f3kdb
neo_f3kdb()
LanczosResize(720544)

function 
TFMBob(clip v)
{
    
# smart bob deint using TFM
    # http://avisynth.nl/index.php/TIVTC/TFM
    
v.GetParity() ? Interleave(TFM(vfield=1), TFM(vfield=0)) : Interleave(TFM(vfield=0), TFM(vfield=1))

patul is offline   Reply With Quote
Reply

Tags
avisynth, deintelacing

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:12.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.