Best way to add Title and set text through scripting

VegaMega wrote on 12/1/2023, 12:00 PM

I'm getting more and more up to speed with this scripting. My next step is to put some text on top of the video (in different size, color, fonts). However, I am a bit puzzled around how to do this. ChatGPT even tells me it cannot be done....but that may be old information. So, does anyone has a good example function to put a text with specific font, size, color, etc on position x,y on a track?

Comments

iEmby wrote on 12/1/2023, 12:10 PM

i created a toolset with the help of chatgpt ..i am working on that toolset since 2-3 months and i created so many tools. more than 25 .. it also include Create Text At Makers. which will create new text events on markers and add them to new track. but i cant go upto editing text properties, that thing is so deep i think.

PROCESSOR
     

Operating System: Windows 11 Pro 64-bit (Always Updated)
System Manufacturer: ASUS
12th Gen Intel(R) Core(TM) i7-12700 (20 CPUs), ~2.1GHz - 4.90GHz
Memory: 32GB RAM
Page File: 11134MB used, 7934MB Available
DirectX Version: DirectX 12

-----------------------------------------------

MOTHERBOARD

 

ASUS PRIME H610-CS D4
Intel® H610 (LGA 1700)
Ready for 12th Gen Intel® Processors
Micro-ATX Motherboard with DDR4
Realtek 1 Gb Ethernet
PCH Heatsink
PCIe 4.0 | M.2 slot (32Gbps) 
HDMI® | D-Sub | USB 3.2 Gen 1 ports
SATA 6 Gbps | COM header
LPT header | TPM header
Luminous Anti-Moisture Coating
5X Protection III
(Multiple Hardware Safeguards
For all-round protection)

-----------------------------------------------
EXTERNAL GRAPHIC CARD

-----------------------------------------------

INTERNAL GRAPHIC CARD (iGPU)

------------------------------------------------

LED - MONITOR

Monitor Name: Generic PnP Monitor
Monitor Model: HP 22es
Monitor Id: HWP331B
Native Mode: 1920 x 1080(p) (60.000Hz)
Output Type: HDMI

-----------------------------------------------

STORAGE DRIVE

Drive: C:
Free Space: 182.3 GB
Total Space: 253.9 GB
File System: NTFS
Model: WD Blue SN570 1TB (NVMe)

---------------O----------------

My System Info (PDF File).

https://drive.google.com/open?id=1-eoLmuXzshTRH_8RunAYAuNocKpiLoiV&usp=drive_fs

 

Also Check

Some useful creations by me including VEGAS Scripts

https://getopensofts.blogspot.com/

 

My YouTube Channel Dedicated to Only VEGAS Pro Tutorials

EDITROOM : My YouTube Channel (For VEGAS Tutorials)

jetdv wrote on 12/1/2023, 1:03 PM

@VegaMega, have you looked through my tutorials? http://www.jetdv.com/

https://www.youtube.com/@JetDVScripts/videos

Add Generated Media (i.e. Titles and Text) to the timeline:

Change the font/size/color/position:

Fit "Background to Text":

Search Titles and Text events for specified text:

VegaMega wrote on 12/1/2023, 2:44 PM

Wow, no didn't find your website with the tutorials. Thanks!

VegaMega wrote on 12/1/2023, 4:39 PM

@jetdv Dude, you are an absolute hero! I never could have figured this out otherwise. I feel like being in control now on this scripting. Your videos really boosted that by a lot! Amazing!

One question though: How would you go about automatic text size?

For example: script input is a line of text that can have different lengths. This text should always be placed within an imaginary box on the left half of the screen with a 5% margin to the screen borders (and to the half of the screen). So short texts should be pretty big and long text should be pretty small.

Word wrapping to use multiple lines in then the next step for an optimal fill of the text area.

jetdv wrote on 12/1/2023, 4:44 PM

@VegaMega I don't know of a way to "ask" the plugin "how big is this text box". You can send Windows the text and the font/size information and ask it but it will be "different" than what that text box actually is. That's really a much more difficult proposition.

VegaMega wrote on 12/2/2023, 3:47 AM

@jetdv I have a version in Python that does it but it relies heavily on external python libraries so it is unusable. Basically it lowers font size untill it fits the box. Also word wrapping is done through a lib. So I am hunting for a c# version but probably the boxsize is the biggest problem with such an approach.

Still I think that scripting is all about automation. As such, automatic text sizing for texts with different lengths, seems essential to me.

Please keep me posted if you think about an approach for this.

I'll probably try an approach with a table: (textlength, fontsize) that I have manually predetermined.

jetdv wrote on 12/2/2023, 8:38 AM

@VegaMega, take a look at my newest tutorial:

This one shows how to get the "length" of a string in Windows (using c#) based on font and font size. But you'll need to figure out how that compares to "screensize" in Titles and Text (and they ARE different). It might get you to a comparison you can use, though.

Of course, this assumes that "scale" is set to 1, "tracking" is set to 0, etc...

RedRob-CandlelightProdctns wrote on 12/3/2023, 1:27 AM

Wouldn't that be a nice feature to have added to Titles & Text --- "auto-wrap" and "fit-to-box"? 😀

Vegas 21.300

My PC (for finishing):

Cyperpower PC Intel Core i7-7700K CPU @ 4.2GHz, 64GB mem @ 2133MHz RAM, AMD Radeon RX470 (4GB dedicated) with driver recommended by Vegas Updater (reports as 30.0.15021.11005 dated 4/28/22), and Intel HD Graphics 630 driver version 31.0.101.2112 dated 7/21/22 w/16GB shared memory. Windows 10 Pro 64bit version 10.0.19045 Build 19045.

My main editing laptop:

Dell G15 Special Edition 5521, Bios 1.12 9/13/22, Windows 11 22H2 (10.0.22621)

12th Gen Intel Core i7-12700H (14 cores, 20 logical processors), 32 GB DDR5 4800MHz RAM, Intel Iris Xe Graphics, NVIDIA GeForce RTX 3070 Ti Laptop GPU w/8GB GDDR6 RAM, Realtek Audio

 

 

jetdv wrote on 12/3/2023, 7:25 AM

@RedRob-CandlelightProdctns, Like NewBlue Titler Pro has??? Yes, those would be good options.

Phil_P wrote on 12/5/2023, 9:07 PM

Wouldn't that be a nice feature to have added to Titles & Text --- "auto-wrap" and "fit-to-box"? 😀

This would be an amazing time saver.