4 Questions about Creating Custom Render Templates...

YOUNHEE-LEE wrote on 12/1/2024, 9:03 PM

"I'm using MAGIX Vegas Pro 21.0. (Thanks to JETDV for pointing out the correct terminology for Vegas. I wasn't aware of that at all!)

"I've written a code with AI to create and register multiple custom render templates, but I'm not sure if it's correct.

using ScriptPortal.Vegas;
using ScriptPortal.Vegas.Render; ----------------------------------------------------------(1)

public class CustomRenderTemplate
{
    public static void CreateCustomTemplate()
    {       
        Vegas vegas = new Vegas();

        RenderTemplate template1 = new RenderTemplate();

RenderTemplate template2 = new RenderTemplate();

        template1.VideoFrameRate = 12;
        template1.Width = 400;
        template1.Height = 300;

template2.VideoFrameRate = 10;
        template2.Width = 700;
        template2.Height = 400;

        // Setting the fileformat (MP4)
        template1.FileFormat = "MP4"; --------------------------------------------------------(2)
        template1.FileExtension = ".mp4";

// Setting the fileformat (mkv)
        template2.FileFormat = "mkv"; --------------------------------------------------------(2)
        template2.FileExtension = ".mkv";

        Renderer renderer = vegas.Renderers.FindByFormat(template1.FileFormat); ---------(3)
        if (renderer != null)
        {
            renderer.Templates.Add(template1);

            renderer.Templates.Add(template2);
        }
        else
        {
            MessageBox.Show("Can't find the renderer...");
        }
    }
}

I have some errors in my code:

(1) For "using ScriptPortal.Vegas.Render;"

I get the error message: 'Render' type or namespace name does not exist in the 'ScriptPortal.Vegas' namespace. Please check for assembly references.

Is this an AI hallucination? How can I solve this part?

(2) template.FileFormat = "MP4"

After reviewing the API, I found that the RenderTemplate class doesn't have a FileFormat field listed in the API. This is likely an AI hallucination, right?

(3) Renderer renderer = vegas.Renderers.FindByFormat(template.FileFormat);

Also, FindByFormat(template.FileFormat) isn't listed in the API either. Is this also a hallucination? Is there a quicker way to find the renderer by format name?

(4) My overall plan is to fix issues (1), (2), and (3), then insert the revised code into my existing program. And then I will call CreateCustomTemplate() function at a certain point in the existing code to register my custom template, and quickly find the renderer by format name to render. Does this sound okay?"

 

Comments

jetdv wrote on 12/1/2024, 9:42 PM

1. You use Using ScriptPortal.Vegas;

2. That is correct. FileFormat is not an option. But File.Extensions is. You might try something like:

                                foreach(string extension in renderTemplate.FileExtensions)
                                {
                                    if (extension == "MP4")
                                    {

                                    }
                                }

3. That is also correct. There is no "FindByFormat". Please take a look at my rendering tutorials. Here's the first one of the six part series:

And here's the codes to look for for the various render types:

