Old 08-07-2022, 03:25 PM   #1
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default how to crop green screen vid?

Recently I did a clip using background vid and my green screen.
I used green screen vid without cropping.
Zooming allowed me to "exclude" studio equipment visible out of green.
Now I want to try with no zoom, so stands are visible in combined vid.

I guess that cropping green screen vid prior to combine with background will make the life easy.

So, how to do that.
simple explanation please

Thx.

here are screenshots
https://1drv.ms/u/s!Ar0t68kb42Tx4jir...qfaQV?e=1sA7lL
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-07-2022, 04:35 PM   #2
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

Quote:
Originally Posted by mla View Post
Recently I did a clip using background vid and my green screen.
I used green screen vid without cropping.
Zooming allowed me to "exclude" studio equipment visible out of green.
Now I want to try with no zoom, so stands are visible in combined vid.

I guess that cropping green screen vid prior to combine with background will make the life easy.

So, how to do that.
simple explanation please

Thx.

here are screenshots
https://1drv.ms/u/s!Ar0t68kb42Tx4jir...qfaQV?e=1sA7lL
Not completely shure what you are really looking for but based on these assumptions:
1- lateral equipement is not moving
2- you just want to keep image the equipment but not the walls

Take a static picture of your equipment in a similar position but with the green screen behind (no walls). Cut the picture in the middle, make 2 pngs or jpgs out of it. With 2 "image overlay" paste your 2 half picture on the sides of your main video. Then use your green combine filter on top of everything.
papagirafe is offline   Reply With Quote
Old 08-07-2022, 05:03 PM   #3
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

thanks for the answer...

I made a mistake in my initial post

the phrase "Now I want to try with no zoom, so stands are visible in combined vid." is not correct.

I want that umbrella stands will NOT be visible.

See pics "need this" "instead of"
https://1drv.ms/u/s!Ar0t68kb42Tx4jir...qfaQV?e=oZXEsw

I want to have only a sax player in the clip, cropping the edges with umbrella.
How to do it?
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-07-2022, 06:33 PM   #4
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

Quote:
Originally Posted by mla View Post
thanks for the answer...

I made a mistake in my initial post

the phrase "Now I want to try with no zoom, so stands are visible in combined vid." is not correct.

I want that umbrella stands will NOT be visible.

See pics "need this" "instead of"
https://1drv.ms/u/s!Ar0t68kb42Tx4jir...qfaQV?e=oZXEsw

I want to have only a sax player in the clip, cropping the edges with umbrella.
How to do it?


A classic solution for this would be to repaste (using overlay image) the cropped left/right sides of the background on top of the green filtered video. But I made a quick hack of the green filter preset to reduce green filter to an area of the source. That should solve your problem. Just replace the stock preset with the new one and play with the green srcx,y,w,h,ox,oy to keep and position only what you need from your green video.

Code:
// Chroma-key (YUV version) - area
//quick hack  by papagirafe
//@param1:hue 'hue: g=-136,b=0' -136 -180 180 0 1
//@param2:mag saturation .7 0 1.0 0.5 .01
//@param3:thresh threshold .41 0 1 .5 .01
//@param4:gain gain 1.8 0 8 4 .1
//@param6:swap 'input swap' 0 0 1 0.5 1
//@param gsx "green src x" 0 0 2000 1000 1
//@param gsy "green src y" 0 0 2000 1000 1
//@param gsw "green src w" 1000 0 2000 1000 1
//@param gsh "green src h" 1000 0 2000 1000 1
//@param gsox "green src off x" 0 -1000 1000 0 1
//@param gsoy "green src off y" 0 -1000 1000 0 1

in1=0;
in2=input_track(0);
swap ? (tmp=in1;in1=in2;in2=tmp;);
input_info(in1,w,h) && in2 != in1 ? (
  gsw=min(gsw,w); gsh=min(gsh,h);
  gsdx=(project_w-w+gsox)/2;gsdy=(project_h-h-gsoy)/2;
  colorspace!='YUY2'?colorspace='YV12';
  gfx_blit(in2,1);
  gfx_keyedblit(in1, gsdx,gsdy,gsw,gsh, gsx,gsy,cos(hue*$pi/180)*mag,sin(hue*$pi/180)*mag,thresh,gain);
);
papagirafe is offline   Reply With Quote
Old 08-07-2022, 06:45 PM   #5
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

