I want to stabilize a video source I have and stabilizing adds a black border all they way around it by taking 2 rows of pixels out of the original picture on all 4 sides.
Can I add black borders to the original 1920x1080 and make it 1924x1084, then afterwards let the stabilizer work on the video to leave the original picture in tact? I am hoping with this idea, that the stabilizer will simply remove or cover up the black borders I added instead of the original image. Would this work like I am thinking or would that throw the stabilizer off and make it not work properly?
+ Reply to Thread
Results 1 to 14 of 14
Why don't you try it and let us know ?
You can do this but your borders will dance around as the image is shifted. Kind of defeats the goal of getting rid of distracting movement.
What stabilizer are you using? Mercalli has a border fix option which will do all the heavy lifting for you. Just enable it. Deshaker has a border fix option which also handles this problem. Depanstabilize has an option for fixing borders.
You definitely do not want to do any cropping before you stabilize. The usual method, if you aren't going to use the border fix options is to stabilize and then crop to remove the black borders. If you have an NLE that does compositing, you can put the original video on another track and add its edges to the stabilized video, along with some feathering. It isn't as good as the built-in border fixing in a really good stabilizer like Mercalli, but it may be better than losing resolution, which is what you'll do if you crop and re-size after stabilizing.
I want to add a black border all the way around the original image that's 2 pixels wide. It will make the overall video 1924x1084 after the black is added around the original image. Then I want to use a stabilizer which will instead of putting black borders on the original image, it will simply put them in the space I made black earlier. Then I can just crop the black borders I added earlier to get back to the original resolution and leave the entire original image in tact.
In theory, this should stabilize the video and I wont have to lose any of the original image when I take the black back off. What would make the borders dance around? I will be taking those black borders back off after stabilization.
Problem is, I do not know how to add a 2 pixel wide black border all the way around the outside of the original image in avisynth. I know how to add them over the original image or inside the picture, but not to the outside of it while leaving the original alone. Which is pretty much what I am asking how to do in here so I can give this a try.
I've stabilized plenty of things before and with great results. I am just looking for help on how to add the outside border, so I can try something out to see if I won't have to crop the black off the original image then resize back up.
That's not how stabilization works!
You start with a canvas full of content, hopefully with MUCH more rez than you really need.
Then you counter-actively, dynamically adjust the cropping window so that the result is that the final region of interest is stabilized.
If you don't have a surplus of resolution in your source content, you must either:
1. live with black bars (or other similar placeholder background content) dynamically peeking in and dipping out in the final video, or
2. live with cropping down to a smaller resulting window (for example starting w 1920x1080 and ending with 1280x720 crop), or -nearly same-...
3. live with scaling up (like "zooming in") and then doing the crop window, with the result being somewhat more blurry
To make it clear: you can never "increase resolution" for any purpose, without a whole lot of other compromises.
+1 Cornucopia. The OP needs to think through how stabilization works. Once you move the current frame to match the spatial location of the previous frame by moving it in the X.Y,Z and rotated axes, that is going to create gaps around the image on the opposite sides to where the video has moved. Something has to fill in those spaces. You either synthesize some new video, using adjacent frames, as I briefly described earlier, or you zoom in to hide the borders.
The worst thing you could possibly do is to add borders prior to stabilizing because then those borders will be added to the borders created by the stabilization! I deal with this all the time with my film captures because 8mm film is perfectly square and even when captured using SD 4:3 video, I end up with pillars on either side of the video. Before I feed this to my film restoration script, which includes stabilization, I crop off those pillars so the stabilization doesn't start moving those all over the place. Then, at the end, I add back those pillars so I have a standard 720x480 4:3 video that can be put on a DVD (the usual delivery vehicle for 8mm amateur film which doesn't benefit at all from HD).
All stabilizers I've used can handle the resulting black borders. Deshaker, Adobe Warp Stabilizer, MS hyperlapse.
If you add borders first, they will be considered part of the picture by the software and ruin any chance of fix.
Unless you summon the energy from every living creature on Earth, then anything is possible...
Or watch the video on a laptop computer held by someone with Parkinson's disease seating on a washing machine, that way you don't even have to process it.
More seriously, what kind of instability does the video in question have, which is minor enough to make you think that it could be fixed by stabilizing parameters affecting only two rows of pixels on each side, yet disturbing enough to make you want to go through such hassle in the first place ?
Another way of explaining this is the stabilizer does not put on black bars on the original image . Those "black borders" consist of areas where there is no image data in the first place in your source
If you add black borders before, you will still get black borders there after. Because you added them. The black border is where the missing information was in the original source . If you replaced it with a black border, you will get a black border. If you added white border instead, you will get a white border
In the process of stabilizing, it translates the image( moves it x,y), rotates the image, zooms the image.
eg. If I move the original image 2 pixels to the right, the left border will have 2 a pixel width black column. Because there was no image data there. If you added white border before stabilization, that left 2 pixel width column border will be white.
If you "take the black off" , as in take the 2 pixel left border off you will have a 1918 width image, because the image was shifted 2 to the right. If you include the 2 pixel width out of the field of view to the right, it becomes 1920 width, but the same original image without stabilization. In other words, you just did nothing.