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

Reply
 
Thread Tools Display Modes
Old 02-06-2018, 07:23 PM   #1
propianist
Human being with feelings
 
Join Date: Feb 2018
Posts: 9
Default Video Processor = RGB White Balance / Colour Grading

This is my first post here.
I was trying to find a way to get Reaper Video Processor FX to do some basic colour grading of R G B levels, mostly for subtle tweaks to white balance.

My Canon camera (with Magic Lantern) is capable of getting very good results if I carefully adjust colour temperature in Kelvin manually before I film something, but too often the case, it's not fine-tuned ideally because I was in a hurry to set up, or the lighting conditions were poor or changed during a long shoot, so it sometimes needs minor correction afterwards.

Anyway, I couldn't find any factory preset in Video Processor that did that job directly, so I adapted a little script and came up with this, which I thought I'd share...

Quote:
//RGB White Balance Colour Grading
src=0;
//@param2:red 'red' 0 -0.1 0.1
//@param4:green 'green' 0 -0.1 0.1
//@param6:blue 'blue' 0 -0.1 0.1
//@param8:intensity 'intensity' 1 0 10
input_info(src,w,h) ? ( project_w=w; project_h=h; ); // preserve input dimensions
w>0 ? gfx_blit(src);
gfx_mode=w>0 ? 1 : 0;
gfx_gradrect(0,0,project_w,project_h, red, green, blue, intensity);
This seems to work okay for subtle adjustments of R G B white balance. The "intensity" dial lets you turn down to zero (bypass) to compare your original image. Turning up past default 1 goes beyond normal everyday range into special effects range.

I wondered if this is useful to anybody like me struggling to do basic video edits in Reaper, but moreover, I wonder if anyone far more experienced than me can make a better job of this type of thing, using more flexible parameters in the script, etc.

I know proper "Colour Grading" software offers full control over highlights / midtones / shadows separately, and can be applied to specific areas of the image also, and can be changed dynamically over the timeline, which is all very complex and complicated to attempt in Reaper. I wonder if duplicating the video item on another track(s) and using opacity to see through several video layers with different processing for each layer could mimic highlights, midtones and shadow processing somehow?
Any other ideas how to make R G B colour grading possible or more flexible in Reaper?

Last edited by propianist; 02-06-2018 at 07:35 PM.
propianist is offline   Reply With Quote
Old 02-06-2018, 08:57 PM   #2
EpicSounds
Human being with feelings
 
EpicSounds's Avatar
 
Join Date: Jul 2009
Posts: 7,571
Default

not bad! really useful actually. I have something similar in my presets. great start.

btw a negative number for intensity can be cool useful here too.

Edit - should say it's not really white balance, but more like tint or using colored filters.
if RGB are the same and you add or subtract (below 0) alpha it's like a brightness control.
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog

Last edited by EpicSounds; 02-06-2018 at 09:06 PM.
EpicSounds is offline   Reply With Quote
Old 10-06-2018, 07:35 AM   #3
TheEscalator
Human being with feelings
 
Join Date: Dec 2017
Location: Karlsruhe, DE
Posts: 8
Default

thanks alot, this is exaclty what i was looking for!
TheEscalator is offline   Reply With Quote
Old 11-03-2018, 06:13 AM   #4
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Many thanks.
A great addition to the video processor presets.
Eliseat is offline   Reply With Quote
Old 04-29-2020, 02:50 PM   #5
propianist
Human being with feelings
 
Join Date: Feb 2018
Posts: 9
Default

I've noticed that Reaper gained a new factory effect called "Shadow / Midtone / Highlight RGB Adjust" which is exactly what I was asking for, and works great, so thank you whoever made that FX and put it in, that's really brilliant!
Guess somebody must have read this post here and responded. Thank you.


I was equally perplexed by not being able to change the aspect ratio of a video very easily in Reaper.
I wanted to create the classic cinemascope 2.35:1 type look, by adding letterbox bars onto my existing fullscreen 1920 x 1080 video. ie. Target size would be 1920 x 817 pixels of visible picture for this aspect ratio. (Although it would probably have been better quality results to try expanding the width bigger, rather than reducing height smaller, now I think about it...!)