Quote:
Originally Posted by papagirafe View Post


A classic solution for this would be to repaste (using overlay image) the cropped left/right sides of the background on top of the green filtered video. But I made a quick hack of the green filter preset to reduce green filter to an area of the source. That should solve your problem. Just replace the stock preset with the new one and play with the green srcx,y,w,h,ox,oy to keep and position only what you need from your green video.

Code:
// Chroma-key (YUV version) - area
//quick hack  by papagirafe
//@param1:hue 'hue: g=-136,b=0' -136 -180 180 0 1
//@param2:mag saturation .7 0 1.0 0.5 .01
//@param3:thresh threshold .41 0 1 .5 .01
//@param4:gain gain 1.8 0 8 4 .1
//@param6:swap 'input swap' 0 0 1 0.5 1
//@param gsx "green src x" 0 0 2000 1000 1
//@param gsy "green src y" 0 0 2000 1000 1
//@param gsw "green src w" 1000 0 2000 1000 1
//@param gsh "green src h" 1000 0 2000 1000 1
//@param gsox "green src off x" 0 -1000 1000 0 1
//@param gsoy "green src off y" 0 -1000 1000 0 1

in1=0;
in2=input_track(0);
swap ? (tmp=in1;in1=in2;in2=tmp;);
input_info(in1,w,h) && in2 != in1 ? (
  gsw=min(gsw,w); gsh=min(gsh,h);
  gsdx=(project_w-w+gsox)/2;gsdy=(project_h-h-gsoy)/2;
  colorspace!='YUY2'?colorspace='YV12';
  gfx_blit(in2,1);
  gfx_keyedblit(in1, gsdx,gsdy,gsw,gsh, gsx,gsy,cos(hue*$pi/180)*mag,sin(hue*$pi/180)*mag,thresh,gain);
);
Super! The problem is that I never added the presets.
Could you elaborate please. Probably I have to create a file with a particular extention and then place it to a particular Reaper's folder.
Please help... until the end
Thx.
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-07-2022, 07:27 PM   #6
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

I think this will be a good tutorial on how to insert new code

https://forum.cockos.com/showthread.php?t=213832

will try tomorrow.

Thanks for the help.
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-08-2022, 03:26 AM   #7
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

Quote:
Originally Posted by mla View Post
I think this will be a good tutorial on how to insert new code

https://forum.cockos.com/showthread.php?t=213832

will try tomorrow.

Thanks for the help.
Super! Yes that's a good tutorial. Basically you jus add a new "video processor" fx and instead of selecting a video effect, you just paste the new code in the empty window section at the right, hit ctrl-s and tada!
papagirafe is offline   Reply With Quote
Old 08-09-2022, 12:48 PM   #8
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Yes but then also save it as a preset so you can ever find it again.
ashcat_lt is offline   Reply With Quote
Old 08-13-2022, 02:11 PM   #9
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

Quote:
Originally Posted by papagirafe View Post
But I made a quick hack of the green filter preset to reduce green filter to an area of the source. That should solve your problem. Just replace the stock preset with the new one and play with the green srcx,y,w,h,ox,oy to keep and position only what you need from your green video.

Code:
SCRIPT....
Hi papa,
I successfully created and saved your script.
So it's now present always as a custom preset in virtual processor.

I easily cropped and removed unnecessary elements from the video, leaving only the saxophonist on green. I was very happy and thought that black sides after cropping will not appear when I will apply chroma effect.
But NO GO... I rendered cropped vid but when imported it to the track with applied Chroma effects, black sides from cropped track appear.
See screenshots. So... the next question: what to do with this cropped thingy... I have to hide black sides somehow . How?
It's clear that chroma key effect should be applied only on green screen content of the video for correct result.
THANKS.

Screenshots: https://1drv.ms/u/s!Ar0t68kb42Tx4kJV...gw8Pi?e=tWZZbQ
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-13-2022, 04:48 PM   #10
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

simple logic saying that black side bars after cropping should be "colored in green". How to apply that if this is a right thought.
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-13-2022, 07:13 PM   #11
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

A single static green image on a track underneath this track with your favorite cropped overlay preset would do it.
ashcat_lt is offline   Reply With Quote
Old 08-14-2022, 09:12 AM   #12
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

Quote:
Originally Posted by ashcat_lt View Post
A single static green image on a track underneath this track with your favorite cropped overlay preset would do it.
I added green image track. Please advise what preset to apply.
Is my green image track OK? With no effect applied to it, it just doing bad .

