Script to Display Text from Region on Video Window?
Hey nerds!
There are some insanely wonderful scripts that I've found on here recently. Its a world I've just begun to dive into and I have to say: I'm impressed!
I was wondering if anyone had any insight on where to get started here, or if the scripting API have the necessary elements to do this task that I'm trying to conjure up.
Basically, this would be useful for me for ADR and Voiceover sessions. I would love to be able to have text from either regions (or empty items?) display on the video window for the actor to read instead of futzing with physical paper notes.
I've used Nuendo's ADR Taker for this in the past, as its hands down the best for this kind of work, at least until we can put our heads together and figure out how to make Reaper do it better! If we could figure out how to use video fx to replicate the crossing bars overlay, that would be icing on the cake.
(
So where to get started? Would this work better as a script, or as a JS effect? Thoughts? Ideas?
This is awesome work! It would be perfect if this could be read from Regions, so a tie-in with the Region/Marker Manager could come into play. Its super fast to be able to run an ADR session from the Region Manager, I can sort the cues and color code them etc. It also makes navigation easier. Also, if the text could be sent to the lower third of the Video Display window, that would be perfect as well.
Maybe something like this would be possible via a JSFX that would be placed on the video track that receives information from the Region manager very similarly to what Heda's Note Reader does?
I have yet to dive in on how to code anything, as I'm a 110% noob at that, but I'm willing to learn to be able to pull something like this off.
I would love Airon, RobinGShore, and any Post-Production guys' insight on what they think might be useful too. I think if everyone interested in this kind of thing put their heads together, we could make something REALLY great for Reaper.
By the way, Sexan, it is literally impossible to not smile looking at your avatar. Kitty Missile.
There is ton of reasons two prefer making this works from text items (empty items with text) rather than Regions, essential because you can't select regions, or work on multiple regions at the same time, and the fact that text items can handle break lines, and you can have several sets of text items (one set per track), not several sets of regions.
That's why Heda's script don't work with Regions.
But if you need these text items to appear as regions, then another heda's script
Note: Heda's Notes window is already so powerful that I don't see anyone that would rebuilt it from scrach for JSFX just to be displayed on the video. But volunteers are welcome if they think it will be useful :P
Are you saying here you can write to the video window?
>
I cheat right now and use the text overlay preset for the video processor on items and change the names there which works great for showing coders what sounds are what in the video examples I send them as I can move the PIP items around and copy them and they see the sound shown as well as hear it on the master video of the gameplay super cool.
I didn't know that script overlays on the video.. got to load that up again! EDIT: misread.. although it made me remember after trying those scripts again how amazing they are!
PLEASE. can someone work out how to take that video processor preset and integrate it reading regions or item names and display that on the video!
__________________ subproject FRs click here note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
Last edited by musicbynumbers; 10-02-2015 at 10:52 AM.
I don't think it is possible. Reascript functions (GetMediaItem for exemple) doesn't work in video processor. (just tested)
Maybe it works only with JSFX function.. but this is an other domain =/
You can access the VideoProcessor-Code in TrackStateChunks/ItemStateChunks and modify it that way.
You would need to replace a shown text (I guess the text-preset is a good starting point).
Important: Every codeline must start with a |
This is damn slow but possible...
I’m super new to coding, but learning just so I can try to make things that help improve my own workflow.
Do you think it’s possible from within the video processor JSFX to call “item notes” or “region name” to display text?
I’m trying to recreate something similar to Nuendo or DaVinci Resolve’s ADR recording systems. Ideally, it’d be handled in the region manager, or a similar spreadsheet-type window with character names and the dialog line, with the dialog line displaying on the video window.
I wrote you some Lua-functions, that do getting and setting text in a videoprocessor, without having to do it in the videoprocessor itself.
It works only for items, as trackFX would be, as mentioned earlier, too slow to update.
It modifies the first(!) Video Processor in the FX-Chain of an item and only, if it uses the "Title text overlay"-preset.
I can't write you a proper script due lack of time, but this should be a start for you or someone else, who couldhelp you coding such a script.
Code:
-- Get/Set Text in Video Processor-functions
-- Only works for TakeFX in MediaItems! As I use StateChunks to change texts, TrackFX would be too slow to do that.
-- Changes/gets the text of the first(!) video processor in the FX Chain of the MediaItem
-- Only supports Reaper's built-in "Title text overlay"-preset!
-- You can use safely newlines, these will be added properly.
-- Usecase: Use a MediaItem, that's streched along the whole project.
-- Give it a video-processor as TakeFX
-- Apply these functions to this MediaItem.
-- That way, you can change the text whenever you want.
-- Keep in mind: this MediaItem must be the "highest order", means, it must be above all other video/picture items
-- otherwise, other items may "overwrite" the text
-- Changing texts may cause hickups and stuttering because of the change.
function SetTextInVideoProcessor(item, text)
-- sets the videotext in a given item in it's first(!) Video Processor in the FXChain.
-- the Video Processor must be set to the built-in "Title text overlay"-preset!
-- multiline-texts are allowed
-- item - a MediaItem object as returned by reaper.GetMediaItem
-- text - the text, that you want to set. Write \n to include a newline.
-- The function returns retval, errormessage
-- retval - true, in case of success; false, in case of an error
-- errormessage - in case of an error, this message gives you a hint, what went wrong.
-- Meo Mespotine - mespotine.de
-- licensed under an MIT-license
if reaper.ValidatePtr2(0, item, "MediaItem*")==false then return false, "No valid MediaItem" end
if type(text)~="string" then return false, "Must be a string" end
local _bool, StateChunk=reaper.GetItemStateChunk(item, "", false)
if StateChunk:match("VIDEO_EFFECT")==nil then return false, "No Video Processor found in this item" end
local part1, code, part2=StateChunk:match("(.-)(<CODE.-\n>)(\nCODEPARM.*)")
if code:match("// Title text overlay")==nil then return false, "Only default preset \"Title text overlay\" supported. Please select accordingly."
else
local c1,test,c3=code:match("(.-text=\")(.-)(\".*)")
text=string.gsub(text, "\n", "\\n")
code=c1..text..c3
end
StateChunk=part1..code..part2
return reaper.SetItemStateChunk(item, StateChunk, false), "Done"
end
function GetTextInVideoProcessor(item)
-- gets the videotext in a given item in it's first(!) Video Processor in the FXChain.
-- the Video Processor must be set to the built-in "Title text overlay"-preset!
-- multiline-texts are allowed
-- item - a MediaItem object as returned by reaper.GetMediaItem
-- The function returns retval, errormessage, textinvideoitem
-- retval - true, in case of success; false, in case of an error
-- errormessage - in case of an error, this message gives you a hint, what went wrong.
-- textinvideoitem - the text, that is currently set in videoitem
-- Meo Mespotine - mespotine.de
-- licensed under an MIT-license
if reaper.ValidatePtr2(0, item, "MediaItem*")==false then return false, "No valid MediaItem" end
local _bool, StateChunk=reaper.GetItemStateChunk(item, "", false)
if StateChunk:match("VIDEO_EFFECT")==nil then return false, "No Video Processor found in this item" end
local part1, code, part2=StateChunk:match("(.-)(<CODE.-\n>)(\nCODEPARM.*)")
if code:match("// Title text overlay")==nil then return false, "Only default preset \"Title text overlay\" supported. Please select accordingly."
else
local c1,test,c3=code:match("(.-text=\")(.-)(\".*)")
test=string.gsub(test, "\\n", "\n")
return true, "Done", test
end
end
MediaItem=reaper.GetMediaItem(0,0)
SuccessfulOrNot, MsgInCaseOfError=SetTextInVideoProcessor(MediaItem, "Text line one\nText line Two\nanother(third) line, etc")
SuccessfulOrNot, VideoProcessorText=GetTextInVideoProcessor(MediaItem)
Getting projectnotes from within the VideoProcessor is, to my knowlegde, not possible yet.
@XRaym
I will look into it, as soon as I have some time to do that(still busy with coding another Reaper-focused project).
But if you want, you can add it to the ReaTeam Template repo, so it doesn't get lost due me forgetting it