*.ac3 - AC-3 - c13e02c0-0d31-4acd-a756-7553bea2842d
*.aif - Audio Interchange File Format (AIFF) - 0b3ff10e-e3af-11d2-8768-00c04f8ef35f
*.aa3 - ATRAC Audio - 9fa8f226-04e6-49a2-894c-37790423863d
*.avi - Video for Windows - ea9d287b-c85a-11d3-bb3a-0050da1a5b06
*.MP4 - XDCAM EX - 5826cab5-62b3-42be-b202-181e04c397a8
*.mp4 - AAC Audio - 571c4b0f-5a41-4827-b920-8eadbeef1b6c
*.flac - FLAC Audio - 4a05aca8-b87e-4954-ab2b-9f5e12689c3f
*.mp4 - MainConcept AVC/AAC - b7966bb4-7af7-49ce-a57e-5a1b01b04039
*.mpg - MainConcept MPEG-1 - 6529c198-a432-409f-8a91-3f62198b0e1a
*.mpg - MainConcept MPEG-2 - 144aa77f-d7eb-4f0b-acd5-61f03bdefc36
*.mp3 - MP3 Audio - adfa6a4b-a99b-42e3-ae1f-081123ada04b
*.mp4 - Sony AVC/MVC - 13af76d5-5ad4-45cb-a47d-22d418c5b161
*.mxf - Sony MXF - f8b60f55-b934-43dd-aeda-4ed67f17f6db
*.mxf - Sony XAVC / XAVC S - ee22aba6-3124-4352-b179-8b31851d5b3b
*.JXL - Image Sequence - 273e54e0-9f0e-4508-9676-7ba9f5fdcf9c
*.wav - Scott Studios Wave - d284c499-fe95-11d3-bb48-0050da1a5b06
*.pca - Sony Perfect Clarity Audio - 5da33477-dd7a-11d2-8761-00c04f8ef35f
*.wav - Wave (Microsoft) - 80a33477-dd7a-11d2-8761-00c04f8ef35f      48,000Hz, 16 Bit, Stereo, PCM - df36241f-e8ea-4b03-9f3b-57008f18a944
*.w64 - Sony Wave64 - 3cbba9c1-75ad-11d3-a483-00105a24aa37
*.wmv - Windows Media Video V11 - a84b3f59-ae2f-4917-995d-2e3b97035b46
*.wma - Windows Media Audio V11 - 0abf74f4-da52-4726-806d-a9ed9838ddf8
*.ogg - OggVorbis - 8f663101-6499-11d4-aaf6-00c04f8edc07
*.mxf - Sony MXF HDCAM SR - b4b9862d-e3c2-4f1a-a9d6-a8c235f4c906
*.mp4 - MAGIX HEVC - cbbc6376-4115-4f78-a37b-c2e07f9dee3b
*.mov - Apple ProRes - 949b8283-0607-4843-8882-f7de6e26d085
*.mp4 - MAGIX AV1 - f387b606-fa19-45d1-8561-2a793895df01
*.mp4 - MAGIX AVC/AAC MP4 - 4c184f1e-4d99-4353-9de0-e49da388cb63
*.mp4 - MAGIX HEVC/AAC MP4 - 95a8fdac-31fc-4cf6-bd7d-6fae2b99de83

4. There is nothing called "CreateCustomTemplate()" so I don't know what you're expecting to call unless that's a routine YOU are writing.

Interestingly enough, there is a:

myRenderer.CreateRenderTemplate(templateData)

templateData is a byte array but I see nowhere where "templateData" is defined.

 

Why will you not follow our advice and create a template with the settings you need? Then you can easily find that template by the name of the template.

 

YOUNHEE-LEE wrote on 12/3/2024, 5:50 PM

1) first,

There is nothing called "CreateCustomTemplate()"

--> Because I wrote it. It's my custom template class to meet my needs.

2) second,
Why will you not follow our advice and create a template with the settings you need?

--> I follow your advice and create my custom template in this class. "CustomRenderTemplate"

 

I followed your advice and wrote the code this way, but it seems like there might be some misunderstanding between us. So, how about giving an example of how to create a template with the settings I need? In the meantime, I will review the rendering-related tutorial you provided in the answer above.

zzzzzz9125 wrote on 12/3/2024, 6:21 PM

1) first,

There is nothing called "CreateCustomTemplate()"

--> Because I wrote it. It's my custom template class to meet my needs.

2) second,
Why will you not follow our advice and create a template with the settings you need?

--> I follow your advice and create my custom template in this class. "CustomRenderTemplate"

@YOUNHEE-LEE I've already mentioned in my previous post that you CAN'T modify render templates via script. You need to create your own templates through VEGAS itself, and then find it via script. "Customize Template" button is displayed in "Render as..." window and you should be able to find it easily.

Last changed by zzzzzz9125 on 12/3/2024, 6:23 PM, changed a total of 2 times.

Using VEGAS Pro 22 build 194 & VEGAS Pro 21 build 208.

Information about my PC:
Brand Name: HP VICTUS Laptop
System: Windows 11.0 (64-bit) 10.00.22631
CPU: 12th Gen Intel(R) Core(TM) i7-12700H
GPU: NVIDIA GeForce RTX 3050 Laptop GPU
GPU Driver: NVIDIA Studio Driver 560.70

jetdv wrote on 12/4/2024, 8:22 AM

@YOUNHEE-LEE

2) second,
Why will you not follow our advice and create a template with the settings you need?

--> I follow your advice and create my custom template in this class. "CustomRenderTemplate"

No! You're not listening to us.

You open VEGAS, add an clip to the timeline, go to 1) File - Render As, 2) Select the base template format, 3) choose "Customize", 4) customize the template as needed, and then 5) SAVE that as a NEW TEMPLATE.

Then, in your script, 6) you select that NEW TEMPLATE to use for rendering.

You DO NOT create the template from within the script. You create it before hand.

 

YOUNHEE-LEE wrote on 12/4/2024, 8:00 PM

"Ok, now I got it. I didn't know it was that simple... I just thought it had to be controlled within the script. Thank you everybody!!!