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

Reply
 
Thread Tools Display Modes
Old 01-21-2023, 02:41 PM   #1
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 281
Default how to create a video clip using chroma-key

In my previous post I asked for help with using chroma-key and provided two examples: one with default Reaper effects and a custom effect.

And the other with the same track order and effects that not works.

As there are no answers I thought that my description of the situation is not clear.

So, let me ask differently...

How to create a video using chroma-key in Reaper allowing to use any background?

As a start I did a video using a green screen background.

I would like to have step by step instructions allowing to easy manipulate with a cropping of the source video for smooth integration with a desired video or image background.

May be this topic is clearly described in Reaper manual?
I am ready to study the topic and experiment in order to aquire some basic and reliable skills.

What others do for using green screen?

Thx.
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis

Last edited by mla; 01-22-2023 at 08:13 PM.
mla is offline   Reply With Quote
Old 01-22-2023, 08:23 PM   #2
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 281
Default

here are two files the source image (object on green screen) and desired background image.

https://drive.google.com/drive/folde...iM?usp=sharing

I can apply chroma key, but green screen surrounding appears.

May be somebody can try to make it work and provide how to...
__________________
"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 01-23-2023, 01:27 PM   #3
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 388
Default

Quote:
Originally Posted by mla View Post
here are two files the source image (object on green screen) and desired background image.

https://drive.google.com/drive/folde...iM?usp=sharing

I can apply chroma key, but green screen surrounding appears.

May be somebody can try to make it work and provide how to...
Stock chromakey is hard to use and confusing. Just replace it with this version that allows you to mask out the unwanted parts as the first fx in your chain then add "overlay image" at the end of the chain and that should solve problem. Same project structure but you can eliminate the pure green track completely.

Code:
//Chroma-key(RGB) + mask out
//by papagirafe
//to be used as source for "overlay image" preset
//@param cl "mask left" 0 0 1 0.5 0.001
//@param cr "mask right" 0 0 1 0.5 0.001
//@param ct "mask top" 0 0 1 0.5 0.001
//@param cb "mask bottom" 0 0 1 0.5 0.001
//@param mode '0=green,1=blue' 0 0 1 0.5 1
//@param p primary 5.7 0 6 3 .01
//@param rej rejection 3 0 6 3 .01
//@param k3 threshold 0 -2 2 0 .01
//@param spill 'spill reduction' 0 0 1 0.5 1

in1=0;
in2=input_track(0);
colorspace='RGBA';
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); 
  gfx_set(0,mode?0:1,mode?1:0,1,0,-1,0);  //pure green/blue
  gfx_fillrect(0,0,w,h);    //fill all
  mode>.5?(k1=-rej;k2=p; ):(k1=p; k2=-rej;);
  gfx_keyedblit(0,cx,cy,cw,ch,cx,cy,k1,k2,k3,spill); //keyblit the cropped source over
);

Last edited by papagirafe; 01-24-2023 at 09:33 AM. Reason: minor cleanup and add commentts
papagirafe is online now   Reply With Quote
Old 01-23-2023, 05:00 PM   #4
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 281
Default

Quote:
Originally Posted by papagirafe View Post
Stock chromakey is hard to use and confusing. Just replace it with this version that allows you to mask out the unwanted parts as the first fx in your chain then add "overlay image" at the end of the chain and that should solve problem. Same project structure but you can eliminate the pure green track completely.

Code:
//Chroma-key(RGB) + mask out
//by papagirafe
//@param cl "mask left" 0 0 1 0.5 0.001
//@param cr "mask right" 0 0 1 0.5 0.001
//@param ct "mask top" 0 0 1 0.5 0.001
//@param cb "mask bottom" 0 0 1 0.5 0.001
//@param mode '0=green,1=blue' 0 0 1 0.5 1
//@param p primary 5.7 0 6 3 .01
//@param rej rejection 3 0 6 3 .01
//@param k3 threshold 0 -2 2 0 .01
//@param spill 'spill reduction' 0 0 1 0.5 1

in1=0;
in2=input_track(0);
colorspace='RGBA';
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); 
  gfx_set(0,1,0,1,0,-1,0);
  gfx_fillrect(0,0,w,h);
  mode>.5?(k1=-rej;k2=p; ):(k1=p; k2=-rej;);
  gfx_keyedblit(0,cx,cy,cw,ch,cx,cy,k1,k2,k3,spill);
);
Hi, thank you very much! Glad you are here , as last time you helped 100%.
I saved all the tips and screenshots from last troubleshooting.
Was sure it will work. But no way ...
What changed? My new green screen setup (different size and distance to it). So this is the main factor of the problem I guess.

Now... I did save your new code as preset, applied 3 presets in the order as previously, EXCLUDED green only track (that you mention).
Nothing works (see pics). I tried to play with all 3 presets and cannot even bring the saxman into the picture.

