PDA

View Full Version : Poor Decomb-Results


Johnny_Deep_Down_Below
2nd November 2005, 17:10
Hi!

I want to convert a NTSC DVD to PAL for a friend. Her equipment is unable to playback NTSC.

The video consists of 3 progressive frames followed by to interlaced frames (--> 3:2 Pulldown, right?).

This is the script I use to get the video back to real 23,... fps (for a speedup to 25 fps afterwards):

LoadPlugin("C:\Programme\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\Decomb.dll")
MPEG2Source("E:\temp\smith.d2v")

AssumeTFF()
Telecide(guide=1)
Decimate()


Most of the resulting video is OK, but at many scene-changes the video is still interlaced, see sample pics:

http://home.scarlet.be/~il095280/crappy_ivtc/sample1.jpg
http://home.scarlet.be/~il095280/crappy_ivtc/sample2.jpg

(each picture shows three following frames, the one in the middle is the crappy one)


What to do against this? Manually deinterlacing these few frames seems a quite lame solution to me, I'm sure there is a better method, right?

foxyshadis
2nd November 2005, 17:26
From the Decomb FAQ:

Why am I getting combed frames after some scene changes?

These scene changes require a third (backward) match. Decomb will test the third match only if post is set to any value other than 0. Note that you can enable the third match testing without enabling postprocessing: you can set post=1. You can also enable three-way matching on all frames (not just ones that are combed after two-way matching) by using the triple parameter. Setting triple=true, however, can produce jerkiness.
It comes with a tutorial, a faq, and a reference, all full of advice for how to proceed when just plunking it in fails. ;) Try out a few postprocessing (=checking for combed output) settings for this case.

Johnny_Deep_Down_Below
2nd November 2005, 18:21
This is the newline:

Telecide(guide=1,post=2,vthresh=25)

(I had to set vthresh to 25 cause some frames who shouldn't were combed)


So post is greater than 0, but still there are these errors.
Also, neither Telecide nor Decimate accepts the parameter "triple=true"! What a ***** FAQ...

neuron2
2nd November 2005, 18:45
What a shitty FAQ... Just think, if you had been polite and respectful, I'd have been happy to help you. Now, instead, I'm going to strike you. I'm sure there's a lesson there if you think hard about it.

neuron2
2nd November 2005, 18:52
Take a deep breath, friend. There's no need to throw insults.

Yes, the FAQ needs to be updated. Thank you for pointing that out.

First, be absolutely sure you are setting the field order correctly. Then you may try back=1. You can use postprocessing to catch stray combs if no setting helps to find a good field match.

If none of that helps, then please post a link to a short unprocessed source clip that I can use to recreate your issue.

Two further observations: 1) If postprocessing deinterlaces your frame, it will not be combed but it will be stairstepped in moving areas. This is sometimes mistaken for combing. 2) When playing at normal speed and size, these artifacts at bad scene change edits are imperceptible, IMHO.

scharfis_brain
2nd November 2005, 19:13
alternatively you can try TFM with its ELA based post processing feature.
(read its documentation for the exact usage)
This will make the previously combed frames at scene change almost invisible.

Johnny_Deep_Down_Below
2nd November 2005, 19:28
"back=1" does not help at all, while "back=2" seems to fix the problems at the problematic points. Tomorrow I'll render the video to see it it plays smooth. VDub unfortunately can't play it back fast enough with this script anymore...

Thanks Scharfi, I'll have a look at that tomorrow, too!

Johnny_Deep_Down_Below
4th November 2005, 19:06
back=2 produces a very ugly jerkyness :(

TFM seems to work fine, I could not find any wrong frames :)

Anyway, what does this mean:

