Will this be ok??

YOUNHEE-LEE wrote on 11/28/2024, 3:34 AM

Sony Vegas, Template-Based Encoding Program?? or not??

In my custom recording program, I can decide the fps at which I will record the video.

I scripted MyUniqueRender.cs like this:

csharp

// Finding FPS == 12, Resolution == 1280x400 Template...

if (template.VideoFrameRate == 12 && template.VideoWidth == 720 && template.VideoHeight == 400)

{

mp4Renderer = renderer;

mp4Template = template; break;

}

However, come to think of it, it's quite rare for Vegas to have such a template. So...

Could you give me a code tip to create this unique video?

Comments

zzzzzz9125 wrote on 11/28/2024, 5:40 AM

For render templates, since you can't modify them via script, you can only customize a render template you want in advance, and then find it via script.

Or, I suggest you use Voukoder. It automatically matches your project properties without any additional adjustments. You just need to make sure that the FPS, width, height, etc. of your project are the values you want, and then start rendering.

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 11/28/2024, 9:18 AM

And, unless you're on version 13 or older, it's NOT SONY! Magix bought the product a decade ago!

https://www.vegascreativesoftware.info/us/forum/sony-vegas-vs-vegas--119881/

Steve_Rhoden wrote on 11/28/2024, 9:29 AM

I second Voukoder...

zzzzzz9125 wrote on 11/29/2024, 8:34 AM

https://www.vegascreativesoftware.info/us/forum/i-need-to-finish-this-scripting-but--147898/

What I want is to find the renderer that I want... and use it...

And I thought that an FPS of 30 with a resolution of 1280x720 would be a very commonly used option, so I assumed it would be found in the code above (compared to an encoding format like FPS = 12 with 720x300). However, Vegas is displaying the following error message. "MP4 renderer or template with FPS=30 and resolution 1280x720 not found."

Why is this happening?

// Finding MP4 Renderer with FPS=30 and Resolution 1280x720 Template
foreach (Renderer renderer in myVegas.Renderers)
{
    if (renderer.FileTypeName.Contains("MP4") || renderer.FileTypeName.Contains("AVC"))
    {
        foreach (RenderTemplate template in renderer.Templates)
        {
            // Check if the template is valid
            if (!template.IsValid())
            {
                continue;
            }

            // Finding a template with FPS of 30 and resolution of 1280x720
            if (template.VideoFrameRate == 30 && template.VideoWidth == 1280 && template.VideoHeight == 720)
            {
                mp4Renderer = renderer;
                mp4Template = template;
                break;
            }
        }
    }
    if (mp4Renderer != null && mp4Template != null)
    {
        break;
    }
}

// "Add to SelectedTemplates after setting the renderer and template
if (mp4Renderer != null && mp4Template != null)
{
    SelectedTemplates.Add(new RenderItem(mp4Renderer, mp4Template, mp4Template.FileExtensions[0]));
    DoMySpRender(SelectedTemplates, outputFilePath, renderMode);
}
else
{
    // Handle cases where the desired renderer and template are not found
    MessageBox.Show("MP4 renderer or template with FPS=30 and resolution 1280x720 not found.");
}

https://www.vegascreativesoftware.info/us/forum/i-need-a-script-that-can-freely-adjust-the-fps-and-resolution--147900/

And I also... really want to write a script that renders with my own unique fps and resolution. How should I modify the script below to do this? Which API should I look at? Many people have recommended Voukoder, but currently, I need a script Honestly, I'm not very familiar with looking through APIs, so I'm currently getting help from chatGPT. Sometimes it seems to hallucinate.

// Finding MP4 Renderer with FPS=12 and Resolution 720x300 Template
foreach (Renderer renderer in myVegas.Renderers)
{
    if (renderer.FileTypeName.Contains("MP4") || renderer.FileTypeName.Contains("AVC"))
    {
        foreach (RenderTemplate template in renderer.Templates)
        {
            // Check if the template is valid
            if (!template.IsValid())
            {
                continue;
            }

            // Finding a template with FPS of 12 and resolution of 720x300
            if (template.VideoFrameRate == 12 && template.VideoWidth == 720&& template.VideoHeight == 300)
            {
                mp4Renderer = renderer;
                mp4Template = template;
                break;
            }
        }
    }
    if (mp4Renderer != null && mp4Template != null)
    {
        break;
    }
}

// "Add to SelectedTemplates after setting the renderer and template
if (mp4Renderer != null && mp4Template != null)
{
    SelectedTemplates.Add(new RenderItem(mp4Renderer, mp4Template, mp4Template.FileExtensions[0]));
    DoMySpRender(SelectedTemplates, outputFilePath, renderMode);
}
else
{
    // Handle cases where the desired renderer and template are not found
    MessageBox.Show("MP4 renderer or template with FPS=12 and resolution 720x300 not found.");
}

@YOUNHEE-LEE Forum is not only for you to ask questions, but also for others to read questions. In order to keep the post continuously readable, I answer you here.

 

As I mentioned in my first answer, if you don't use Voukoder, then you have to make sure that there are existing rendering templates that meet your needs, otherwise you have to customize one. You are trying to find a render template with 30 FPS. If you look at your existing rendering template, does it really exist? There're no render templates with 30/60 FPS among the built-in render templates, only 29.97/59.94. Even 29.97 and 59.94 are themselves approximations. For example, the exact value of 29.97 would be:

For this reason, when judging whether such data are equal, it's recommended to use approximate values, such as using Math.Round(template.VideoFrameRate, 2) instead of template.VideoFrameRate.

You can use the following code to get the built-in template with 29.97FPS, 1280x720:

            if (Math.Round(template.VideoFrameRate, 2) == 29.97 && template.VideoWidth == 1280 && template.VideoHeight == 720)

You said you want a template with accurate 30 FPS? Just customize one.

Last changed by zzzzzz9125 on 11/29/2024, 8:34 AM, changed a total of 1 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