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 December 2003, 01:36   #1  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,638
Fighting against fieldblends (constant pattern)

Worried about fieldblends on old or new movies?
There could be a possible solution, if there is a
CONSTANT blending pattern present in your video.

use this function for testing:

Code:
function unblendpattern(clip clip, int offset, float fps, bool refitfps, bool debug)
	{
	a = (debug == true) ? clip.ShowFrameNumber() : clip
	b = changefps(trim(a,0,-1),framerate(a)*100).assumefps(framerate(a))
	out = (offset == 0) ? changefps(a, fps) : changefps((b.trim(0, -offset) + a), fps)
	out = out.trim(int(offset / (framerate(a)/fps)) , 0)
	out = (refitfps == true) ? out.assumefps(framerate(a)/2, true).resampleaudio(audiorate(a)) : out
	return out
	}
Okay, let me explain, how to use this function.

At first, you have to deinterlace your Video with a
Fullframreate-deinterlacer, like dgbob().
Code:
xxxsource("yourblendedvideo.xx")
dgbob(order=?)
then, load your avs to virtualdub and scroll to a
position where movement and blends are very good visible.

Now go frame by frame through your video and write down the
Framenumbers of the UNBLENDED (normal) frames

then do a count, how many good frames (if two identical frames
are not blended, do only count one) you have per second of
Video (50 frames). This will be the orignial Framerate of the
source.

your sequence may look like this:

Code:
blend  : 0,2,4,6,8,9 ,11,13,15,17,19,21,23,25,27,29,31,33,34,36,38,40,42,44,46,48,50,,,,,,,,,,,
normal :  1,3,5,7, ,10,12,14,16,18,20,22,24,26,28,30,32,  ,35,37,39,41,43,45,47,49,,,,,,,,,,,

now add my function to your script (I assume 24fps from now on)
Code:
xxxsource("yourblendedvideo.xx")
dgbob(order=?)
unblendpattern(0,24,false,true)
now, load your video to VDub again and change the offset
until unblendpattern only returns the normal frames.

