Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER for Video Editing/Mangling

Reply
 
Thread Tools Display Modes
Old 03-07-2022, 12:51 PM   #1
Sid
Human being with feelings
 
Join Date: Apr 2018
Posts: 515
Default [Solved] Is Smooth Cropping Automation Possible

Hi, I am using a track envelop to try to smoothly crop and un-crop an image overlay. However, as the video plays, the overlay seems to zoom slightly in and out as well as moving up, down, left, right while the cropping happens.

I have tried a number of different presets posted on the forum, and have not found one that doesn't do this. Does anyone know of a preset that can be smoothly automated in this way? Is there some setting that I'm doing wrong?

Thanks.

Last edited by Sid; 03-12-2022 at 08:48 AM.
Sid is offline   Reply With Quote
Old 03-07-2022, 05:41 PM   #2
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

Quote:
Originally Posted by Sid View Post
Hi, I am using a track envelop to try to smoothly crop and un-crop an image overlay. However, as the video plays, the overlay seems to zoom slightly in and out as well as moving up, down, left, right while the cropping happens.

I have tried a number of different presets posted on the forum, and have not found one that doesn't do this. Does anyone know of a preset that can be smoothly automated in this way? Is there some setting that I'm doing wrong?

Thanks.
At first sight it looks like a rounding issue in the cropping preset. I have been struggling with this problem for months until I found that gfx_blit() has bugs with w/h sizes that are not an even number. The trick is to round to even numbers

ex:
gfx_blit(img, crx, cry, crw & 0xFFFE, crh & 0xFFFE)

yes that strange "&0xFFFE" converts to even

Hope this solves your problem.
papagirafe is offline   Reply With Quote
Old 03-07-2022, 06:09 PM   #3
Sid
Human being with feelings
 
Join Date: Apr 2018
Posts: 515
Default

That seems to be getting me close. In testing, I have found that if the image has a scale factor of 1 (not scaled up or down), it remains solidly in place. Any other scale factor allows for the errors. I will keep looking.

Thanks for your suggestion.
Sid is offline   Reply With Quote
Old 03-08-2022, 04:32 AM   #4
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

Quote:
Originally Posted by Sid View Post
That seems to be getting me close. In testing, I have found that if the image has a scale factor of 1 (not scaled up or down), it remains solidly in place. Any other scale factor allows for the errors. I will keep looking.

Thanks for your suggestion.
Sid, here is a smoother cropping preset. It just crops the image so you need to add the stock "Overlay: image overlay" to control zoom and position. Enjoy!

Code:
//Basic helpers: crop
//by papagirafe
//@param cl "crop left" 0 0 1 0.5 0.001
//@param cr "crop right" 0 0 1 0.5 0.001
//@param ct "crop top" 0 0 1 0.5 0.001
//@param cb "crop bottom" 0 0 1 0.5 0.001

E=0xFFFE;
input_info(0,w,h);
cl=(cl*w)&E;cr=(cr*w)&E;ct=(ct*h)&E;cb=(cb*h)&E;
cx=cl;cy=ct;
cw=w-(cl+cr);ch=h-(ct+cb); 
project_w=cw; project_h=ch;
gfx_set(0,0,0,1,mode,-1);
gfx_blit(0,1,0,0,cw,ch,cx,cy,cw,ch);

Last edited by papagirafe; 05-07-2023 at 04:45 PM. Reason: parameter "use alpha" is useless
papagirafe is offline   Reply With Quote
Old 03-08-2022, 11:41 AM   #5
Sid
Human being with feelings
 
Join Date: Apr 2018
Posts: 515
Default

Thank you!
That creates a very smooth crop automation. As you suggested, it does cause the image to shift slightly leftward when cropping from the left, so that has to be automated back. But otherwise, very nice.
Sid is offline   Reply With Quote
Old 03-08-2022, 01:09 PM   #6
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

Quote:
Originally Posted by Sid View Post
Thank you!
That creates a very smooth crop automation. As you suggested, it does cause the image to shift slightly leftward when cropping from the left, so that has to be automated back. But otherwise, very nice.
Great! One can easily create a variation on the preset that crops at a distance around a central point of choice.
papagirafe is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:20 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.