My first attempt, for something to adjust aspect ratio by reducing vertical height (and/or horizontal) didn't really produce the right result, because it was SHRINKING rather than CROPPING down, but it was sort of useful creative video FX anyhow...
(Unit values are in pixels if 1920x1080p source.)

Quote:

// Aspect Ratio Shrink
//@param 1:horizontal 'shrink horizontal' 0 0 960
//@param 2:vertical 'shrink vertical' 0 0 540
//@param 3:keep 'keep aspect' 0 0 1
src=0;
input_info(src,w,h) ? ( project_w=w-horizontal; project_h=h-vertical; );
gfx_blit(src,keep);


Back to the drawing board, I managed to make a dedicated Letterbox cropper, by adapting Reaper's text overlay FX preset, which seems to work for this job...

Quote:

// Letterbox Bars
text="Letterbox bars";
font="Arial";

//@param1:border 'Letterbox bars' 0 0 10 1 0.1

input = 0;
!project_wh_valid && input_info(input,w,h) ? ( project_w=w; project_h=h; );
gfx_blit(input,1);
gfx_setfont(0.02*project_h,font);
gfx_str_measure(text,txtw,txth);
yt = (project_h- txth*(1+border*2))*1;
gfx_set(0,0,0,1);
gfx_fillrect(0, 0, project_w, txth*(1+border*2));
gfx_fillrect(0, yt, project_w, txth*(1+border*2));
gfx_set(1,1,1,0);
gfx_str_draw(text,1 * (project_w-txtw),yt+txth*border);

I have found with this Letterbox Bars FX, that a nice border value of "2.0" here, is perfect for me, giving a usable picture aspect of 1920 x 870 within the 1920 x 1080 overall frame.


This works fine if you just want to superimpose the letterbox bars and render your video as full 1920 x 1080 output with the letterbox bars as part of the movie.
No problem for small 5 minute clips, but with much longer movie lengths an hour or more, the files size in GB can get pretty large, and uploading to YouTube takes forever and a day, and so you realise that you're actually wasting about 20% of the picture area and data storage space with empty black space, which could preferably just be removed entirely.

So I wanted to create a 1920 x 870 movie file.
No empty black bars, just 100% picture. A custom size 64:29 aspect ratio video.
YouTube can upload and handle this ratio just fine (1920x870 is same aspect as 640x290 or 1280x580 or 2560x1160 or 3840x1740) and YouTube displays it with perfect black letterbox bars in its video window anyway.

If you set Reaper's render video output size to 1920x870, sadly it doesn't work.

With "Keep Source Aspect Ratio" on by default, it just shrinks everything to fit 870 height making a 1546x870 picture inside a 1920 wide file with black sidebars.

If you uncheck "Keep Source Aspect Ratio" then it re-sizes the entire image to fill the frame and your video looks stretched 24% wider than normal.
Yes, Reaper's doing what it's supposed to do correctly, but that wasn't specifically what I wanted, and there's no other options I can see to achieve this specific cropped area extraction with custom height and width, in Render settings, or Project video settings. I've tried all the permutations, and either way, you can't win.

I remember the old Rad Video Tools Bink video converter has custom height & width in pixels for scaling / zoom, plus custom height and width in pixels for cropping, along with custom X and Y pixel offset to position that crop rectangle area. This could do exactly what I'm talking about.
I wish Reaper had these extra custom options in the video render menu somewhere - surely it's pretty simple maths to program these extra video size options, I hope?

The only workaround way I found to do it in Reaper currently, was to zoom enlarge the video until its dimensions exceed the target output frame, then Reaper will chop off and discard any surplus areas and render just the area that lies within the actual video frame, which you can adjust by careful zooming to be exactly the desired area for your chosen image.
However to do this successfully, you need to vertically stretch the picture (Y axis zoom) however Reaper's video FX "opacity / zoom / pan" only offers a global zoom operation.

So I adapted that factory preset, to make an "Anamorphic" X-Y Zoom which allows free adjustment of height and width zoom independently, which can be useful for this task...
(Also if you ever film with an anamorphic lens on a camera maybe.)

Quote:

// Anamorphic X-Y zoom
//@param1:transparency 'transparency' 0.999
//@param2:xzoom 'X zoom' 0 -10 10 0
//@param3:yzoom 'Y zoom' 0 -10 10 0
//@param4:xoffs 'X offset' 0 -1 1 0
//@param5:yoffs 'Y offset' 0 -1 1 0
//@param6:rotate 'rotate' 0 -180 180 0 1

