View Full Version : Deinterlacing


Pages : [1] 2

Riley Harmon
January 29th, 2005, 02:50 PM
I know that this has probably been answered, but I figured we could make this post a place for everyone to place their best methods and experiences with deinterlacing. Anyone know a way to go from 30i to 24p as fast and as good of results as DVfilm? I don't have $150 bucks for it :-/

Jed Williamson
January 29th, 2005, 07:36 PM
Since you already have After Effects (listed in your profile), try this method:

http://www.dvinfo.net/articles/filmlook/broadway1.php

Kin Kwan
February 4th, 2005, 03:53 PM
There's a bunch of deinterlacers out there for AVIsynth that deinterlaces just as good as DVFilm Maker. AVIsynth is a frameserver program with a lot of filters that you might find in professional products and it's free!

I've tried the After Effects method to deinterlace but personally I don't think it looks that good compared to other methods.

Josh Barker
February 25th, 2005, 12:18 PM
I agree with Kin Kwan. Try the following filters to deinterlace for AVISynth:

MVBob() - GREAT quality! Just takes a while to render, this is a motion compensated deinterlacer to deinterlace 60i to 60p.

TDeint() - This is a deinterlacer I use, it is great for deinterlacing at higher speeds and still yields great quality. MVBob() uses this deinterlacer as a base deinterlacing method.

Bob Benkosky
March 6th, 2005, 06:01 PM
Procoder 2 has a very nice de-interlacer. It's fast too.

It's adaptive, meaning I think it searches for only movement.

Fast and top quality. Their DV encoder is awesome too.

Johan Manders
March 7th, 2005, 04:39 AM
Procoder 2 supports 1080i.
Can MVBob() and TDeint() also use the Z1 footage?

Bob Benkosky
March 7th, 2005, 08:25 AM
It says nothing about 24p though. Unless you manually change the frame rate to 23.976 somewhere.

John McManimie
March 7th, 2005, 12:27 PM
>> "It says nothing about 24p though. Unless you manually change the frame rate to 23.976 somewhere."

You can create your own target presets in Procoder. For instance, I created a preset under the System section for output to QuickTime using the BlackMagic codec (which I installed separately) in which I set the frame rate to "23.976" and interlacing to "Non-Interlaced (Progressive)". The same options are not available for every target type.

If creating an MPEG2 file using the standard Procoder presets, you can change the framerate to use 3:2 pulldown (providing the source is progressive) and then create a 24P DVD that plays at 23.976 on a computer or progressive scan monitor and at 29.97 on a standard television.

Procoder is really quite a versatile program (though I personally use DVFilm Maker for deinterlacing because I like the options it offers).

John

Kyle Edwards
March 7th, 2005, 08:05 PM
<<<-- Originally posted by Johan Manders : Procoder 2 supports 1080i.
Can MVBob() and TDeint() also use the Z1 footage? -->>>

AVISynth isn't resolution or file dependant. You can import any type of file you want into it and use the same filters. Only downside would be some filters only support certain color spaces.

Personally I use FieldDeinterlace.

Kin Kwan
March 14th, 2005, 01:04 PM
Not only does it deinterlace well, Avisynth has an anti-aliasing filter that you can use to remove the jaggies caused by deinterlacing. :]

KiN

Jonathon Wilson
March 14th, 2005, 05:10 PM
Another avisynth vote here. The fact that there are lots of different deinterlacers gives you freedom to try different things in different situations. They are all (mostly) tweakable through their parameters allowing further situation-specific work.

I tried a ton and still prefer TDeint() followed by TDIsophate() (which is the 'jaggies remover') mentioned here. I also use the MV stuff for going from 60i/60p down to 24p with fairly realistic motion blur.

Avisynth rules.

It does have a bit of a learning curve though. No GUI. Script only.

Josh Barker
March 22nd, 2005, 11:50 PM
Jonathon,

Can you direct me to where I can see this TDIsophate()?

Thanks,
Josh

Jonathon Wilson
March 23rd, 2005, 02:45 AM
Well, I was off by a letter or two...

http://bengal.missouri.edu/~kes25c/

The filter's name is: "TIsophote"

After a deinterlace (with something like his TDeint), you can still be left with 'jaggies' sometimes. The TIsophote filter seeks them out and smooths them out. It's fairly customizable and can be slow at times. For certain things its too harsh and I've heard that using a filter called Sangom can offer softer de-jaggifying... you'll have to dig to find it, but it seems to be quite popular.