# timecode format v1
Assume 29.970
# TDecimate v0.9.11.0 by tritical
# Mode 5 - Auto-generated mkv timecodes file
0,123,23.976
124,126,17.982
127,550,23.976
551,553,17.982
554,637,23.976
643,1166,23.976
1177,1228,23.976
1234,1361,23.976
1367,1370,23.976
1396,1435,23.976
1441,1468,23.976
1469,1471,17.982
1472,1651,23.976
1672,1823,23.976
1824,1826,17.982
1827,1854,23.976
1860,1887,23.976
1893,1916,23.976
1917,1919,17.982
1920,2071,23.976
2077,2108,23.976
2109,2111,17.982
2112,2203,23.976
2209,2252,23.976
2258,2961,23.976
2967,2994,23.976
3000,3019,23.976
3025,3132,23.976
3138,3185,23.976
3196,3227,23.976
3233,3280,23.976
3286,3325,23.976
3331,3378,23.976
3384,3771,23.976
3772,3774,17.982
3775,3858,23.976
3864,3915,23.976
3921,4476,23.976
4477,4479,17.982
4480,4863,23.976
4869,5004,23.976
5010,5409,23.976
5415,5542,23.976
5548,5651,23.976
5657,5972,23.976
5973,5975,17.982
5976,6099,23.976
6105,6280,23.976
6281,6283,17.982
6284,6583,23.976
6589,6592,23.976
6598,7389,23.976
7395,7478,23.976
7494,7845,23.976
7851,8182,23.976
8188,9179,23.976
9185,9696,23.976
9697,9699,17.982
9700,10039,23.976
10040,10042,17.982
10043,10206,23.976
10212,10747,23.976
10748,10750,17.982
10751,12990,23.976
12991,12993,17.982
12994,13349,23.976
13350,13352,17.982
13353,13752,23.976
13753,13755,17.982
13756,14071,23.976
14072,14074,17.982
14075,14150,23.976
14156,14947,23.976
14948,14950,17.982
14951,15034,23.976
15040,15175,23.976
15181,15904,23.976
15910,16173,23.976
16174,16176,17.982
16177,16628,23.976
16629,16631,17.982
16632,16823,23.976
16829,17672,23.976
17673,17675,17.982
17676,17743,23.976
17749,17908,23.976
17914,18289,23.976
18295,18350,23.976
18351,18353,17.982
18354,18417,23.976
18423,18746,23.976
18752,18951,23.976
18967,19190,23.976
19196,22651,23.976
22652,22654,17.982
22655,23246,23.976
23252,24683,23.976
24694,24881,23.976
24882,24884,17.982
24885,24956,23.976
24962,25165,23.976
25171,25274,23.976
25275,25277,17.982
25278,25453,23.976
25454,25456,17.982
25457,25716,23.976
25722,27157,23.976
27163,27386,23.976
27387,27389,17.982
27390,27877,23.976
27878,27880,17.982
27881,28420,23.976
28421,28423,17.982
28424,29675,23.976
29676,29678,17.982
29679,29862,23.976
29868,30123,23.976
30124,30126,17.982
30127,30470,23.976
30471,30473,17.982
30474,30525,23.976
30531,30882,23.976
30883,30885,17.982
30886,31365,23.976
31366,31368,17.982
31369,32616,23.976
32617,32619,17.982
32620,32807,23.976
32808,32810,17.982
32811,33326,23.976
33327,33329,17.982
33330,33409,23.976
33415,33910,23.976
33911,33913,17.982
33914,34281,23.976
34287,34382,23.976
34388,34519,23.976
34520,34522,17.982
34523,34730,23.976
34731,34733,17.982
34734,34781,23.976
34787,35014,23.976
35020,35087,23.976
35093,35168,23.976
35174,35649,23.976
35650,35652,17.982
35653,36076,23.976
36082,36453,23.976
36459,36770,23.976
36781,39164,23.976
39165,39167,17.982
39168,39323,23.976
39329,39368,23.976
39374,40853,23.976
40854,40856,17.982
40857,41048,23.976
41054,41585,23.976
41591,42118,23.976
42124,42367,23.976
42368,42370,17.982
42371,42522,23.976
42543,43530,23.976
43531,43533,17.982
43534,43665,23.976
43676,43795,23.976
43796,43798,17.982
43799,43862,23.976
43868,43939,23.976
43940,43942,17.982
43943,44110,23.976
44116,44159,23.976
44165,44220,23.976
44226,44533,23.976
44539,44622,23.976
44638,45001,23.976
45007,45434,23.976
45440,45667,23.976
45673,45692,23.976
45698,46233,23.976
46234,46236,17.982
46237,46540,23.976
46551,46554,23.976
46560,46919,23.976
46930,47233,23.976
47234,47236,17.982
47237,47548,23.976
47549,47551,17.982
47552,47699,23.976
47705,47952,23.976
47958,48113,23.976
48114,48116,17.982
48117,48676,23.976
48682,49501,23.976
49507,49918,23.976
49919,49921,17.982
49922,50693,23.976
50694,50696,17.982
50697,50932,23.976
50938,51385,23.976
51386,51388,17.982
51389,51572,23.976
51573,51575,17.982
51576,52267,23.976
52273,52844,23.976
52845,52847,17.982
52848,53227,23.976
53233,53348,23.976
53354,53761,23.976
53762,53764,17.982
53765,53872,23.976
53878,53989,23.976
53995,54098,23.976
54104,54267,23.976
54273,56964,23.976
56970,57569,23.976
57570,57572,17.982
57573,57856,23.976
57862,58901,23.976
58907,59402,23.976
59403,59405,17.982
59406,59861,23.976
59862,59864,17.982
59865,60116,23.976
60122,61017,23.976
61018,61020,17.982
61021,61108,23.976
61114,62505,23.976
62511,64950,23.976
64956,65159,23.976
65160,65162,17.982
65163,65202,23.976
65208,65491,23.976
65497,65544,23.976
65565,65784,23.976
65785,65787,17.982
65788,66391,23.976
66397,67364,23.976
67370,68029,23.976
68035,69406,23.976
69412,70679,23.976
70695,70782,23.976
70793,71252,23.976
71253,71255,17.982
71256,71487,23.976
71508,71579,23.976
71600,71603,23.976
71609,71684,23.976
71690,71753,23.976
71769,71888,23.976
71904,71999,23.976
# vfr stats: 99.11% film 00.89% video
# vfr stats: 89080 - film 800 - video 89880 - total
# vfr stats: longest vid section - 25 frames
# vfr stats: # of detected vid sections - 121