(bg_img=input_ismaster() ? -2 : input_track(0)) ? (
w = transparency < 0.01 ? 0 : transparency > 0.99 ? 1 : transparency;
gfx_a2=0;
gfx_blit((w < 1 || clear < 0.5) ? bg_img : -2,1);

w > 0 ? (
gfx_mode = filter>0.5 ? 256 : 0;
gfx_a=w;
xz = 10^(xzoom/10);
yz = 10^(yzoom/10);
dw = (project_w*xz)&-2;
dh = (project_h*yz)&-2;
x = (project_w - dw + xoffs*(project_w+dw))*.5;
y = (project_h - dh + yoffs*(project_h+dh))*.5;
rotate == 0 ? gfx_blit(0,paspect, x|0,y|0,dw,dh) : (
input_info(0,srcw,srch);
sc=2.0; sc2=sc*.5 - 0.5;
gfx_rotoblit(0,rotate*$pi/180,(x-dw*sc2)|0,(y-dh*sc2)|0,dw*sc,dh*sc, -srcw*sc2, -srch*sc2, srcw*sc, srch*sc);
);
);
);

NB. I renamed it "transparency" rather than "opacity" because otherwise the colon ":" next to the letter "o" together were automatically creating a silly emoji in the forum's text here.

So to achieve my desired 1920 x 870 aspect ratio, I set "Y-Zoom" to +0.94329 which is the closest match I could get, (and maybe "Y offset" -0.00082 or =0.00083 because there's about half a pixel error due to the rounding off pixel maths) but basically, it works, my 1920x1080 video is now vertically stretched and the desired 870 pixel worth of image fills the whole window. Just render output to 1920x870 with "keep source aspect ratio" off and hey presto, it has made the movie file without needing to include those black bars, but keeping correct 64:29 aspect ratio, and less wasteful GB size, otherwise it would have been 24% larger file.

However, bad news, the picture quality is noticeably degraded with slight jaggies and fuzzy edges visible because of all this crude workaround involving bilinear interpolation zooming and shrinking the picture, and the inexact maths of the +0.94329 Y-zoom value being only a close approximation but not dead on, so there's a sad penalty to picture quality - hence it's all a waste of time - I'd rather just render the full 1080p height and receive a larger file which does preserve maximum original quality.

Alternatively, you could import 3rd-party pre-cropped source material, that is already 1920 x 870 native size and just use Reaper to edit these videos, then it will render them at 100% quality perfectly well keeping their original size intact.

But surely there must be some clever way to do aspect ratios seriously in Reaper...??????

How does a person crop a custom pixel height x width / aspect ratio out of a standard 1920 x 1080p video in Reaper without sacrificing quality using the zoom FX to do it?

Kind regards.

Last edited by propianist; 04-29-2020 at 04:53 PM.
propianist is offline   Reply With Quote
Old 05-01-2020, 02:39 AM   #6
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Holy Banana,

that felt like reading the bible.

Its of course not easy to use Reapers video zooming and panning for serious video work. Some users and I already stated that. Its a bit like hovering, because it really could be fun to work with Reapers Video if not some important issues would ruin the idea. Like here!

The problem is, Video will always be the stepchild in Reaper as the main focus is audio. That's a bummer, because a lot of people see how much potential it already has.

Anyway. Its nice to read about your thoughts an ideas. And also to see your contributions.

Thanks
Eli
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat is offline   Reply With Quote
Old 05-01-2020, 06:45 AM   #7
propianist
Human being with feelings
 
Join Date: Feb 2018
Posts: 9
Default

Quote:
Originally Posted by Eliseat View Post
It's of course not easy to use Reaper's video zooming and panning for serious video work.
Hi, thanks for your reply.

You're quite correct, and indeed, I was never trying to use Reaper's zooming for anything in the first place - was just struggling to find correct "Project Settings" or "Render Settings" to output the 1920 x 870 movie crop I wanted to render, but nothing seemed to work.
Eventually, out of frustration, I divised a crude workaround solution doing a rough cowboy job with Y-Zoom FX which worked, but is a drastic compromise in quality, I know.

So my question is, how does one seriously render a 1920 x 870 movie crop please?
Can it be done by Reaper in any clever way?

Last edited by propianist; 05-01-2020 at 12:08 PM.
propianist is offline   Reply With Quote
Old 05-01-2020, 10:12 AM   #8
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

Could it be possible to use Reaper to target ffmpeg's video capabilities? I guess there could be ways with scripting. A year ago I did something similar in VLC. I have to say, it was a really poor attempt to cut videos without quality loss. (I'm not a programmer, I only had some standard scripting lessons when I studied web design.)
In this script I managed to send start and end times from VLC to mkvtoolnix, which then cut the videos lossless. I guess this also could work from inside Reaper to send a job to ffmpeg to crop a video to a certain size. (But this is only guessing.)