By the way, Tritical's EDIUpsizer and FastEDIUpsizer on the same page are very nice edge-directed-interpolation upsizers. If you need to blow some things up, these are the best I've found. Sloooooooow...... but worth it :)

Kin Kwan
April 3rd, 2005, 12:00 PM
Here's some frames from a project I've been working on that's deinterlaced, cleaned, and anti-aliasied with AviSynth.

www.eternalabyss.com/images/kinsfolder/avisynth/Deinterlace01.jpg

www.eternalabyss.com/images/kinsfolder/avisynth/Deinterlace02.jpg

www.eternalabyss.com/images/kinsfolder/avisynth/Deinterlace03.jpg

www.eternalabyss.com/images/kinsfolder/avisynth/Deinterlace04.jpg

www.eternalabyss.com/images/kinsfolder/avisynth/Deinterlace05.jpg

www.eternalabyss.com/images/kinsfolder/avisynth/Deinterlace06.jpg

www.eternalabyss.com/images/kinsfolder/avisynth/Deinterlace07.jpg

www.eternalabyss.com/images/kinsfolder/avisynth/Deinterlace08.jpg

See if you can guess what camcorder I used. :]

Riley Harmon
April 3rd, 2005, 01:23 PM
im going to guess a panasonic...like a pvdv953 or mx300

Kin Kwan
April 3rd, 2005, 06:26 PM
It was shot on an Optura 20. :D

James Lilly
April 4th, 2005, 02:04 PM
What kind of resolution loss do you experience using these methods? Say taking it from 60i to 24p?

Jonathon Wilson
April 4th, 2005, 03:04 PM
It really depends.... the framerate doesn't really matter much -- think only about vertical lines:

When you take a standard NTSC source, you've got 29.97 frames per second, which gets chopped up into 59.94 fields per second. Each field has roughly 240 lines of resolution. (NTSC is actually 486, I believe).

When you deinterlace in avisynth, the 'Bobbers' use interpolation to recreate the missing lines in the fields. This results in 59.94 full frames per second with 480 lines each. However, the 480 lines were created by interpolating, so you do lose some vertical resolution -- depending on the smarts of the deinterlacer. In avisynth, there are a wide variety of different filters which can do this interpolation in a whole host of ways -- from just doubling the lines (simplest -- worst-looking) to some serious math, using both temporal and spatial information to recreate information that varies depending on whether the section of the frame is moving or not, etc. There are some wicked-smart deinterlacers for avisynth.

The subsequent conversion from these 59.94 progressive frames down to 24 progressive frames is a separate step which also has a wide variety of possible ways to do it, from the simplest -- just chop out enough frames to end up with 24 (usually 23.976) -- or much more complicated. The best results come from using 'temporal interpolators' which can actually recreate additional interpolated frames in between the ones which were actually shot. These are great for super-smooth slow-motion as well as recreating realistic motion blur. My favorite down-convert to 24p interpolates 10x the number frames in the original 60-frame progressive source (after deinterlacing). This give you a 600 fps(!) progressive source. Then carefully blending 25 frames together gives a motion-blurred frame which is very close to a 1/48th shutter speed. I keep 24 of these per second resulting in a glorious-looking 24p from NTSC input.

The best part is -- all of this is controllable... if I want to smear together a full 1/24th second exposure of blurred frames, I just blend 50 frames instead of 25. Or -- If I want to vary the blending such the the beginnings and endings of the blur are more transparent than the middle -- I can do that too.

Avisynth! But man... does it take some TIME to render! And -- it takes some learning to figure out how to make it do what you want. It helps if you have some programming in your background.

If people are interested, I'd be happy to throw together a bit of a tutorial on the steps I use on my web site. (I'm not saying I'm an expert, but my ideas might give you starting points for improvements, etc.) Maybe Kin would be interested in contributing -- a joint source of Avisynth goodness!

Riley Harmon
April 4th, 2005, 03:11 PM
Jonathan, I would love for you to write up a tutorial, it would be great and very appreciated.

James Lilly
April 4th, 2005, 05:00 PM
A tutorial would be most appreciated. I really found your explanation informative. Unfortuantely, I have a couple more questions then:)

