Log in

View Full Version : Splitting and rejoining an image


TCmullet
5th June 2024, 14:16
I need to separate my video into 2 parts. 1 part is the bottom 10 (let's say) lines, and the other is the remaining lines (let's say 470). That should be easy with "crop" done differently on 2 copies of the clip.

Then I'll do different processing on each of the two clips.

How can I join the 2 parts back together, that is, append the 10 line video back onto the bottom of the 470 line video to make a new clip with 480 lines again.

Code samples would be greatly appreciated. If it can be done, I know there are geniuses here who could do it.

poisondeathray
5th June 2024, 14:24
Crop and StackVertical to reassemble

eg.


orig=colorbars()

orig.crop(0,0,0,-10,true)
#whatever filters for top
top=last

orig.crop(0,470,0,0,true)
#whatever filters for bottom
bottom=last

StackVertical(top, bottom)



If it's interlaced, you might have other restrictions for cropping depending on the pixel type (color subsampling) . YV12 interlaced restricted to mod4 height. So 10 pixels not allowed

http://www.avisynth.nl/index.php/Crop#Crop_restrictions

TCmullet
5th June 2024, 14:47
Wow, so simple! I HAVE seen StackVertical used but only by good folks here trying to create a demo video comparing 2 different sets of processing options. I never looked at the code enough for it to click in my mind that StackVertical would find a real NON-demo use. But my brain is 70, so I hope we can forgive it, ha ha.

Btw, your name really should be HealingLifeRay. That's what you've been here, not "poison" in any way!

johnmeyer
5th June 2024, 19:26
poison, I think I can use that code in some of my work. Thanks!

DTL
5th June 2024, 20:02
Some filters may not nicely process edges so the border after stacking may be more visible. For more smoother blending it is better to make some crop-padding at splitting frame and use Overlay/Layer to fit second part of frame to total frame using some X-blend of the stacking border. May be some script exist with auto-blend mask generation for given transition size.

coolgit
6th June 2024, 08:49
Use FrameArea for top part and again for bottom part.

https://forum.doom9.org/showthread.php?p=1980700#post1980700

TCmullet
6th June 2024, 22:41
Some filters may not nicely process edges so the border after stacking may be more visible. For more smoother blending it is better to make some crop-padding at splitting frame and use Overlay/Layer to fit second part of frame to total frame using some X-blend of the stacking border. May be some script exist with auto-blend mask generation for given transition size.
Thanks for this option. I'm capturing VHS tapes. On many decks the head switching visual noise at the bottom is objectionable enough it has to be cropped (or blacked) in some way. But one deck of mine is shockingly good at the luminance staying clean, and the only problem is discolorization. I have split the bottom 8 lines off, attempted cleanup, and stacked back together. I haven't seen any problem like you described. (But I still haven't gotten it clean like I'd prefer. It may not be solvable, BUT I haven't yet tried other filters yet. QTGMC may help, which I'll do on the whole frame after the verticalstack.)