01-02-2016, 05:24 AM | #1 |
Human being with feelings
Join Date: Jun 2009
Location: Praha, Czech republic
Posts: 595
|
Timecode Overlay video FX
Hi,
for first time I played little bit with v5 video processor, while thinking about some useful feature for me. I came with small modification of included title overlay preset for timecode (HH:MM:SS:Frame) insertion. Default knob values should be at reasonable start point, but you can tweak it, as you need. AFAIK besides basic things, there isn't much other variables available to video processor, so if you use for example project start offset, it has to be set manually using video FX parameters, but you can offset it, how you like. Also it doesn't support drop frame timecode. It can be maybe also useful for you, for example if you have maximized video window at another screen and it is on top of other windows or when you have another working units at your project (like bars,beats) and still like to watch timecode sometimes. Also sometimes, there is delivered video with burned timecode, but it is very small or unreadable, so you can place timecode with better readability over it. Just insert video processor with that preset either as a item fx, track or master fx. Code:
// Timecode overlay font="Arial"; //@param1:size 'text height' 0.1 0.01 0.5 0.25 0.01 //@param2:ypos 'y position' 0.90 0 1 0.5 0.01 //@param3:xpos 'x position' 0.5 0 1 0.5 0.01 //@param4:border 'border' 0.03 0 1 0.5 0.01 //@param5:fgc 'text bright' 1.0 0 1 0.5 0.01 //@param6:fga 'text alpha' 1.0 0 1 0.5 0.01 //@param7:bgc 'bg bright' 0 0 1 0.5 0.01 //@param8:bga 'bg alpha' 0.5 0 1 0.5 0.01 //@param9:h_off 'hours offset' 0 -23 23 0 1 //@param10:m_off 'minutes offset' 0 -59 59 0 1 //@param11:s_off 'seconds offset' 0 -59 59 0 1 //@param12:f_off 'frames offset' 0 -29 29 0 1 offset = 3600*h_off + 60*m_off + s_off + f_off/framerate; time_value = time / (ceil(framerate)/framerate) + offset; hours = time_value/3600; minutes = (time_value / 60) % 60; seconds = time_value % 60; frames = (time_value - floor(time_value))*framerate; #timecode = sprintf(#, "%02d:", hours); #timecode += sprintf(#, "%02d:", minutes); #timecode += sprintf(#, "%02d:", seconds); #timecode += sprintf(#, "%02d", frames); // #timecode += sprintf(#, " %.3f s", time); // abs. time // #timecode += sprintf(#, "%10d f", (time*framerate)); // abs. frames gfx_blit(0,1); gfx_setfont(size*project_h,font,'B'); gfx_str_measure(#timecode,txtw,txth); yt = (project_h- txth*(1+border*2))*ypos; gfx_set(bgc,bgc,bgc,bga); gfx_fillrect(xpos * (project_w-txtw*(1+border*2)), yt, txtw*(1+border*2), txth*(1+border*2)); gfx_set(fgc,fgc,fgc,fga); gfx_str_draw(#timecode,xpos * (project_w-txtw),yt+txth*border); Michal Update 1: Improved handling of non-whole number framerates (23.976, 59.54 etc.)
__________________
FRs: Better FX bypass Last edited by msmucr; 06-05-2016 at 02:30 AM. Reason: updated version for NTSC timecodes |
01-02-2016, 10:50 AM | #2 |
Human being with feelings
Join Date: Nov 2009
Posts: 2,232
|
cool, msmucr. haven't yet used reaper video except for picture sync for edit/mix of audio. can that tc window be slid up to the top? i usually put it there as very little that requires sync occurs at the top but when on the bottom things like footsteps can get covered by the window. very useful feature.
thanks, BabaG |
01-02-2016, 11:05 AM | #3 |
Human being with feelings
Join Date: Jun 2008
Posts: 4,923
|
thank you!!!
|
01-02-2016, 12:56 PM | #4 | |
Human being with feelings
Join Date: Jun 2009
Location: Praha, Czech republic
Posts: 595
|
Quote:
yes of course, position and size of inserted timecode can be freely modified. Just adjust knobs y and x position according to your taste. Default bottom center alignment was chosen just as a reasonable starting point for me. Michal
__________________
FRs: Better FX bypass |
|
01-02-2016, 02:36 PM | #5 |
Human being with feelings
Join Date: Jul 2009
Posts: 7,595
|
Another feature request I can check off the old list. Thanks for doing this!
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog
|
01-02-2016, 02:45 PM | #6 | |
Human being with feelings
Join Date: Jun 2009
Location: Praha, Czech republic
Posts: 595
|
Quote:
I'm sorry, but I don't understand, what do you mean by checking off the old list. Could you explain it for me, please? Michal EDIT: sorry I've got it.. First I thought, you would like to add something to the script..
__________________
FRs: Better FX bypass |
|
01-02-2016, 03:51 PM | #7 | |
Human being with feelings
Join Date: Jul 2009
Posts: 7,595
|
Quote:
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog
|
|
01-02-2016, 04:16 PM | #8 | |
Human being with feelings
Join Date: Jun 2009
Location: Praha, Czech republic
Posts: 595
|
Quote:
I will definitely check that. Michal
__________________
FRs: Better FX bypass |
|
05-31-2016, 08:23 PM | #9 |
Human being with feelings
Join Date: Aug 2014
Location: New York
Posts: 135
|
Thanks a lot for this, it's awesome. Already came in handy today
|
06-01-2016, 02:15 PM | #10 |
Human being with feelings
Join Date: Aug 2006
Location: Berlin
Posts: 11,818
|
Grud, how did I miss this.
Did you post this in the JS Reascript forum as well ? Thank you! ThankYouThankYouThankYou.
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10 Website "My ego comes pre-shrunk" - Randy Thom |
06-01-2016, 02:43 PM | #11 |
Human being with feelings
Join Date: Jun 2009
Location: Praha, Czech republic
Posts: 595
|
You're very welcome
Sorry, but to be honest, I wasn't at JSFX subforum for months, I usually go to Generic discussion via direct bookmark.. Hopefully I'll find some time for another video effects.. added API features like gfx_procrect() with 8-bit LUT offers its potential for next things. Michal
__________________
FRs: Better FX bypass |
06-03-2016, 02:05 AM | #12 |
Human being with feelings
Join Date: Aug 2006
Location: Berlin
Posts: 11,818
|
Found a possible bug .
At 23.976 fps playback, the display seems to upcount a bit too much further down the timeline. Try in at 20-25 minutes to see the effect, comparing the transport clock to the one onscreen. We really should ask Justin to give us a few simple functions to read out the current clock in an already formatted string. They had to work quite hard to get the clocks correct in Reaper during the past few years.
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10 Website "My ego comes pre-shrunk" - Randy Thom |
06-03-2016, 02:22 AM | #13 |
Human being with feelings
Join Date: Apr 2016
Posts: 103
|
This is great, man!
|
06-03-2016, 03:11 AM | #14 | |
Human being with feelings
Join Date: Jun 2009
Location: Praha, Czech republic
Posts: 595
|
Quote:
I'm from PAL/25fps country, so I've tested the script mostly with whole number framerates. But you're true with your observation.. I've tested it with recent Reaper and there seems to be bug in video processor. I'm using variable "time" (or "project_time" it doesn't matter as it behaves the same), which should return current item or project time in seconds.. that is input value for my TC calculation. However when non-integer framerates like 23.976 are used, this variable returns incorrect time. You can see currenttime in seconds, if you uncomment last line with string preparation // #timecode += sprintf(#, " %.3fs", time); I'm afraid, it's not possible to fix in the script. I'll try to report that. And of course, if there will be some another variable with formatted timecode string to avoid manual calculation, it would be fantastic, because it would also allow drop-frame timecodes, which is also currently not possible to do with script. Michal EDIT.. my bad, there is also another thing related to rounding.. I'll look at this, hopefully improve it and will post an update.
__________________
FRs: Better FX bypass Last edited by msmucr; 06-03-2016 at 03:19 AM. |
|
06-03-2016, 04:54 AM | #15 |
Human being with feelings
Join Date: Oct 2009
Location: France
Posts: 745
|
Very useful, thank you so much for this script.
By the way, thank you very much also EpicSounds for your presets. Last edited by Sumalc; 06-03-2016 at 05:02 AM. |
06-05-2016, 02:29 AM | #16 |
Human being with feelings
Join Date: Jun 2009
Location: Praha, Czech republic
Posts: 595
|
Sorry for being so slow with fix.. I was bit busy.
I've updated first post with new version with different calculation, which respects mentioned NTSC based timecodes, running in different speed than real time (~ 0.01% slower). Michal PS. Bug, I've mentioned in previous post, is related to "time" and "project_time" Video FX processor variables, which returns different values, while "time" being correct.. This wasn't the reason, why 23.976 didn't work, just confused me after quick look. In future, I'd like to look also to mentioned DF support, which requires TC calculation from absolute frame count.. Unfortunately there isn't any variable in video processor, which allows detection of project DF state, so there would be another control to enable DF calculation.
__________________
FRs: Better FX bypass |
06-05-2016, 08:02 AM | #17 |
Human being with feelings
Join Date: May 2006
Location: Saskatoon, Canada
Posts: 2,113
|
Very nicely done msmucr! I tried the script when you first posted it and noticed the magic framerate (23.976/29.97) issue. I tried unsuccessfully to fix it myself. I apologize for not reporting the problem immediately. I find myself using 23.976 all the time so this will be very handy.
Technically speaking the DF readout in Reaper should have a semicolon (00:00:00;00) preceding the frames count to indicate it is a drop frame rate. Perhaps they could add that and a call to detect the DF state of the timecode at the same time.
__________________
mymusic http://music.darylpierce.com mywork http://production.darylpierce.com mypodcast https://youtube.com/@ultimatesoundtest |
06-05-2016, 08:40 AM | #18 | |
Human being with feelings
Join Date: Jun 2009
Location: Praha, Czech republic
Posts: 595
|
Quote:
With regards to DF, there is only time and project_time variable, so there is no way how to detect DF is being used from the context of script. Essentially, DF means, 2 frames are dropped every minute, unless the minute number is divisable by ten. So DF TC calculation should be based on absolute frames rather than time in seconds like in case of current script. Semicolon frames separator would be then just icing on the cake. I've already briefly checked that and found nice algorithm for such calculation.. When I'll find some time, I will post another update. Michal
__________________
FRs: Better FX bypass |
|
06-05-2016, 08:43 AM | #19 |
Human being with feelings
Join Date: Nov 2009
Location: UK
Posts: 669
|
If it helps here are some drop frame calculations below for 29.97 in my code that I adapted from Andrew Duncan. http://andrewduncan.net/timecodes/
Remember that relevant frame durations are 1001/30000 and 1001/24000 and 1001/60000 for NTSC. Replace 1001 with 1000 for non NTSC. Don't try to use the number 29.97 or 23.98 in calculations. Use how they are derived. Also it turned out easier and more accurate for me to do many calculations in Vordio using rational numbers instead of floats. I learned this from FCPX where all times are done as rationals. It makes mixed frame and sample rate calculations really easy. Code:
<audio lane="-1" offset="33117926400/720000s" ref="r3" duration="8697600/720000s" start="33117926400/720000s" Code:
public long toFrames(long h, long m, long s, long f) { if (ntsc) { if (drop) { if (timebase == 30) { // Formula from http://andrewduncan.net/timecodes/ long totalMinutes = 60 * h + m; return 108000 * h + 1800 * m + 30 * s + f - 2 * (totalMinutes - totalMinutes / 10); public long[] toHMSF(long frames) { if (ntsc) { if (drop) { if (timebase == 30) { // Formula from http://andrewduncan.net/timecodes/ long D = frames / 17982; long M = frames % 17982; frames += 18*D + 2*((M - 2) / 1798); // (If -2 div 1798 doesn't return 0, you'll have to special-case M = 0 or 1.) long f = frames % 30; long s = (frames / 30) % 60; long m = ((frames / 30) / 60) % 60; long h = (((frames / 30) / 60) / 60) % 24; return new long[] { h, m, s, f }; Last edited by mrlimbic; 06-05-2016 at 09:05 AM. |
06-05-2016, 09:04 AM | #20 |
Human being with feelings
Join Date: Jun 2009
Location: Praha, Czech republic
Posts: 595
|
mrlimbic, thanks for sharing of snippet with your code.
Actually the algorithm, which I'd like to adapt to EEL, is the one by Andrew Duncan To me it looks like very elegant solution for DF calculations. Looking forward to try it! Best regards, Michal BTW. I've never tried Vordio, but it looks very cool addition to Reaper in post workflows.
__________________
FRs: Better FX bypass |
06-05-2016, 09:16 AM | #21 | |
Human being with feelings
Join Date: Nov 2009
Location: UK
Posts: 669
|
Quote:
Every audio feature in FCPX has an equivalent in REAPER which is why I based Vordio around REAPER. It was the only DAW with the necessary features. FCPX is not track based, there are no tracks, only parent/child objects with individual configurations & metadata attached. So doing something like only using channel 3 from 8 mics on a single clip is basically item channel modes in REAPER. You also need unfussy tracks that can take any material like REAPER has. There is no way in most DAWs to only assign channel 3&4 of an item on a stereo track. REAPER it is easy. For each role tagged in FCPX, you get a parent track in REAPER. So you can send a particular actor's mic to it's own section in the project, just by tagging a clip. The translation from FCPX->RPP involves no loss at all, unlike using AAF where you will lose a lot of metadata in the process and have to start splitting files to even make it work. There is also a pretty unique way of reconforming in Vordio. It is not timeline region based like traditional approaches, but individual item tracking based. So it works on a shot by shot granularity and is non destructive of edge work. Last edited by mrlimbic; 06-05-2016 at 09:39 AM. |
|
08-13-2016, 09:09 AM | #22 |
Human being with feelings
Join Date: Aug 2010
Location: They put me in a home.
Posts: 3,432
|
Thank you for making this. I cannot thank you enough. Overlay timecode in Reaper's video window was missing for me for so long. This preset works perfectly.
__________________
47.8% of statistics are made up. |
08-13-2016, 11:21 AM | #23 |
Human being with feelings
Join Date: Nov 2009
Location: UK
Posts: 669
|
Just wondering.. Have you started a ReaPack repository for your scripts/FX?
ReaPack makes it much easier for people to install & keep up to date with what scripts/FX are available. It was all very spread out before. Here's a demo of the first script I just added to my new "mrlimbic" repository. https://vimeo.com/album/3294077/video/178488665 |
10-22-2017, 04:50 AM | #24 |
Human being with feelings
Join Date: Jun 2009
Location: South, UK
Posts: 14,218
|
This "should" be amazing so thanks in advance but..
I can't get it working yet EDIT: got it working! I forgot I had to control+S the pasted code in the video processor before saving a preset doh! Works now and is great! Should really be a default preset in reaper though Justin/Schwa! This is essential for a lot of media work! Maybe I'm being dumb but I tried to paste your code in several different ways and still can't make it work. Tried pasting and saving as preset to video processor effect but get an error of bad code. Tried pasting as if it was a JS effect into an empty text doc with no extension and that didn't work either. What's the right way? thanks!
__________________
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-22-2017 at 04:56 AM. |
12-26-2017, 03:52 AM | #25 |
Human being with feelings
Join Date: Nov 2017
Location: Gloucestershire, UK
Posts: 223
|
Thanks...added to my list of very useful scipts
|
01-02-2018, 10:48 AM | #26 |
Human being with feelings
Join Date: Jun 2007
Location: France
Posts: 57
|
Hello!
I will be interested to have exactly the same thing with the Beats of measures. 4/4 1 2 3 4 1 2 3 4... Musically |
01-03-2018, 02:46 AM | #27 |
Human being with feelings
Join Date: Nov 2015
Posts: 642
|
|
01-03-2018, 03:02 AM | #28 |
Human being with feelings
Join Date: Jun 2007
Location: France
Posts: 57
|
I know this function and that's exactly what I would like to embed in a video ...
|
03-22-2018, 12:15 PM | #29 |
Human being with feelings
Join Date: Oct 2013
Location: Exeter, Perfidious Albion
Posts: 70
|
Thanks msmucr!
|
04-11-2018, 07:06 AM | #30 |
Human being with feelings
Join Date: Jan 2008
Location: Berlin
Posts: 290
|
Wow, amazing! Thank you!
Video guy forgot to burn in Time Code into Picture, now I have it here anyway! Reaper FTW! Thank you so much!
__________________
Thank you and have a nice day! :) |
07-02-2018, 07:14 AM | #31 |
Human being with feelings
Join Date: Mar 2013
Posts: 181
|
Thanks msmucr, but how to display the correct timecode when the project will not start from zero time?
|
01-11-2019, 10:22 AM | #32 |
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Got a similar issue, my project starts with 10:00:00:00 and the TC shows 00:00:00:00
__________________
My Reascripts forum thread | My Reascripts on GitHub If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom |
01-11-2019, 10:28 AM | #33 |
Human being with feelings
Join Date: Jul 2009
Posts: 7,595
|
there's an hours offset parameter, what else is needed?
__________________
REAPER Video Tutorials, Tips & Tricks and more at The REAPER Blog
|
01-11-2019, 10:31 AM | #34 |
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Oh snap, overlooked that one, thanks Jon!
__________________
My Reascripts forum thread | My Reascripts on GitHub If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom |
01-11-2019, 10:40 AM | #35 |
Human being with feelings
Join Date: Nov 2009
Location: UK
Posts: 669
|
I noticed in the new iPlug2 framework (just released) it also has a really easy way to make C++ reaper extensions.
It also contains some example code to access the reaper video window and draw over it (which was undocumented I think). That could read whole reaper API including project offset and any other settings. A timecode extension would only need one action - toggle timecode display on/off. Then using a video processor and configuring it would be unecessary. |
05-20-2019, 02:50 PM | #36 |
Human being with feelings
Join Date: Apr 2018
Posts: 358
|
Thank you!!
Such a great tool! One thing I've noticed is that when I'm rendering a quicktime, the timecode that I generate ends up being slightly off from the windowburn on the original video file; (10 seconds sometimes, sometimes 20-30)
I've adjusted the offset knobs, and it matches perfectly when I'm clicking around in the project and playing from there, so it only appears off in a rendered quicktime. Anything I can do about this? Thanks again!! |
05-22-2019, 06:43 AM | #37 |
Human being with feelings
Join Date: Mar 2013
Posts: 181
|
I have several video clips on the timeline. According to the time codes in the scenario, each clip must start from time zero. I click on the beginning of the clip and set zero in the project from the cursor. However, the time code overlay shows the time measured from the project beginning of the timeline. Adjusting the offset for each clip, when you need for example 15 clips on timeline, very slow down your work.
|
05-24-2019, 02:45 PM | #38 | |
Human being with feelings
Join Date: May 2019
Posts: 59
|
Quote:
1. Putting each video clip onto a new track and lining up the start points, so they all start at "00:00:00:00" with the overlay or 2. Putting an instance of the plugin onto each video item, and using the offset knobs to have them all start at "00:00:00:00". If you want to have all of your video clips on the same track, and have the overlay start at "00:00:00:00" for each of them, I think this is your best option; the timecode overlay preset for the video processor is very small so you should be able to run it on 15+ clips in a session on a single track without a problem. Hope this helps! |
|
05-25-2019, 01:39 PM | #39 |
Human being with feelings
Join Date: Jan 2007
Location: The Underground Bunker
Posts: 706
|
Thanks msmucr!
This is great (and should be in the installer)!
__________________
"if DAWs are religions, REAPER is atheism" - The big J __________________ Windows 10x64 | Asus Z170-a i7, 32GB ram | RME-Digiface USB |
05-27-2019, 07:42 AM | #40 |
Human being with feelings
Join Date: Mar 2013
Posts: 181
|
@maczook Thank you for your tips, I'll try.
|
Thread Tools | |
Display Modes | |
|
|