How does 24p arrived at this way compare to cameras like the XL2 and the Panasonic's native 24p? In both image quality and in resolution?

Why do sony specs indicate 530 lines of resolution if it is really 480?

Do you know how Vegas Videos 24p convertor compares?

Thank you once again for you detailed and informative response, I'm learning quite a bit today.

Joshua Provost
April 4th, 2005, 05:11 PM
James,

Difference between this and the XL2/DVX100A? I think it helps to clarify a comment earlier in this thread. NTSC does not have 29.97 frames per second that are broken up into 59.96 fields per second. It's the other way around. NTSC cameras is capturing images at 60 (come on, let's round) separate moments each second. A single frame is a combination of two moments, 1/60 second apart, thus the interlacing artifacts.

XL2/DVX100A are capturing images at 24 full frames per second.

Bottom line, you can't beat the quality of a camera that is natively doing 24p. It will be clearer and crisper than any deinterlacing and/or interpolation. You can get close, but you are essentially trying to create data that is not there.

If you see a spec of ~530 that is referring to the horizontal resolution. NTSC DV is 720x480. So it's 530 out of a possible 720. Vertical resolution, in reality, may be somewhere in the 300's.

Josh

Jonathon Wilson
April 4th, 2005, 05:41 PM
I'll write the tut as soon as I get a free evening -- It will likely be this upcoming weekend, as of now. Pretty busy week!

A 'real' 24p capture will likely always be superior because you've got 24 progressive frames of full resolution to start with. Any time you de-interlace, there has to be some interpolation which tries to figure out the missing 'in-between' lines, so a full-progressive capture will always have an edge here. How much edge... it varies on your source. The most difficult things will be sources which have a high need for vertical resolution -- very fine horizontal lines, etc. These won't do well in the interped version, where the progressive cap should see them.

The sony specs you're talking about are probably 'TV Lines'. TV Lines are a measure of horizontal resolution as a factor of aspect ratio. They're tricky, but in a nutshell, it's the number of 'identifiable details' in a single line divided by the aspect ratio:

Let's say you have something with 600 TVL of resolution -- shot at a 4:3 aspect ratio, you have a theoretical ability to resolve 600 * 4/3 or 800 horizontal pixels per line. This also gets influenced by other things, but generally, TVL are seen as a measure of horizontal resolution (columns) which are lower than the number of pixels. The higher the aspect ratio, the bigger the difference. Unfortunately, it also takes into account things like bandwidth of transmission, so you'll often see widely differing numbers.

So in answer to your question -- the 480 is the vertical resolution (in lines from top to bottom) -- the 530 is likely TV Lines which in 16:9 would be around 900 pixels, but it's not a straight conversion... search for "TV Lines" there's quite a bit of information.

http://jkor.com/peter/tvlines.html
http://members.aol.com/ajaynejr/vidcolor.htm

Btw: 'broadcast' cameras (as opposed to the 'Prosumer' cams most people here use) can turn in TVL resolutions in the 900s (!). There really is a difference between these $5000 cams and the $50,000 cams.

I'm afraid I have no experience with Vegas... other than to know that lot of people like it :) It's hard for me to believe that it 'outpowers' avisynth, but its probably much much easier to use -- and may produce perfectly fine results.

Jonathon Wilson
April 4th, 2005, 05:43 PM
Josh is exactly right on the fields vs. frames thing -- I was thinking in terms of my captures which grab 30 frames per second -- each of which has two fields-worth of data. The NTSC signal is fields. Sorry if I misled...

James Lilly
April 4th, 2005, 05:43 PM
Thank you Josh, I have always wondered about that. And this is, to be honest, one of the reasons I have just avoided the whole 24p debate with my cameras and my crew.

But now I have another question, how many lines of resolution are the 24p cameras putting out? Per frame? And what happens to the 24 p when burned onto a DVD and shown on a TV or a projector? My projector shows it at either 480i or 480p, what exactly does that mean?

Specifically, is it refering to 480 lines of resolution rather than frames per second?

Jonathon Wilson
April 4th, 2005, 05:49 PM
By the way, Josh, are you interested in sending your favorite deinterlacing methods in Avisynth? I'll be happy to include anything you send into this little web article this weekend...