after trying different cropper software I found one that allows to do easy cropping.
Cropped video of saxman is on Green screen but the sides from surrounding are replaced by black. I think this cropping is not really helpful, so other techniques are required
Anyway, I cannot do anything with current presets.

I replace video track of saxman with a pic only.
I also attached project with new preset and background image.
Could you please apply your force/knowledge for trying to fix the situation.
What is your conclusion, would this initial green screen setup allow to do something useful?
Thanks again...

https://drive.google.com/drive/folde...usp=share_link
__________________
"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 01-23-2023, 07:59 PM   #5
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 388
Default

Quote:
Originally Posted by mla View Post
<snip>
I replace video track of saxman with a pic only.
I also attached project with new preset and background image.
Could you please apply your force/knowledge for trying to fix the situation.
What is your conclusion, would this initial green screen setup allow to do something useful?
Thanks again...

https://drive.google.com/drive/folde...usp=share_link
Try this version of the project (btw I set the project's to 1920x1080):
https://stash.reaper.fm/46119/fixed%20green.rpp

That should also correct the sizing problems. :-)
papagirafe is online now   Reply With Quote
Old 01-23-2023, 08:26 PM   #6
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 281
Default

I think you forgot to attach the file...

should be changed saxman pic. when open your rpp it shows
Attached Images
File Type: jpg error.JPG (63.7 KB, 8 views)
__________________
"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 01-23-2023, 08:41 PM   #7
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 281
Default

My appologies...
When complained in previous message I provided the path to my file
and top and the bottom of saxman were cut out...
So I panicked (thought that you adjusted the pic prior to provide new rpp).
Than tried your Croma-key handles: mask left righ top and bottom
Works like a charm...

I will try to recreate a project from scratch following your example.

Tell me please... should I crop my green screen video and leave saxman on green with black surrounding that basically replaced room view.
Or using suggested effects it doesn't matter and it should simply work?

Thank you very much. Sure you deserve a good beer .
Promised! Let me just practice and confirm that I can manage this green screen setup without any issue.
__________________
"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 01-24-2023, 08:49 AM   #8
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 388
Default

Quote:
Originally Posted by mla View Post
My appologies...
When complained in previous message I provided the path to my file
and top and the bottom of saxman were cut out...
So I panicked (thought that you adjusted the pic prior to provide new rpp).
Than tried your Croma-key handles: mask left righ top and bottom
Works like a charm...

I will try to recreate a project from scratch following your example.

Tell me please... should I crop my green screen video and leave saxman on green with black surrounding that basically replaced room view.
Or using suggested effects it doesn't matter and it should simply work?

Thank you very much. Sure you deserve a good beer .
Promised! Let me just practice and confirm that I can manage this green screen setup without any issue.
Glad to be of help! I updated the code to remove some inconsistencies. The preset masks out the unwanted sections with pure green/blue and then chroma blits the relevent section of your source. No need for background image at all.
As for the beer... next time I'm in Toronto for sure! :-)

Last edited by papagirafe; 01-24-2023 at 09:30 AM. Reason: partially incorrect info
papagirafe is online now   Reply With Quote
Old 01-24-2023, 01:06 PM   #9
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 281
Default

Quote:
Originally Posted by papagirafe View Post
Glad to be of help! I updated the code to remove some inconsistencies. The preset masks out the unwanted sections with pure green/blue and then chroma blits the relevent section of your source. No need for background image at all.
As for the beer... next time I'm in Toronto for sure! :-)
I tested few vids and backgrounds quickly.
You did absolutely great job.
I have some colors instability with lighter background that I could not make flawless. Will try improve green screen approach.
I have very basic knowledge in that. I had just 20cm distance between saxman and green screen. This I can improve.
Will experiment a bit.
But the code you wrote and whole approach seems to be absolutely smart and pro.
I am in Montreal not in Toronto . So check please your PayPal from Michael A. You have your beer or good Espresso with a piece of cake (your choice).
Thank you very much for friendly 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 01-24-2023, 01:39 PM   #10
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 388
Default

Quote:
Originally Posted by mla View Post
I tested few vids and backgrounds quickly.
You did absolutely great job.
I have some colors instability with lighter background that I could not make flawless. Will try improve green screen approach.
I have very basic knowledge in that. I had just 20cm distance between saxman and green screen. This I can improve.
Will experiment a bit.
But the code you wrote and whole approach seems to be absolutely smart and pro.
I am in Montreal not in Toronto . So check please your PayPal from Michael A. You have your beer or good Espresso with a piece of cake (your choice).
Thank you very much for friendly help!
Thanx for the espresso! Montreal? I go there more often than Toronto!
papagirafe is online now   Reply With Quote
Old 01-24-2023, 02:48 PM   #11
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 281
Default

