View Full Version : yet another deinterlacing question...
ParkerLewis
23rd February 2008, 22:09
...although a pretty simple one (hopefully).
Hello all,
I'm basically a newbie at DV deinterlacing. I have read the stickies, and searched the forums, but can't really find an answer to my (simple problem). So here it is :
-I'm using VirtualDub(mod), and i'd really prefer if i could stick to it.
-I'm used to SmartDeinterlace (2.8 beta, i think it should be the most recent one), but any other filter is fair game if it's the better choice. Only thing is, i'd prefer to avoid any method doubling the actual framerate of the video, if possible.
-I have some PAL DVSD material (interlaced, 720*576, 25 fps, should be pretty standard).
And I can't seem to find correct settings to use in Smart Deinterlace to make the output look good. Basic blend produces massive ghosting, other interpolation produces artifacts, and field shifting doesn't seem to help either, at least based on my testing, so I'm starting to feel a little lost.
Here is an example of some of the material I'm working with (~15 MB, selected for its great movement to help decide on the deinterlacing method) :http://www.nxtelevision.com/~parkerlewis/00.avi
So, i'd be very thankful if any of you could help me get a good quality progressive video out of this sample... thanks !
Guest
23rd February 2008, 22:19
You have a one-field phase shift. Use:
Telecide()
ParkerLewis
23rd February 2008, 22:28
You have a one-field phase shift. Use:
Telecide()
Thanks a lot for your quick reply.
I have downloaded the 1.3.0 version from your website. Which settings should I use in it ? What about the Smart Deinterlace ones ?
Thanks again for your help and congratulations on your work on those filters (well, i can only speak for SD right now as it's my first time using Telecide)
Guest
24th February 2008, 02:40
When I refer to Telecide() I mean the Avisynth version. :)
The VirtualDub version isn't working on your clip. :( I'll look into it but I know that the Avisynth version works fine because I tried it.
Just install Avisynth then make this text file called 00.avs:
AviSource("00.avi")
Telecide()
Then open the 00.avs file in VirtualDub using File/Open video file.
ParkerLewis
24th February 2008, 11:32
When I refer to Telecide() I mean the Avisynth version. :)
The VirtualDub version isn't working on your clip. :( I'll look into it but I know that the Avisynth version works fine because I tried it.
Just install Avisynth then make this text file called 00.avs:
AviSource("00.avi")
Telecide()
Then open the 00.avs file in VirtualDub using File/Open video file.
Once again, thanks for your help.
I'll do that then. It's still would be great if you were to find out why the vdub version didn't work. (I'm a member of a student tv club and the more simple the method is, the easier it is to teach others to use it. Although the avisynth script sure is simple, it'd be more convenient to keep all the compression operations inside vdub).
Edit : here's the script i ended up using :
AviSource("00.avi")
ConvertToYUY2()
AssumeBFF()
Telecide(guide=2)
I had to convert to yuy2 first since it was otherwise refused by telecide for being rgb (as the manual specifies).
The result did not look that good (i did not use any other filter, be it in avisynth or in virtualdub). The ghosting was definitely gone though, and it was still better than what i managed to get from using smart deinterlace before.
Did I go wrong at some point or is it just the best that can be done ?
scharfis_brain
24th February 2008, 12:21
@neuron2: it is not phase shifted progressive!
telecide() is the wrong option here.
The video is 19x9 anamorphic PAL DV 50i.
So one needs to deinterlace it, if interlacing is no option.
@ParkerLewis
SmartDeinterlace for Virtualdub *may* be a solution but there are many other recent deinterlacers for avisynth available.
Why do you want to deinterlace this video? (Which purpose)
ParkerLewis
24th February 2008, 12:29
Hi,
thanks for your reply. I want to deinterlace it for compression purposes. I intend to compress it in a progressive mpeg-4 file afterwards.
scharfis_brain
24th February 2008, 12:36
do you need speed or quality?
bb
24th February 2008, 13:08
Common DV footage is either progressive or interlaced. I can't imagine why somebody would introduce a phase shifting step in the workflow; that makes no sense.
Telecide can correct phase shift automatically, even if it changes over time (e.g. due to field drops in a capturing scenario). But as scharfis_brain wrote, this filter is not appropriate here.
Quote from www.neuron2.net, Telecide Filter for VirtualDub:
Please note that this filter is not intended to act as a general-purpose deinterlacer and is therefore not intended for use on real interlaced source material. Use the Smart Deinterlacer for such material.
The AviSynth Telecide can do some real deinterlacing, but that is meant to be used for postprocessing only, not as the main function. That's probably the reason why the VirtualDub version didn't work on the clip, whereas the AviSynth version did...
There are many good deinterlacers available for AviSynth, e.g. KernelDeint by neuron2 (@neuron2: why didn't you recommend that one? :) )
bb
scharfis_brain
24th February 2008, 13:40
I don't recommend KernelDeint anymore cause it has weaknesses with its motionmask. There are better option these days like yadif() (yadifmod()) or tdeint()/tmm()
a phase shift of progressive DV may happen, if some software in the process touched the fieldorder. but this isn't the case here. the video simply is 50i.
Guest
24th February 2008, 15:43
@neuron2: it is not phase shifted progressive! Oops. It's the Irish whiskey again. Sorry.
Confused it with another clip I was working on at the same time. :)
ParkerLewis
29th February 2008, 19:55
do you need speed or quality?
Definitely quality.
So, what should I do ? Preferably without having to use Avisynth, but it's not that big a deal either.
Thanks everyone
scharfis_brain
29th February 2008, 19:58
the currently 'best' deinterlacer for natural footage is mcbob() for AVISynth.
ParkerLewis
29th February 2008, 20:46
the currently 'best' deinterlacer for natural footage is mcbob() for AVISynth.
Thanks. But...
-isn't it awfully complex to use ?
-doesn't it double the framerate (won't I end up with a 50p file) ?
Since this is for a student tv use, we have to respect some standards to diffuse the vids, and ideally the compression to mpeg4 step has to be easy to learn. Of course, I understand there probably ain't gonna be any 'perfect' solution, and some compromises will have to be made. But isn't there another option that could better fit my needs (unless i'm mistaken about mcbob, of course) ?
Thanks again for your help.
Guest
29th February 2008, 21:29
SmartDeinterlace for VirtualDub should meet your stated needs. You said you saw some artifacts. What do you see that bothers you with these settings on your posted clip?
Field-only differencing
Cubic interpolate
Compare color channels
Motion map denoising on
Motion threshold 12
All advanced processing off
Scene change 100
If you are talking about some small residual combing you can see when you freeze frame and then zoom in, then remember this:
"Caveat About Residual Combing: People will often freeze on an frame and zoom in closely and see some faint residual combing and agonize over it. But that is a seriously misguided way to assess residual combing. Human perception cannot register contrast when the difference becomes less than a threshold. But the threshold gets lower as the feature size gets larger. That means that when you zoom in, you get an incorrect idea of what can actually be seen at normal size. Also, when things are in motion we see them with reduced resolution; therefore, freezing the frame gives an incorrect idea of what can be perceived. To assess residual combing, play the clip at normal speed and size. If it looks good, then be happy!"
ParkerLewis
29th February 2008, 21:40
SmartDeinterlace for VirtualDub should meet your stated needs. You said you saw some artifacts. What do you see that bothers you with these settings on your posted clip?
Field-only differencing
Cubic interpolate
Motion map denoising on
Motion threshold 12
All advanced processing off
Scene change 100
Well, every frame is basically ugly... seeing horizontal lines on every frame and hideous things here and there...
For a precise example, just look at frame 54 (i'm mentioning this frame in particular but really, all frames are basically like this) in vdub after applying the filter with said options. Guy's face look like it's been remade in a hospital after an accident. You'll also see the horizontal lines everywhere.
I don't know if this is because the settings are inappropriate or because it's the method's limit, but even a plain "Blend" seems better than this :/
Edit after seeing your edit ;) : yes, i know. i really wouldn't care about minor things only visible in static zoom mode. But this is definitely not the case here. It's also ugly when playing the video.
Guest
29th February 2008, 22:31
Oh, yeah. The hard thresholds really tear that up. That's a real torture scene for a deinterlacer.
OK, install Avisynth and try this simple script:
avisource("00.avi")
leakkerneldeint(order=0,threshold=0)
This is a decent tradeoff of complexity versus speed.
Maybe I should make a VirtualDub version of this.
scharfis_brain
29th February 2008, 22:45
instead of leakkerneldeint() I would recommend yadif() if speed is an issue.
yadif() offers an adaptive soft threshold, so combing artifacts nearly never show up, while static areas are being kept static.
ParkerLewis
29th February 2008, 22:47
instead of leakkerneldeint() I would recommend yadif() if speed is an issue.
My actual needs are :
Quality > Ease of use/teaching > Speed
Oh, yeah. The hard thresholds really tear that up. That's a real torture scene for a deinterlacer.
OK, install Avisynth and try this simple script:
avisource("00.avi")
leakkerneldeint(order=0,threshold=0)
I have installed said script. yet, I get an error message saying the source for this filter must be RGB32, YUY2 or YV12.
Of course I guess I could use one of the "ConvertTo" functions of Avisynth, but wasn't my source RGB32 already ?? Or is it because it was rgb24 ? i'm getting confused... :confused:
Anyway, I used ConvertToYUY2() :
avisource("00.avi")
ConvertToYUY2()
leakkerneldeint(order=0,threshold=0)
which clearly gave me the best result so far (what i had achieved before with the others methods was not even close). still, a few macroblocks are appearing here and there - although this time, i'd be ok considering these artifacts "minor" and living with it. i'm just asking in case it would actually be possible to get rid of them too. Here's a link to the resulting video :
http://www.nxtelevision.com/~parkerlewis/LKDeint.avi
yadif() offers an adaptive soft threshold, so combing artifacts nearly never show up, while static areas are being kept static.
Does that mean it would be more appropriate if I were to have a video combining different kind of scenes (action/movement scenes, but also very static ones) ?
Thank you all for your help.
Guest
1st March 2008, 02:56
I have installed said script. yet, I get an error message saying the source for this filter must be RGB32, YUY2 or YV12.
Of course I guess I could use one of the "ConvertTo" functions of Avisynth, but wasn't my source RGB32 already ?? Or is it because it was rgb24 ? i'm getting confused... :confused: Make a script like this:
avisource("00.avi")
Info()
It will tell you the color space being delivered by your DV codec. I use Cedocida and it can be configured to deliver the color space you want on decoding.
still, a few macroblocks are appearing here and there - although this time, i'd be ok considering these artifacts "minor" and living with it. i'm just asking in case it would actually be possible to get rid of them too. Please always give the frame number. LeakKernelDeint can't make macroblocks, so I suspect it is in the source. When you give me the frame number to look at I'll have a look.
Does that mean it would be more appropriate if I were to have a video combining different kind of scenes (action/movement scenes, but also very static ones)? Even in a single picture, you have moving and static areas. Cheap deinterlacers, like SmartDeinterlacer, have a hard threshold for distinguishing the two. With torture clips such as yours, the hard thresholds do nasty things as you have seen. Yadif has a more intelligent thresholding mechanism. I don't use it but it's worth a try.
ParkerLewis
1st March 2008, 12:41
Make a script like this:
avisource("00.avi")
Info()
It will tell you the color space being delivered by your DV codec. I use Cedocida and it can be configured to deliver the color space you want on decoding.
Thanks a lot. That's a very useful command (i'm a complete avisynth beginner). It is a RGB24 clip as suspected. Note : I have changed the script for rgb24->rgb32 conversion instead of the previous rgb24->yuy2 conversion (hence no precision loss, right ?)
avisource("00.avi")
ConvertToRGB32()
leakkerneldeint(order=0,threshold=0)
Please always give the frame number. LeakKernelDeint can't make macroblocks, so I suspect it is in the source. When you give me the frame number to look at I'll have a look.
Here again, most of them have those little artifacts. they're mostly located on the guy's face, but sometimes also on the trees/sky separation.
You can take a look at frames 24-25-26 for example. There are a lot of them on the guy's face (and a little on the trees/grass upper limit in frame 26). You can also look at frame 47, or also 54 (nose, beard & scarf of the guy).
They're basically on almost every frame, but this is where it's the worst. It'd be delightful if I could just reduce the number of those.
Even in a single picture, you have moving and static areas. Cheap deinterlacers, like SmartDeinterlacer, have a hard threshold for distinguishing the two. With torture clips such as yours, the hard thresholds do nasty things as you have seen. Yadif has a more intelligent thresholding mechanism. I don't use it but it's worth a try.
I'll give it a try, thanks a lot. So, Yadif is basically able to automatically detect the threshold level to apply to its algorithm, without the user having to manually set it ? And also able to change it in real time along the way if needed by the clip ?
What's the downside of Yadif then ?
Thanks for all the help.
scharfis_brain
1st March 2008, 13:04
What's the downside of Yadif then ?
It sometimes deinterlaces areas, that are completely static, though.
Also its internal interpolation isn't that good. It yields into a wax-like look.
You also want to try yadifmod() from tritical.
Which essentially is yadif()'s motionmasking without interpolation.
The interpolation has to be done as a separate step.
So you are free to choose, how the missing lines gets interpolated:
Cubic:
source.yadifmod(edeint=source.bob().selecteven())
Kernel:
source.yadifmod(edeint=source.leakkerneldeint(threshold=0))
NNEDI:
source.yadifmod(edeint=source.nnedi())
the nnedi interpolation currently is the best edge directed interpolation avaiable currently. It is almost free of unpleasant artifacts, while avoiding stairstepping in deinterlaced areas.
ParkerLewis
1st March 2008, 13:32
source.yadifmod(edeint=source.nnedi())
I get an
Avisynth open failure : I don't know what "source" means
error.
i've tried googling it, but all i get is other kinds of open failures.
Could you tell me what I should do ?
Thanks.
scharfis_brain
1st March 2008, 13:35
you really should get some basic about AVISynth scripting ;)
"source" is a variable containing the source video.
full example script:
loadplugin("C:\AVS-Plugins\yadifmod.dll")
loadplugin("C:\AVS-Plugins\nnedi.dll")
source=AVISource("DV-Video.avi")
source.yadifmod(edeint=source.nnedi())
ParkerLewis
1st March 2008, 14:19
you really should get some basic about AVISynth scripting ;)
"source" is a variable containing the source video.
full example script:
loadplugin("C:\AVS-Plugins\yadifmod.dll")
loadplugin("C:\AVS-Plugins\nnedi.dll")
source=AVISource("DV-Video.avi")
source.yadifmod(edeint=source.nnedi())
Ok, since I had never assigned a variable name to the avisource, I jst didn't get at all you did ;). Anyway, the code I'm using is
avisource("00.avi")
ConvertToYUY2()
yadifmod(edeint=nnedi())
The result is exactly the same as with my previous attempt with leakkernel, which was
avisource("00.avi")
ConvertToRGB32()
leakkerneldeint(order=0,threshold=0)
By "exactly the same", I mean that if I compare two frames, I get the exact same artifacts at the exact same spots. I actually can't visually tell the two methods apart, even on a frame-by-frame basis.
So, I guess this means yadifmod should be the way to go, right ? Because if I understood correctly, while being as efficient here as the leakkernel with hard threshold, it would fare better on rest of the clip if it were to be more static by being able to auto-adjust its threshold, while leakkernel woud have to continue operating at threshold=0 ?
Thanks for everything.
scharfis_brain
1st March 2008, 14:25
use converttoyuy2(interlaced=true)
ParkerLewis
1st March 2008, 14:35
use converttoyuy2(interlaced=true)
From avisynth.org :
interlaced: Default false. Use interlaced layout for YV12 <-> non-YV12 conversions.
Note, the interlaced=true setting only does something if the conversion YV12 <-> YUY2/RGB is requested, otherwise it's simply ignored.
So i thought it was only necessary if input or output were to be YV12 (which is not the case here). Do I need it anyway since the vid is interlaced ?
scharfis_brain
1st March 2008, 14:58
what colour space is the video source after avisource() without conversion?
ParkerLewis
1st March 2008, 15:01
what colour space is the video source after avisource() without conversion?
As I suspected before and as was confirmed by Info() in a previous post, it's RGB24.
scharfis_brain
1st March 2008, 15:13
provide a screenshot of the artifacts you see.
I cannot confirm this here. I got a perfectly deinterlaced image.
Guest
1st March 2008, 15:20
You can take a look at frames 24-25-26 for example. There are a lot of them on the guy's face (and a little on the trees/grass upper limit in frame 26). You can also look at frame 47, or also 54 (nose, beard & scarf of the guy).
They're basically on almost every frame, but this is where it's the worst. It'd be delightful if I could just reduce the number of those. Those are caused by your DivX encoding! They are not present when you just view the script in VirtualDub. You are using an older version of DivX that may be buggy. Try the latest version and if they are still there, tell us your settings for encoding.
Guest
1st March 2008, 15:23
So i thought it was only necessary if input or output were to be YV12 (which is not the case here). Do I need it anyway since the vid is interlaced ? You said earlier that Avisource was delivering 00.avi as RGB24, so you need the interlaced=true.
ParkerLewis
1st March 2008, 15:24
Those are caused by your DivX encoding! They are not present when you just view the script in VirtualDub. You are using an older version of DivX that may be buggy. Try the latest version and if they are still there, tell us your settings for encoding.
No, they're not ;)
I see them before the divx encoding (which btw is 6.8 Pro).
Guest
1st March 2008, 15:26
Give a screenshot of a frame showing them. Load the script into VirtualDub and use VirtualDub's Video/Save source frame feature, then paste to graphics editor to save.
I see the artifacts only in your encoded AVI. And scharfi isn't seeing anything either.
ParkerLewis
1st March 2008, 15:28
provide a screenshot of the artifacts you see.
I cannot confirm this here. I got a perfectly deinterlaced image.
Here it is :
http://www.nxtelevision.com/~parkerlewis/frame54.tga
This image is the result of the "Snapshot source frame" option in VirtualDubMod 1.5.10.2 when opening the following script :
avisource("00.avi")
ConvertToYUY2(interlaced=true)
yadifmod(edeint=nnedi())
(btw, setting interlaced=true doesn't have any effect as hinted by the avisynth.org website)
You said earlier that Avisource was delivering 00.avi as RGB24, so you need the interlaced=true.
How come ? That's not what the avisynth.org says :
interlaced: Default false. Use interlaced layout for YV12 <-> non-YV12 conversions.
Note, the interlaced=true setting only does something if the conversion YV12 <-> YUY2/RGB is requested, otherwise it's simply ignored.
And I'm not using YV12 in either input or output.
Edit : wow you're fast ;)
I was actually editing my previous post with the info you just asked. Thanks a lot again.
scharfis_brain
1st March 2008, 15:34
your dv-decoder seems to be faulty.
install CedoCida, or another decoder.
the deinterlacers do NOT produce blocking.
Guest
1st March 2008, 15:38
Get Cedocida at my website:
http://neuron2.net
It's in the Hosted section.
ParkerLewis
1st March 2008, 15:39
your dv-decoder seems to be faulty.
install CedoCida, or another decoder.
the deinterlacers do NOT produce blocking.
My current decoder is "Sony Software DV Codec v2.23". Is it known for being bad ? Is CedoCida known for being better ?
Edit : tested with CedoCida - the artifacts are gone !
Thanks a lot ! I would have never suspected a Sony codec (main DV developer) to be at fault here... result is now perfect.
You are my gods :)
henryho_hk
10th April 2008, 05:58
BTW, if you want to use YV12 output of Cedocida (i've forgotten what's the default of AVISource), you must configure it correctly for your subsequent work (e.g. if you are encoding to DVD, XviD, H.264 etc., configure it to produce MPEG2-Interlaced for YV12 output, as said in Cedocida Readme.txt). Otherwise, the color information would be incorrect.... although not easily noticeable.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.