Joshua Provost
April 4th, 2005, 06:31 PM
Thank you Josh, I have always wondered about that. And this is, to be honest, one of the reasons I have just avoided the whole 24p debate with my cameras and my crew.

Since you don't have a 24p camera, you don't have to bring it up with cast and crew. It will all be what you do in post, so you can keep it quiet. ;)

But now I have another question, how many lines of resolution are the 24p cameras putting out? Per frame?

The resolution recorded to the tape is the same on 60i or 24p cameras: 720x480. The real resolution? Check out these resolution test charts.

Panasonic GS400: http://www.pana3ccduser.com/images/upload/GS400_4x3_interlaced_eia1956.jpg
Canon XL2: http://www.dvxuser.com/articles/shoot3/XL2-charts/XL2%204x3%20EIA1956.JPG
Panasonic DVX100A: http://www.dvxuser.com/articles/shoot3/DVX-Charts/DVX-EIA-24p-thin-4x3.jpg

And what happens to the 24 p when burned onto a DVD and shown on a TV or a projector? My projector shows it at either 480i or 480p, what exactly does that mean?

This refers to lines, vertical lines. NTSC video (720x480) is the same as 480i.

When you burn a 24p DVD, the DVD player adds 2:3 pulldown, a special sequence of fields, to generate a 60i/480i signal.

The advantage of a 24p DVD is it has fewer frames to encode into the same bitrate, so better compression quality as compared with a 60i DVD.

All this being said, I use DVFilm Maker, and I am very pleased with it. It samples every 2.5 fields (implies some field blending is done) to try to work with the exact moments in time that you would have captured were you shooting 24p or film.

It's not terribly "intelligent" as deinterlacers go. It detects interlace artifacts (using configurable thresholds) and kills them using basic field doubling. So, it loses resolution, but only in the areas where there is motion, where your eye won't perceive the resolution loss, anyway. And it can smooth the jagged horizontal lines that may result.

It's very simple and very fast, and I like that it is a stand-alone app. It is well worth the money.

Using my GS400, DVFilm Maker, a little color correction, and a lot of work on set, I have won a cinematography award recently, and have other work on a local short film cometition TV show. I've gotten great feedback and professionals asking me what I shoot with and how I got certain looks. You can do a lot with very little.

Also, I think people get caught up in comparing still images when discussing deinterlacing. The best still does not necessarily make the best image in motion. In fact, overly crisp stills resulting from 60i-24p conversion can cause noticable strobing. Blur/resolution loss can be your friend in certain siutations.

Also, any deinterlacer that interpolates can cause strange effects when dealing with detailed patterns. The combination of DV low resolution with interpolation can be a bad thing.

I've done five or six projects now with 60i to 24p, so I hope that is some helpful information from the field.

Thanks,
Josh

James Lilly
April 5th, 2005, 10:52 AM
Thank you very much for your detailed and techincal responses, I found them interesting and informative.

But they make me wonder even more things about the damn formats. I wish we could just pick the best one and gear up technology wise for it.

Kin Kwan
April 6th, 2005, 08:14 AM
Whoa, that's a good load of info. Yea, this interlace format does cause a lot of headache. I've been searching for a good method to deinterlace my videos ever since I started making movies with my DV cam, but I don't think I'm any where close!

Jonathon, I don't know a lot about programming, but I'd love to contribute to the tutorial. Doom9 has an awesome Avisynth forum with a LOT of experts over there. I'll send you my script for the method I used for deinterlacing. Should I send it to your email?

Jonathon Wilson
April 6th, 2005, 09:00 AM
Sure thing -- whatever you send I'll include... Anyone else have good avisynth deinterlacing scripts, feel free to email them to me. I'm hoping to put something up this coming weekend.

Joshua Provost
April 6th, 2005, 12:30 PM
James,

There are standards, and unless you get an XL2/DVX100A, you will most likely be shooting NTSC 60i/480i. In the end, the TV sets will use the same to present the image. What you do in between to give a film look is up to you.

I've put together DVDs with 60i and 24p versions of the same film, and there is a big difference. Until you see the two right after each other, it can be tough to understand, but it's big. Of course, not as big a film effect as shallow depth of field (see the Alternative Imaging forum).

Josh

Riley Harmon
April 6th, 2005, 02:50 PM
Im extremely excited to see what avisynth can do for us, its incredibly flexible, but has quite a learning curve, so im interested to see what the tutorial can do for me