Quote:
Originally Posted by papagirafe View Post
Thanx for the espresso! Montreal? I go there more often than Toronto!
I will send you PM
__________________
"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 01-27-2023, 12:48 PM   #12
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 281
Default

Quote:
Originally Posted by papagirafe View Post
Glad to be of help! I updated the code to remove some inconsistencies. The preset masks out the unwanted sections with pure green/blue and then chroma blits the relevent section of your source. No need for background image at all.
As for the beer... next time I'm in Toronto for sure! :-)
Hi,
I did few tests and played with wonderful presets that you combined.
Masks and zoom performs 100%.
So, my big problem gone. But now I have another one I cannot tweak in any way my shoes part . "Primary" dialer in chroma preset not allows me to find nice looking shoes.

I did couple of vids. First blamed the light. Now I have about no shadows on the screen. I think my first photo on green screen which you used for fixing was in no way better. But there was no problem with as now. The only difference is that the shoes were white-grey instead of black now. Could it be the culprit? I attach the proj with short vid. Check please the vid itself in the folder prior to run it in the project. Is my green screen setup is really bad and this cause the shoes problem?
May be you can suggest something that will reliably help to fix this kind of things?
Thx.


https://drive.google.com/drive/folde...hB?usp=sharing
__________________
"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 01-27-2023, 06:59 PM   #13
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 388
Default

Quote:
Originally Posted by mla View Post
Hi,
I did few tests and played with wonderful presets that you combined.
Masks and zoom performs 100%.
So, my big problem gone. But now I have another one I cannot tweak in any way my shoes part . "Primary" dialer in chroma preset not allows me to find nice looking shoes.

I did couple of vids. First blamed the light. Now I have about no shadows on the screen. I think my first photo on green screen which you used for fixing was in no way better. But there was no problem with as now. The only difference is that the shoes were white-grey instead of black now. Could it be the culprit? I attach the proj with short vid. Check please the vid itself in the folder prior to run it in the project. Is my green screen setup is really bad and this cause the shoes problem?
May be you can suggest something that will reliably help to fix this kind of things?
Thx.


https://drive.google.com/drive/folde...hB?usp=sharing
The RGB version of this filter seems to have limits but the YV12/YUY2 mode seems more adjustable. Unfortunately I would need to use new magic to make my code work...
papagirafe is online now   Reply With Quote
Old 01-27-2023, 07:22 PM   #14
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 281
Default

Quote:
Originally Posted by papagirafe View Post
The RGB version of this filter seems to have limits but the YV12/YUY2 mode seems more adjustable. Unfortunately I would need to use new magic to make my code work...
So I have a chance to get it?
Second Espresso promised
__________________
"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 Yesterday, 06:28 PM   #15
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 388
Default

Quote:
Originally Posted by mla View Post
So I have a chance to get it?
Second Espresso promised
I looked at the implication of this mode: the code structure needs to be changed substancially to include a beefed up version of "overlay image" inside. Very feasible but not a 15 minutes job :-)
papagirafe is online now   Reply With Quote
Old Yesterday, 07:02 PM   #16
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 281
Default

I see...
I just thought that if my initial green screen is not so bad from basic techical requirements perspective the appropriate program should easily do the trick. A friend of mine recomended DAVINCHI.
The installation file is 3.2GB... it's funny. Then a learning courve, that I am shure will not be so simple as in Reaper (of course with top notch presets if avalable).
I guess for my needs should be a simpler solution.
There are VideoPad and Videoproc apps with tube tutorials.

Ideally, I would like to use Reaper because I love it for audio and 6 month ago you helped with my first video thing. May be I had better green screen vid for start...
Anyway, if by chance you'll have time to try to organise presets that will flawlessly manage all this "green" stuff it would be nice...

I really would like to be able to make this in Reaper.
For now, will continue to watch this thread in hope of final solution.
Thank you for your time and explanation.

Best!
__________________
"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 Yesterday, 09:40 PM   #17
mla
Human being with feelings
 
Join Date: Jan 2013
Location: Canada
Posts: 281
Default

Hi,
I digged in a bit more with VIDEOPROC...
Absolutely simple and good quality for my green screen needs.
Few clicks and export...
I have to play with audio made in Reaper but may be will drop ready video to Reaper with audio proj.


There are other tweaking effects but even basic clicks give a very good result IMHO.
As for Reaper, I think that if you will succeed to adjust more controlable tweaking of Green it will be great.
Sure I would try new shiny presets if you'll do some...

Here is a screenshot from the vid. No probs with green at all.
https://drive.google.com/drive/folde...IP?usp=sharing

Thanks.
__________________
"When you hit a wrong note it's the next note that makes it good or bad". Miles Davis

Last edited by mla; Yesterday at 09:51 PM.
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 12:10 PM.


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