This is the result after testing my video with the included 2-pass example. TFM is quite difficult to setup, so I didn't test any different configurations yet.

I couldn't yet test how smoothly it plays.
Why are there these fps-changes?
How to sync my audio with that (I planned to use TimeFactory)?

tritical
4th November 2005, 22:00
Anyway, what does this mean: It means tdecimate found a number of video sections in the clip. With default settings in mode 5 a video section is defined as one or more consectutive cycles (by default cycle=5, so 5*n frames) in which there are no duplicates via matches and all frames have difference metrics above vidThresh. If you check the vfr stats at the bottom of the timecode file it says that it found 121 vid sections but the longest one was only 25 frames. That kind of result usually means you have some sort of (for lack of a better term) messed up telecine... either due to edits, occasional mixed in interlaced parts, blending, or whatever (can't really say without seeing the source). You should make sure that vidThresh is set high enough for your source (use display=true to see the metrics). vidThresh should be set slightly higher than the average metric value produced by duplicate frames. The default for dupThresh/vidThresh are configured for relatively clean anime and not tv material.

As for how to read the timecode file, note the "Assume 29.970" at the top... that means all frame ranges not specified in the timecode file should be played at 29.970fps (video). The 23.976 sections are plain film, and the 17.982 sections are where tdecimate detected that a cycle needed to have 2 duplicates removed. This last case can happen for a number of reasons, but the most common is ivtc pattern change which can give you three cycles like the following (n=new d=dup):

ndnnn
ndnnd
nnnnd

So the middle cycle ends up with two duplicates.

How to sync my audio with that
You can only use the output from mode 5 of tdecimate if you are using matroska as the final container. In that case, simply use the generated timecode file as the timecode file for the video track in mmg (part of mkvtoolnix) and the video will be synced with the audio (no need to adjust the audio in any way).

If you can't use matroska for the container, then you will need to use a cfr solution. For tdecimate those would be:

1.) treat it all as 23.976 -- tdecimate(mode=0)
2.) treat it all as 29.970 -- don't use tdecimate()
3.) blend convert the 29.970 sections to 23.976 -- tdecimate(mode=0,hybrid=1)
4.) blend convert the 23.976 sections to 29.970 -- tdecimate(mode=0,hybrid=3)

Considering that the clip is almost exclusively film, I would say options 1 or 3 would be best for cfr handling.

Technically, I guess it would be possible to treat the output from tdecimate's mode 5 as cfr and then somehow stretch/adjust the audio track to match it. However, I've never tried (or even thought about it) and don't think it would work well.

Johnny_Deep_Down_Below
4th November 2005, 23:43
The metrics value varies. In some scenes its 0.50 and below, in some scenes it's 0.70 in the average, and in some scenes it's even higher. What value would you recommend?


Plus, I just discovered another, even worse problem with TFM/TDecimate, have a look at these pictures:

http://home.scarlet.be/~il095280/tdecimate-problem.jpg
http://home.scarlet.be/~il095280/tdecimate-problem_2.jpg