If this is done, examine your whole video. if the blending
pattern slowly slides away, just change the fps value a little
bit (it's float).

now, change the parameters for unblend, to remove the framenumbers
debug=false.
If you want, unblendpattern can correct the unblended video itself
to 25fps (half framrate of inputclip). Just set refitfps=true

Code:
xxxsource("yourblendedvideo.xx")
dgbob(order=?)
unblendpattern(22,24,true,false)
Finally, to achieve a better deinterlaing result, use kernelbob
instead of dgbob() for deinterlacing.
(You'll get lesser stairstepping)

Code:
function kernelbob(clip a, int th)
	{
	f=a.kerneldeint(order=1, sharp=true, twoway=true, threshold=th) 
	e=a.separatefields.trim(1,0).weave.kerneldeint(order=0, sharp=true, twoway=true, threshold=th)
	interleave(f,e)
	}
Code:
xxxsource("yourblendedvideo.xx")
#assumetff   #use it, if video jerks back and forth
kernelbob(4)
unblendpattern(22,24,true,false)
samples can be found here: http://home.arcor.de/scharfis_brain/blending/

btw. I invented this Idea, because BaronVlad had problems with an
interlaced PAL movie.
First I thought it has been directly converted from 24p to 50i using
blending. But that wasn't the truth!
The broadcaster took the already preogressive 25fps Film and speeded
it up to unbelievable 26fps using blending. I think this has been done
to be able to broadcast 3.5 minutes more advertisement.
German TV sucks!
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.

Last edited by scharfis_brain; 13th December 2003 at 00:51.
scharfis_brain is offline   Reply With Quote
Old 7th December 2003, 09:18   #2  |  Link
Colyptic
Registered User
 
Join Date: Feb 2003
Location: USA
Posts: 34
kernelbob is a great filter...thanks. it was the only one that could handle the 2 telecined PAL DVD's I have been working with for almost a week now.

Telecide(order=1, mode=3)
Decimate(6)
-
dgbob()
repal()

both failed miserably on them.

kernelbob(4)
repal()

worked great

just wanted to add a little bit more to importing these avs files and using them in a script for those who dont know (I was recently one of them)

first of all, you have to create an avs with just the function code in it. Then you have to load that avs into your regular script by:

import("%filename%.avs")

also you need to have kerneldeint.dll on your comp and load it in.

then usage of the kernelbob is i believe

kernelbob(4)

feel free to correct me if i'm wrong, its my first experience with this filter, but definitely not my last.

Also would be nice to get it into a dll if its possible, may speed it up a bit.
Colyptic is offline   Reply With Quote
Old 7th December 2003, 12:32   #3  |  Link
crOOk
Compulsive PixieDust User
 
crOOk's Avatar
 
Join Date: Mar 2002
Location: Hamburg
Posts: 115
@scharfis_brain
Thank you for another great function! It's amazing how much work you put into providing some of the best deinterlacing techniques.
crOOk is offline   Reply With Quote
Old 12th December 2003, 11:58   #4  |  Link
r0cket
Registered User
 
r0cket's Avatar
 
Join Date: Dec 2002
Location: Russia
Posts: 57
Quote:
...just change the fps value a little...
maybe a tip on how to guess this fps value faster?
r0cket is offline   Reply With Quote
Old 12th December 2003, 13:00   #5  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,638
just take 100 (or more) fields (or deinterlaced after dgbob / kernelbob) and count the good (non-blended) fields.
If the same picture appears twice or more, just count it once.
If you have, let's say 30 good out of 100 fields, you have a ratio of 1.0 : 0.3 .

this means a framerate (PAL) of 50 : x = 1.0 : 0.3
where x = 15
with NTSC: 59.94 : x = 1.0 : 0.3 -> x = 17.98 (approx. 18 fps)

but this gives only a raw idea of the fps-value. the exact value can only be found through testing the source from 0 to end.
If there is a swimming or jumping offset in your video, you have to separate your video into segments, unblend them each with their fitting offset and re-join then back together after that.

PS: After testing unblendpattern with NTSC-samples, I found out (with help of manono!), that AVIsynth handles the floating-point fps not very well.
This means for you applying a assumefps(29.97) directly after opening the video.
Else unblendpattern will return a error claiming about non-matching framerates.
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.

Last edited by scharfis_brain; 13th December 2003 at 00:51.
scharfis_brain is offline   Reply With Quote
Old 15th December 2003, 16:44   #6  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
hmm. i'm at a loss as to what to do with hybrid 24/30 clips that have become interlaced through PAL conversion.

best i can get is about 70% of good frames which isn't much better than the original content.

good function nonetheless.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 18th December 2003, 11:36   #7  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,638
Quote:
est i can get is about 70% of good frames which isn't much better than the original content.
This heavily depends on the type (or settings) of the standards converter (NTSC -> PAL)
some converters are blending ALL the time, meaning that a slight blending is everytime visible.

ANd others are only doing blending if the new temporal PAL-image position lays roughly between two NTSC-images. Else the nearest neighbor is choosen without blending two NTSC-images together.
When converted with such a converter, you'll be able to select 30 frames out of 50 with success!
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 21st December 2003, 12:15   #8  |  Link
encod3r
Registered User
 
Join Date: Jul 2002
Posts: 14
Can this be used to sort of go from PAL back to NTSC? I have NTSC material that was converted and put on a PAL DVD. So when I do my code it looks like this:

Code:
bad: 00,    03, 05,    08, 10,    13, 15,    18, 20,    23, 25,    28, 30,    33, 35,    38, 40,    43, 45,    48, 50
good:  01,02, 04, 06,07, 09, 11,12, 14, 16,17, 19, 21,22, 24, 26,27, 29, 31,32, 34, 36,37, 39, 41,42, 44, 46,47, 49
Total good frames is 30, no big surprise there I guess, now what do I do?
encod3r is offline   Reply With Quote
Old 21st December 2003, 15:06   #9  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,638
are frames 01&02 indentical or do they represent different frames?
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 22nd December 2003, 00:12   #10  |  Link
encod3r
Registered User
 
Join Date: Jul 2002
Posts: 14
all good frames are unique
encod3r is offline   Reply With Quote
Old 22nd December 2003, 00:18   #11  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,638
then try using
kernelbob(4)
unblendpattern(x,29.97,false,true)


x is the Offset, which you have to change until unblendpattern chooses only the good frames.
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 22nd December 2003, 05:01   #12  |  Link
encod3r
Registered User
 
Join Date: Jul 2002
Posts: 14
sample: s.m2v

here's a sample of the material, I have used offsets of 0-15 so far and its still picking bad frames.
encod3r is offline   Reply With Quote
Old 22nd December 2003, 11:32   #13  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,638
for me, this one works:

Code:
mpeg2source("s.d2v")
kernelbob(5,0)
unblendpattern(1,30,false,false)
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 22nd December 2003, 14:01   #14  |  Link
encod3r
Registered User
 
Join Date: Jul 2002
Posts: 14
did you update kernelbob function? two arguments?
encod3r is offline   Reply With Quote
Old 22nd December 2003, 15:04   #15  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,638
just remove ,0 [ kernelbob(5) ]

and then you can use the kernelbob, I've posted here

its just my personal super-duper-hyper-useless switch, hehe
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 22nd December 2003, 22:18   #16  |  Link
encod3r
Registered User
 
Join Date: Jul 2002
Posts: 14
Code:
import("F:\dvd\unblender.avs")
mpeg2source("C:\Documents and Settings\Administrator\Desktop\s.d2v")
kernelbob(5)
unblendpattern(1,30,false,false)
#DeRainbow(8)
#crop(8,8,704,564)
#BicubicResize(512,384,0,0.5)
I tried this out on the same sample I posted and I can still clearly see ghosted frames in the final output?
encod3r is offline   Reply With Quote
Old 23rd December 2003, 01:51   #17  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,638
this function cannot remove blends from existing frames. it only can select the "best" matching frames, meaning that blending on some frames is still visible.

The great advantage is after using this function, that you have a video with its original framrate and smoothness.

Please don't expect wonders from it. It is just a stupid frame-selector. Nothing else!
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 24th January 2004, 17:22   #18  |  Link
r0cket
Registered User
 
r0cket's Avatar
 
Join Date: Dec 2002
Location: Russia
Posts: 57
today there is at least one dvd that have this problem. "THE WALL" DVD PAL. Just give me the best settings to make it "unblended" and i'll be verry happy. and you'll be very appreciated.
r0cket is offline   Reply With Quote
Old 24th January 2004, 17:35   #19  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,638
What tha hell?!?
Quote:
Just give me the best settings[...]
Am I a magican?

How shall I do this kind of remote-diagnosis without something to have a look on?

Sample = 5 to 10 secs long non-reencoded part cutted out of the VOB's
use ChopperXP
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.

Last edited by scharfis_brain; 24th January 2004 at 18:03.
scharfis_brain is offline   Reply With Quote
Old 24th January 2004, 21:10   #20  |  Link
r0cket
Registered User
 
r0cket's Avatar
 
Join Date: Dec 2002
Location: Russia
Posts: 57
Got problems with chopperxp (bug?). Is there any other program to cut vob's?
Anyway, my idea is to create some database with proper settings for such a DVDs
r0cket is offline   Reply With Quote
Reply

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 12:42.


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