https://1drv.ms/u/s!Ar0t68kb42Tx4kdp...PlKlQ?e=WYaB5c

Thanks.
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-14-2022, 10:16 AM   #13
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

I’d probably use mine
https://forum.cockos.com/showthread.php?t=245490
I think it needs to be on another track above the two you’re trying to merge.
ashcat_lt is offline   Reply With Quote
Old 08-14-2022, 02:19 PM   #14
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

Quote:
Originally Posted by ashcat_lt View Post
I’d probably use mine
https://forum.cockos.com/showthread.php?t=245490
I think it needs to be on another track above the two you’re trying to merge.
Did it! Now I am completely trapped .

You say:
> I think it needs to be on another track above the two you’re trying to merge.

So, I added the track with green image and your script/preset applied above my 2 tracks.
The result is weird and I don't see a way for further manipulations.

May be I should use my initial vid - saxplayer on green screen with some stands on sides without cropping it and creating 2 black bars that practically just "hiding" the stands that are in zone of green screen. And then try your script?
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-14-2022, 02:52 PM   #15
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

I’m not actually doing this before describing, but…

I think (assuming you have it so that tracks toward the top of the screen show over the ones below) it should be something like

Track with cropped overlay preset
Track with sax (to be cropped and overlaid onto)
Track with just green.

Now you should be able to adjust the crop preset to crop out the parts you don’t want and leave the green image showing at the edges.

Above that, you need to figure out the chroma key thing.
ashcat_lt is offline   Reply With Quote
Old 08-14-2022, 02:58 PM   #16
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

sorry for bothering and thanks for your time...

here is what I have now (I will try to follow your latest instructions )
https://1drv.ms/u/s!Ar0t68kb42Tx4kq0...gVw2o?e=4nwxW0
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-14-2022, 03:12 PM   #17
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

Quote:
Originally Posted by ashcat_lt View Post
I’m not actually doing this before describing, but…

I think (assuming you have it so that tracks toward the top of the screen show over the ones below) it should be something like

Track with cropped overlay preset
Track with sax (to be cropped and overlaid onto)
Track with just green.

Now you should be able to adjust the crop preset to crop out the parts you don’t want and leave the green image showing at the edges.

Above that, you need to figure out the chroma key thing.
see please NEW TRACK ORDER pic... (the link in above post)
did I understand correctly your instruction?
CHROMA effect applied on YEST2 track so it's allows to place sax on stage background. But there are side black bars after cropping initial green screen vid with stands on sides.
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-14-2022, 03:46 PM   #18
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Am I missing it, or can you provide a screenshot of the original sax thing by itself and then the thing you want for the background so I can make you a template?
ashcat_lt is offline   Reply With Quote
Old 08-14-2022, 04:09 PM   #19
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

Quote:
Originally Posted by ashcat_lt View Post
Am I missing it, or can you provide a screenshot of the original sax thing by itself and then the thing you want for the background so I can make you a template?
Here we go... https://1drv.ms/u/s!Ar0t68kb42Tx4k_e...YQXau?e=9dJbl9

1. I have sax vid on green screen.

2. Cropped sax on green screen

3. applied chroma on cropped SAX ON GREEN SCREEN
and placed beneath background stage image.

4. the problem is: black bars in places that where removed after cropping initial ...
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-14-2022, 08:14 PM   #20
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Sorry it took a minute. See the attached project. Had to change the code of the (otherwise stock) Combine: Chroma Key (RGB) preset to look at the second track down rather than the very next.
Attached Files
File Type: rpp test proj.rpp (7.8 KB, 75 views)
ashcat_lt is offline   Reply With Quote
Old 08-15-2022, 08:55 AM   #21
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

Quote:
Originally Posted by ashcat_lt View Post
Sorry it took a minute. See the attached project. Had to change the code of the (otherwise stock) Combine: Chroma Key (RGB) preset to look at the second track down rather than the very next.
Super! Works great.
So, now I know how to work with green screen recording.
I will compare your script in this example with your's downloaded previously and saved in my presets.

Also, the saxophonist image is big. And I don't see any zoom option in 2 applied presets.
Compared with my initial try where used sugestion from forum for chroma key. It was added with image overlay preset that allows to zoom.