Riley Harmon
April 6th, 2005, 11:34 PM
I was looking around on the doom9 avisynth forums and found a really good thread about 30i to 24p conversions. This german guy made a really darn good conversion if you ask me. He has a link to the video there.

He has scripts and everything that may aide in the tutorial.

I would try it myself but I know absolutely nothing about avisynth and dont even know where to begin. Hopefully Jonathan's tutorial will help out.

Look at the stuff posted by 'scharfis_brain'
http://forum.doom9.org/showthread.php?s=&threadid=92292

Jonathon Wilson
April 7th, 2005, 09:22 AM
Well, the tutorial's not completely done yet, but Riley sounds eager to get started! (I still need to make links for some of the filters).

So here's a link to the 'alpha' version of an Avisynth Deinterlacing Tutorial:

http://aqua-web.dyndns.org/d/page.php?ID=AvisynthDeinterlacing

Bear in mind that this part of my site isn't available through the 'front door' and that anyone who heads in there is becoming a bit of a Beta Tester :)

Also - this kind of article is meant to help answer questions or make it easier to do these things. If the article doesn't accomplish that, and you have suggestions for things you wish it explained -- and doesn't -- or things you wish it explained better -- just let me know. Plus -- if other people have contributions (scripts, tips, etc.) , I'll certainly include them.

Drew Mandac
April 7th, 2005, 01:39 PM
Jonathon,
Thank you very much for writing that tutorial...it's excellent!

Drew

Jonathon Wilson
April 7th, 2005, 03:36 PM
Note -- the current tutorial only covers deinterlacing -- and is aimed at helping get avisynth set up and working.

I'm currently working on the next one, which discusses how to use Avisynth to go from 30i (or 60i depending on how you name it) to 24p... I'm hoping to finish that one by the end of the weekend.

By the way -- does anyone have some MiniDV (interlaced) source, that they'd like to provide for the basis of this tutorial? My old camcorder is too low-res and hurts the results. I'd be happy to use someone's source footage as the basis for the article... I just need a few seconds -- and I'll probably crop in to a small area of the frame.

If worse comes to worse, I can use my crappy old cam -- or generate stuff, but for this tut in particular, I think real MiniDV sources would be the best value for readers.