BUT ... if this could be done, a lot of other applications would count in. Lots of people asked for the possibility to split videos lossless from inside Reaper. THAT would be really cool!

Anyway. This needs to get explored. I'm not able to do programming so I hope someone at least answers the question if something like that is possible or not.

Greeting
ELi
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat is offline   Reply With Quote
Old 05-01-2020, 10:19 AM   #9
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

That was the thread for my little script. To get an idea what I meant.

https://forum.cockos.com/showthread....ghlight=script
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat is offline   Reply With Quote
Old 05-01-2020, 12:02 PM   #10
propianist
Human being with feelings
 
Join Date: Feb 2018
Posts: 9
Default

Hi Eliseat,

I looked at the thread you linked, with your example of mkvMerge / ffmpg splitting a long video at chosen time points to extract a shorter duration clip without re-encoding.

I already have this brilliant SmartCutter software, which I can recommend works perfectly for those sorts of pure lossless spilt / merge jobs. I use it on my camera's original 1080p mov files.

https://fame-ring.com/smart_cutter.html

Though obviously trying to crop the pixel dimensions (rather than the time duration) is a different kettle of fish, which SmartCutter cannot do, and I myself don't know what's possible with mkvMerge or ffmpg. Maybe those might work... . Rad Video Tools Bink, I do know can define custom pixel dimension crops in the way I want though, but it isn't easily compatible with my h.264 MP4 or mov files AFAIK. (I would need to use probably uncompressed AVI for Bink's video converter to process it, which is crazy big for a 2 hour 1080p movie.)

I just think there should just be something more straightforward which Reaper could have as a 3rd option in its video Render settings...

1. Keep source aspect ratio (constrain proportions, and re-size to fit output)

2. Don't keep source aspect ratio (stretch source image X-Y dimensions to fill area)

3. Crop or letterbox source image to chosen output dimensions (no-resizing, straight 1:1 actual pixels of source into output window's aspect ratio - it might get cropped if too large, or might leave empty black areas if too small, as required, but maintains 1:1 pixel render of the source into the chose output pixel dimensions)

Option 3 is what doesn't exist in Reaper.
Please can I request that feature, or please could somebody explain how to achieve that, if it's already possible somehow from Reaper's settings?

Last edited by propianist; 05-01-2020 at 12:21 PM.
propianist is offline   Reply With Quote
Old 05-01-2020, 12:46 PM   #11
propianist
Human being with feelings
 
Join Date: Feb 2018
Posts: 9
Default

eg.
For the benefit of anyone wishing to test out Reaper settings themselves to try solving this problem, here's a 1 second video clip of "TESTCARD source 1080p" illustrating the issue:

http://download1475.mediafire.com/ut...urce+1080p.mov

..and here's the ideal target 1920 x 870 movie file "TESTCARD desired output crop 870p" result which I have been trying unsuccessfully to render using Reaper alone...

http://download1652.mediafire.com/st...+crop+870p.mov

Can Reaper render this output from the video source above?
propianist is offline   Reply With Quote
Old 05-01-2020, 11:56 PM   #12
Eliseat
Human being with feelings
 
Eliseat's Avatar
 
Join Date: Mar 2018
Location: Cologne
Posts: 1,362
Default

You should create a new thread in the Request section of this forum and explain the problem and the possible solution. Maybe with example images etc. to make it easy for the devs to understand.

Greetings
Eli
__________________
☆.。.:*・°☆.。.:*・°☆.。.:*・°☆REAPER//✿◔‿◔)°☆.。.:*・°☆.。.:*・°☆
Eliseat 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:32 AM.


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