I tried to add it but it's appear after yours two. And I don't see the option for changing active presets order (kind of move up option).

What do you suggest for add the option for zooming?

Thank you very much for help!
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-15-2022, 11:58 AM   #22
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

Oh! Yeah any new plugin you add will start add the bottom of the list, but you can just drag it to the top. It should work if zoom is first on the sax track.

In the thread for my preset, there’s another which includes zoom. Assuming you set the two input parameters the same, it should just go in place of the one in that template. Frankly, it wouldn’t take much to include the chroma key thing in that same preset to do it all at once, but I don’t love presets with a whole lot of parameters. It just gets unweildy.

Last edited by ashcat_lt; 08-15-2022 at 12:03 PM.
ashcat_lt is offline   Reply With Quote
Old 08-15-2022, 03:16 PM   #23
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

Quote:
Originally Posted by ashcat_lt View Post
Oh! Yeah any new plugin you add will start add the bottom of the list, but you can just drag it to the top. It should work if zoom is first on the sax track.

In the thread for my preset, there’s another which includes zoom. Assuming you set the two input parameters the same, it should just go in place of the one in that template. Frankly, it wouldn’t take much to include the chroma key thing in that same preset to do it all at once, but I don’t love presets with a whole lot of parameters. It just gets unweildy.
Ok succeded to properly do drag and drop between added presets.
Before was a bit messy. Thanks for encouragement that it MUST work .

Now... see please pics, they are:
2 results with my previous tries - green screen vid without crop, green screen vid cropped and the 3rd one is yours result that removes black bars on the side. So my final goal is reached. No side bars nos stands from uncropped vid. But if you compare mine and yours bottoom part it looks not so good. See the shoe... I thought that with adding zoom I will comfortably reduce the size of saxophonist and it will create general view as on my examples. When I start to reduce zoom all the "garbage" comes back into the picture.

Generally, as an end user with a general understanding of scripts influence I want to take a vid of the object on green screen place it on some background by means of simply functionning (but not simple for this end user ) preset/s and get a nice result.
I guess it should be a common primary basic task to everyone dealing with green screen vids. I feel that we are close. But something going wrong with zooming and "garbage" around green screen.
May be I am missing something and my problem is because initial green screen vid is not OK for a simple croma-key application. May green screen vid supposed to be perfect in terms of - NO any unnecessary objects in video. In my example just sax player on pure green screen.
From the other hand I feel that correct cropping should alow easily to eliminage all the "garbage" on the side leavin full zoom control for the user. Please let me know where I am wrong.

https://1drv.ms/u/s!Ar0t68kb42Tx4ltb...IPmkJ?e=SExNZe

Thanks.
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-15-2022, 06:31 PM   #24
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,271
Default

I mean honestly just fiddle with the knobs. There does seem to be an (oldish) issue with my cropped overlay preset which makes it so that when you add the zoom preset above it, you also need to raise the "background" parameter by one.
ashcat_lt is offline   Reply With Quote
Old 08-15-2022, 06:58 PM   #25
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

Quote:
Originally Posted by ashcat_lt View Post
I mean honestly just fiddle with the knobs. There does seem to be an (oldish) issue with my cropped overlay preset which makes it so that when you add the zoom preset above it, you also need to raise the "background" parameter by one.
Please excuse me for my previous "complaint" .
Everything is absolutely fine with your solution.
I simply tried to place IMAGE OVERLAY in between of existing two (yours and chroma) and I have full freedom to adjust whatever needed.

Thank you for your time and willingness to help.
I will just create a little doc for my future needs.
Sure learned something new...
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla is offline   Reply With Quote
Old 08-16-2022, 03:39 AM   #26
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 679
Default

Quote:
Originally Posted by mla View Post
Please excuse me for my previous "complaint" .
Everything is absolutely fine with your solution.
I simply tried to place IMAGE OVERLAY in between of existing two (yours and chroma) and I have full freedom to adjust whatever needed.

Thank you for your time and willingness to help.
I will just create a little doc for my future needs.
Sure learned something new...
Glad you found your solution! Thanks to ashcat for catching the ball when I was out! There are a lot of variations to solve that type of problem including one that I am developing for complex projects but this one is the best and simplest for your needs.
papagirafe is offline   Reply With Quote
Old 08-16-2022, 05:09 AM   #27
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 321
Default

Thank you very much guys!
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis
mla 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 05:35 AM.


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