(Thanks Drew... it's really no problem... I like writing these kinds of things).

Riley Harmon
April 7th, 2005, 03:38 PM
id be willing to share some source footage, my aim name is FilmmakerFX or send me an email and ill host on my ftp. How detailed is the tutorial going to be, Im probably needing step-by-step stuff because even the basic avisynth stuff is boggling my mind.

Jonathon Wilson
April 7th, 2005, 03:46 PM
That'd be great, Riley. Sending an email now...

You did see that the deinterlacing tutorial is available, right? Between the 'Avisynth Basics' tutorial and the Deinterlacing one, I hope that its enough to get you going.

If its confusing (and it may be...) let me know. I'll be happy modify it, add some more setup stuff -- whatever.

The basics link:

http://www.aqua-web.com/d/page.php?ID=AvisynthBasics

and the deinterlacing link (again):

http://www.aqua-web.com/d/page.php?ID=AvisynthDeinterlacing

Ignacio Rodriguez
April 7th, 2005, 04:11 PM
Is there anything like Avisynth for OS X?

Jonathon Wilson
April 7th, 2005, 04:14 PM
Unfortunately, no. Avisynth is windows-only, and to my knowledge (and to that of my Mac Os friends), there's no corresponding program over there...

I'd love to be proven wrong on this... anyone else know of something similar for Macheads?

John McManimie
April 8th, 2005, 10:25 AM
I don't know about a scriptable program like Avisynth, but you might check out JES Deinterlacer (and additonal free tools) for Macs at:

http://www.xs4all.nl/~jeschot/home.html#DEI

Drew Mandac
April 8th, 2005, 10:46 AM
Johnathon (or any other AVISynth experts). I get CFHD and DVSD fourcc errors. Do you know how I go about telling AVISynth where the decompressors are on my computer? Is there some sort of "include" line that needs to be in the script?

TIA...


EDIT: I seemed to have solved the DVSD error by downloading the Panasonic codec from http://users.tpg.com.au/mtam/install_panvfwdv.htm

Jonathon Wilson
April 8th, 2005, 02:50 PM
Avisynth relies on the underlying operating system for codec registration. There's no separate avisynth-specific 'registration' of codecs. If it's available to windows, its available to avisynth. However, this varies by the type of source function you use:

AVISource() needs proper VFW (Video For Windows) registration. I've found these to be things like straight uncompressed AVI and HuffyYUV, and little else.

If your codec is a DirectShow codec (which I'm guessing yours are), you'll need to use:

DirectShowSource() instead of AVISource. The big trick here is to specify the framerate of your source material. Given that you're in the USA, I'm guessing your framerate will be 29.970.

Try a line like:


src = DirectShowSource("C:\MyAviFile.avi", 29.970)
return src

Kyle Edwards
April 10th, 2005, 12:18 AM
<<<-- Originally posted by Jonathon Wilson : AVISource() needs proper VFW (Video For Windows) registration. I've found these to be things like straight uncompressed AVI and HuffyYUV, and little else.-->>>

Just about everything minus WMV, RM, and Cineform's codec that comes with Premiere. Directshow takes care of that just fine.

Benjamin Durin
April 11th, 2005, 01:21 AM
Jonathon, your tutorial is great. I already used avisynth to convert some video before but I especially liked the comparison you made of the different filters. I find it very useful. The only reproach I would make is the jpeg compression is too much. The artifacts don't help to compare the filters. Otherwise it's all good !

Jonathon Wilson
April 11th, 2005, 06:25 AM
Agreed! It's even worse for movies, as any kind of compression on the video makes it really hard to compare... but making full AVIs available isn't really a possibility unfortunately. However, providing links to PNGs or similar for images is probably a good idea. I'll see if I can do some retrofitting.

By the way -- I've added a new article, which makes an attempt at a 'Film Look' using some footage provided by Riley.

See it here: http://aqua-web.dyndns.org/d/page.php?ID=Avisynth24p

And yep -- the images are JPGs again. They are saved with 100% quality, but there's still compression. Movies also have pretty serious compression, but that's the reality of limited bandwidth.

On another note, Kin provided me with his script for cleaning video using Avisynth and it really works well. I've had the chance to run it, and it has some really nice features -- which I will now be including in my own stuff :) Another advantage for some of you overseas folks -- his original script is for PAL sources. I've adapted it for NTSC and will include links to both versions.

Once I get the time, I'll put another article up showing his approach. Highlights include a nice 'deringer' for removing oversharpening, and good noise reduction, among others.

Rokta Bija
April 11th, 2005, 06:53 PM
Here is another script you might want to give a try. It converts 60i to 24p. I doesn't do any other filtering, just 60i to 24p.

Copy the following function between the dotted lines in notepad and save it as "convert60ito24p.avsi" in your Avisynth 2.5\plugin directory. Make sure you save it as an AVSI and not an AVS file.

-------------------------------------

function convert60ito24p (clip video, int mode, int offset)
{
work = assumefieldbased(video)

out =(mode==3) ? interleave(
\selectevery(
\layer(trim(work, 1, 0),
\layer(work, trim(work, 2, 0), "fast"),
\"fast"), 5, 0 + offset),
\selectevery(
\layer(
\layer(work, trim(work, 3, 0),"fast"),
\layer(trim(work, 2, 0), trim(work, 1, 0),"fast"),
\level = 170), 5, 2 + offset)) :

\ (mode==2) ? interleave(
\selectevery(
\layer(trim(work, 1, 0),
\layer(work, trim(work, 2, 0), "fast"),
\"fast"), 5, 0 + offset),
\selectevery(
\layer(work, trim(work, 1, 0), "fast"), 5, 3 + offset)) :

\ (mode==1) ? interleave(
\selectevery(trim(work, 1, 0), 5, 0 + offset),
\selectevery(layer(work, trim(work, 1, 0), "fast"), 5, 3 + offset)) :

\ (mode==0) ? selectevery(work, 5, 1 + offset, 4 + offset) : work

assumeframebased(out)
}

-----------------------------------------------

Now copy the following AVS file to notepad and change the 3rd line to whatever the filename of your AVI you want to convert. Save it as "convert60ito24p.avs" anywhere you want. This assumes your video is bottom field first, RBG24.

-----------------------------------------------

Import("C:\Program Files\AviSynth 2.5\plugins\convert60ito24p.avsi")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\dgbob.dll")
AVISource("C:\YourVideoHere.avi")
AssumeBFF()
ConvertToYUY2(interlaced=true)
dgbob(0)
convert60ito24p(2,0)
ConvertToRGB24(interlaced=false)

------------------------------------------------

Now open Virtualdub, from the file menu choose "open video file" and open the above AVS file. Once it loads, from the file menu choose "save as AVI" and your done.

Rokta Bija
April 11th, 2005, 07:01 PM
Speaking of comparing videos, here's a script that will show your before and after video side by side and show the difference below.

Copy the follwing between dotted lines to notepad, put your orignal video name and location in the line starting with v1, and modified video in v2. Save as BeforeandAfter.avs Open with Virtualdub.
-------------------------------------------------

# If Videos start at different frames
frameadjust=0

# Videos to compare: (v1 is original, v2 is encoded or whatever)

v1 = AviSource("C:\Original.avi").trim(frameadjust,0)
v2 = AviSource("C:\Modified.avi")
sub = v1.subtract(v2)
substrong = sub.levels(122,1,132,0,255)

return StackVertical(StackHorizontal(v1.subtitle("original"),v2.subtitle("encoded")),StackHorizontal(sub.subtitle("Difference"),substrong.subtitle("Difference amplified")))

--------------------------------------------------

The last line 'amplified")))' is supposed to be on the end of the line above it

Jonathon Wilson
April 11th, 2005, 10:57 PM
That convert60ito24p script also has the benefit of being way way way faster than the equivilent MV Tools version. On my 1.6 Ghz Athlon, the MVTools convert only does a frame about every 45 seconds -- but switching out DGBob and Rokta's converter, I can run 4-5 frames per second -- roughly a 10x speed increase.

Depending on the source, it can be good enough for final quality. And if not -- you can use it for proofing and run the MV version overnight once you've got everything right.

Haven't tried the difference function yet... that one's next!

Josh Barker
April 12th, 2005, 08:52 PM
function merge(clip a,clip b,float "opacity"){
opacity=default(opacity,0.5)
return a.MergeLuma(b,opacity).MergeChroma(b,opacity)
}

function convert60ito24p (clip video, int mode, int offset)
{
work = assumefieldbased(video)

out =(mode==3) ? interleave(
\selectevery(
\merge(trim(work, 1, 0),
\merge(work, trim(work, 2, 0))
\), 5, 0 + offset),
\selectevery(
\merge(
\merge(work, trim(work, 3, 0)),
\merge(trim(work, 2, 0), trim(work, 1, 0)),
\level = 170), 5, 2 + offset)) :

\ (mode==2) ? interleave(
\selectevery(
\merge(trim(work, 1, 0),
\merge(work, trim(work, 2, 0))
\), 5, 0 + offset),
\selectevery(
\merge(work, trim(work, 1, 0)), 5, 3 + offset)) :

\ (mode==1) ? interleave(
\selectevery(trim(work, 1, 0), 5, 0 + offset),
\selectevery(merge(work, trim(work, 1, 0)), 5, 3 + offset)) :

\ (mode==0) ? selectevery(work, 5, 1 + offset, 4 + offset) : work

assumeframebased(out)
}

That is the function I use. It runs a lot faster then the version above. The reason being is because they are using "layer". With that you MUST be in the YUY2 color space. With this you can easily be in the YV12 as well as other multiple color spaces as well as a big increase in speed.

I would also recommend using TDeint() instead of dgbob(). dgbob() does yield fair quality, but TDeint() blows it away by far. And if you have the time to render use MVBob(). That uses motion compensated deinterlacing methods to reconstruct a progressive frame from an interlaced frame. Then use either this method or use the function mv60ito24p(). If you use MVBob() with mv60ito24p() you will get the BEST quality possible (only if you can stand the rendering time).

Regards,
Josh

Jonathon Wilson
April 12th, 2005, 10:47 PM
Unbelievable! I've never tried MVBob before... it is simply heads and tails above all the others. It almost seems to 'restore' progressive resolution (not possible, but it almost looks like it). Plus -- it's not all _that_ slow... I was seeing several frames per second (3 maybe) on full DV source material. I can live with that for these results!

Thanks for the kick, Josh -- that was definitely worth trying out! I doubt I'll use anything else, now.