Karyudo
9th October 2004, 04:31
On occasion, I have been interested to repair one copy of a clip using good portions of a second, generally-inferior clip. For example, if I have a DVD rip with hard subs and a VCD version with no subs, I'd like to be able to replace the areas of the DVD frame containing subs with the same part of the VCD, and get a result that maintains most of the DVD frame quality, just using the VCD to patch over the area with subs.
Regardless of how the repair is attempted (averaging, masking, replacing frames, rotoscoping, etc.), the first step pretty much has to be aligning the two sources, both in time (i.e. same frames must be shown at the same time) and in space (i.e. x-y coordinates of both clips must match). In my above example, you'd have to scale up the VCD (320 x 240 or something?) to match the DVD (720 x 576, let's say).
Lining clips up in the time axis is pretty easy to do with good sources (no frame drops) and something like StackVertical, so maybe that can be left manual at the moment.
But lining up two clips in space is painful, slow, and boring work!
I've noticed work being done on motion vector tools (like MVTools), and I got to wondering:
Would it be possible to write a filter that used motion vectors to automatically align two (or more) clips in space (and maybe time)?
I don't know nearly enough about the practical application of motion vectors, but I can imagine that two copies of the same clip would produce identical sets of motion vectors. Two copies of the same clip *of different frame sizes* should give a set of vectors that is the same, except for an offset of the origin and a scaling vector. I therefore suspect it should be possible to use calculated motion vectors from the two sources to back-calculate the appropriate offsets and scaling factors needed to supersample (and then downsample) the smaller frame to match the larger one. Once the smaller frame is scaled up and matched to the larger, any intra-frame work can then be performed as flawlessly as possible.
[A further abstraction would be to use the motion vectors to line up the two sources in time, as well, although I can see that being a lot of work up front that doesn't save all that much effort on the back end.]
Am I out to lunch, or could this work? If it could work, does anyone have any better idea than I how to do it in practice??
Regardless of how the repair is attempted (averaging, masking, replacing frames, rotoscoping, etc.), the first step pretty much has to be aligning the two sources, both in time (i.e. same frames must be shown at the same time) and in space (i.e. x-y coordinates of both clips must match). In my above example, you'd have to scale up the VCD (320 x 240 or something?) to match the DVD (720 x 576, let's say).
Lining clips up in the time axis is pretty easy to do with good sources (no frame drops) and something like StackVertical, so maybe that can be left manual at the moment.
But lining up two clips in space is painful, slow, and boring work!
I've noticed work being done on motion vector tools (like MVTools), and I got to wondering:
Would it be possible to write a filter that used motion vectors to automatically align two (or more) clips in space (and maybe time)?
I don't know nearly enough about the practical application of motion vectors, but I can imagine that two copies of the same clip would produce identical sets of motion vectors. Two copies of the same clip *of different frame sizes* should give a set of vectors that is the same, except for an offset of the origin and a scaling vector. I therefore suspect it should be possible to use calculated motion vectors from the two sources to back-calculate the appropriate offsets and scaling factors needed to supersample (and then downsample) the smaller frame to match the larger one. Once the smaller frame is scaled up and matched to the larger, any intra-frame work can then be performed as flawlessly as possible.
[A further abstraction would be to use the motion vectors to line up the two sources in time, as well, although I can see that being a lot of work up front that doesn't save all that much effort on the back end.]
Am I out to lunch, or could this work? If it could work, does anyone have any better idea than I how to do it in practice??