A very few times it happens that there is more than one frame with very low values. Unfortunately, just one is dropped. This results in 2 identical frames to be played and therefore in jerky motion :(

What to do about this?

tritical
5th November 2005, 19:58
The metrics value varies. In some scenes its 0.50 and below, in some scenes it's 0.70 in the average, and in some scenes it's even higher. What value would you recommend?
The defaults are fine then.

What to do about this?
First, please post the exact scripts you used. The reason it's jerky is because you've got 3 'b' matches in that one cycle and that is guarenteed to produce duplicates.... what matching mode did you use? Removing the b matches will make it smooth, but you'll have to live with deinterlaced frames instead of clean matches. There really isn't much anyone can do to help you unless can post a chunk of the vob somewhere. What kind of result do you get using the following script?

mpeg2source("xx.d2v")
deinted = last.tdeint(order=x)
tfm(d2v="xx.d2v",clip2=deinted,micmatching=0)
tdecimate(mode=0)

Johnny_Deep_Down_Below
5th November 2005, 23:36
This are the two scripts:


First pass:
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\TIVTC.dll")

d2vpath = "E:\temp\smith.d2v"


mpeg2source(d2vpath)

tfm(d2v=d2vpath,output="E:\friends2pal\tfm\temp\vid-tfm.txt")
tdecimate(mode=4,output="E:\friends2pal\tfm\temp\vid-tdec.txt")

# this next line assumes the source is dvd 720x480
# and crops it down to 32x32 to save processing time
# since we're only interested in letting tfm/tdecimate
# gather info and not the actual result

crop(344,224,-344,-224)

AssumeFPS(200)

(I added AssumeFPS(200) to do the first step by simply playing the script with VirtualDub quickly.)


Second pass:
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\TIVTC.dll")

d2vpath = "E:\temp\smith.d2v"


mpeg2source(d2vpath)

tfm(d2v=d2vpath,input="E:\friends2pal\tfm\temp\vid-tfm.txt")

# If your source is not anime or cartoon then add
# vfrDec=0 into the line below
tdecimate(mode=5,hybrid=2,input="E:\friends2pal\tfm\temp\vid-tdec.txt",tfmIn="E:\friends2pal\tfm\temp\vid-tfm.txt",mkvOut="E:\friends2pal\tfm\temp\vid-timecodes.txt",vfrDec=0)

# add other processing below, such as filtering
# cropping, resizing, color correction, etc...

assumefps(25)


Unfortunately the following script does not work:
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Programme\AviSynth 2.5\plugins\TIVTC.dll")

mpeg2source("E:\temp\smith.d2v")
deinted = last.tdeint(order=x)
tfm(d2v="E:\temp\smith.d2v",clip2=deinted,micmatching=0)
tdecimate(mode=0)


Please explain the line starting with "deinted..." to me!

mg262
5th November 2005, 23:55
I haven't checked the documentation, but this is very unlikely to be correct:

last.tdeint(order=x)

I think you're meant to replace the x with an argument (probably 0 or 1) that tells the deinterlacer whether the clip is top field first or bottom field first.

May I ask: you don't really get it playing back at 200 frames per second, do you? (Or better phrased: I'm sure you don't, but I'm curious as to whether you get anywhere near.)

Johnny_Deep_Down_Below
6th November 2005, 00:50
I haven't checked the documentation, but this is very unlikely to be correct:

last.tdeint(order=x)

I think you're meant to replace the x with an argument (probably 0 or 1) that tells the deinterlacer whether the clip is top field first or bottom field first.

I finally managed to get the script to work (with "deinted = last.tdeint(order=1)"). Unfortunately the scenes are still messed up (duplicate frames).

May I ask: you don't really get it playing back at 200 frames per second, do you? (Or better phrased: I'm sure you don't, but I'm curious as to whether you get anywhere near.)

No, just ~65 fps in the average (some scenes < 55 fps, some even > 75 fps).

foxyshadis
6th November 2005, 08:26
You know, if you turn input/output panes off, vdub will go as fast as possible when you play it no matter what the fps is. ;) (Note that it has both dub and edit modes, turn it off in dub mode and not edit.)

Johnny_Deep_Down_Below
6th November 2005, 13:28
You know, if you turn input/output panes off, vdub will go as fast as possible when you play it no matter what the fps is. ;) (Note that it has both dub and edit modes, turn it off in dub mode and not edit.)

Nice to know, but a solution for my problem would have been even better ;)

tritical
6th November 2005, 21:22
When I answered before I forgot that when tdecimate shows the match information it converts it all to seem as though it was off the bottom field. So actually what the matches were in tfm was p,c,p,c,p which makes sense using defaults. If this is indeed a scene with motion in every frame, then it certainly doesn't seem like this is material to which ivtc is applicable or possible. How much of the video produces similar results? I'll ask again for a chunk of the vob to look at, as it would allow us to figure out the problem much faster :p. If you simply deinterlace the whole clip, what metrics does tdecimate give for those cycles you posted pics of before?

Johnny_Deep_Down_Below
7th November 2005, 01:29
I don't know how often this happens, I don't think it is that often.
I'll upload a little sample of the VOB tomorrow.

If there was a possibility that the plugin writes to a log-file which cycle has more than one frames with very little metrics, than I could process these few scenes manually...

As you said I tried the following script:
tdeint(order=1)
tdecimate(mode=0)

But it still messes up the scene :(