Log in

View Full Version : Help with frame-decimation script :-)


anathema
23rd January 2006, 10:54
Howdy,
I'm working with a video clip that's undergone a cheap-n-cheerful PAL->NTSC conversion. I'm still in the process of working out the exact details, but essentially the conversion was done by repeating selected fields in roughly this sequence:

There are 32 repeats of [5 unique frames + duplicate of frame #5] followed by [6 unique + dupe of #6], and then the sequence restarts.

This isn't quite the end of it - I've found a case where the [5+1] sequence appears 34 times between a pair of [6+1], but presumably if I hunt for long enough I'll find the period of this pattern too :-)


Anyway, since the original PAL fields exist (bar a few lines), I'm attempting to remove the dupes and get the original 50i sequence back. This is unfortunately a bit beyond the capabilites of SelectEvery/SelectRangeEvery... As a programmer, my first inclination is to write a simple while() loop, but AVS doesn't support them and my attempts to use recursion just result in me running out of stack :-(


Can anyone suggest anything, please? :-) Thanks!

Mug Funky
23rd January 2006, 12:15
try:

telecide(order=1).decimate(6)

you'll need the decomb package to do this.

to explain:

telecide matches fields between frames - if there's a regular pattern of repeated fields, it'll find them and give you a progressive sequence at the input framerate.

decimate(n) removes 1 frame in every n frames based on which frame is the most similar to adjacent frames, and is thus most likely to be a duplicate. removing 1 in 6 frames will bring 30 down to 25...

[edit]

oops, you've got a 50i -> 60i sequence, do you? this makes things fun :) perhaps tdeint(1,1,tryweave=true) + decimate(6) can help?

anathema
23rd January 2006, 13:31
try:

telecide(order=1).decimate(6)

you'll need the decomb package to do this.

to explain:

telecide matches fields between frames - if there's a regular pattern of repeated fields, it'll find them and give you a progressive sequence at the input framerate.

decimate(n) removes 1 frame in every n frames based on which frame is the most similar to adjacent frames, and is thus most likely to be a duplicate. removing 1 in 6 frames will bring 30 down to 25...

[edit]

oops, you've got a 50i -> 60i sequence, do you? this makes things fun :) perhaps tdeint(1,1,tryweave=true) + decimate(6) can help?

Interesting :-) How reliable is the dupe-detector? I'm concerned that it might accidentally delete a legit field when the shot is static.

Oh, and just to add to the fun: the video source is a 22-year-old Betamax recording, and it's pretty noisy...