AI-generated morph transition script between two selected clips

mamomo wrote on 10/28/2025, 2:54 PM

Hi everyone,

I’m exploring the possibility of creating a VEGAS Pro script that uses AI to automatically generate a morph-style transition between two selected clips.

Concept workflow:
1️⃣ User selects two video events in the timeline
2️⃣ Script extracts:

Last frame of Event A → A_end.png

First frame of Event B → B_start.png
3️⃣ Script opens a small form where the user writes a prompt (e.g. “liquid metallic morph from A to B”) and duration settings
4️⃣ The script sends both images + prompt to an AI image-to-video API (Runway, Pika, Stability, or a local ComfyUI pipeline)
5️⃣ When the MP4 result is ready, the script automatically imports it into VEGAS and places it between both clips

Goal:
A fast way to create creative AI transitions directly inside VEGAS, without leaving the timeline.

I’d like to ask:
✅ Has anyone here experimented with something similar?
✅ Any sample code for frame export → HTTP request → auto-insert clip?
✅ Known limitations with Vegas scripting on this kind of workflow?
✅ Advice on the best method to capture the exact ending/starting frames?

If someone has already started a project like this, I’d love to collaborate.
If not, I may try to build a prototype (I’m comfortable with C# scripting).

Thanks in advance for any hints!
— Manel

Comments

jetdv wrote on 10/28/2025, 3:52 PM

Getting the images is the easy part. On the first one, just take an image at the time of the event.End - 1 frame and then on the second one, take an image at the time of the event.Start.

The harder part will be sending all of the information and then retrieving the result.

Once you have the result, moving the second event to fit the new video is easy - but you may need to move everything after that second event as well. Then inserting the resulting video would be an easy task as well.

editeiro wrote on 11/4/2025, 2:14 PM

The @kjetil make a script wich integrate an AI feature inside Vegas Pro, the Demucs here: https://www.vegascreativesoftware.info/us/forum/new-script-demucs-stem-splitter-for-vegas-pro-ai-audio-separation--149439/

I don't know if it's the same principle.

But in the case of videos, it's a bit more complex, because even those that run locally require a LOT of hard drive space.

The FramePack is an example; it's a 1.7GB download, which after being decompressed goes down to 5GB and after installation occupies more than 30GB.

So having this whole setup linked to Vegas via script could be interesting, although I don't know if it's feasible,
and the hardware requirements is to high: https://github.com/lllyasviel/FramePack

mamomo wrote on 11/5/2025, 1:36 AM

The @kjetil make a script wich integrate an AI feature inside Vegas Pro, the Demucs here: https://www.vegascreativesoftware.info/us/forum/new-script-demucs-stem-splitter-for-vegas-pro-ai-audio-separation--149439/

Thanks! That script is great, but it targets audio (Demucs).
What I’m looking for is a video workflow:

Take last frame of Clip A and first frame of Clip B as stills

Send both + a prompt to an AI image-to-video generator (local ComfyUI or cloud like Runway/Pika)

Get back an MP4 sequence (n frames) that morphs A→B

Auto-insert that clip between A and B in VEGAS

So it’s a frame-pair → generated transition video pipeline, not stem separation.
Heavy local models (e.g., FramePack) are optional; the script could be a thin client to an external API.

Has anyone tried exporting frames → HTTP call → polling → auto-insert via the VEGAS API? Any sample code or pitfalls would be super helpful.

mamomo wrote on 11/10/2025, 2:32 PM

Update:
I’ve just created a working script that automatically grabs the last frame of Clip A and the first frame of Clip B and saves them as JPGs inside C:\temp.

It uses the built-in SaveSnapshot function, so it works natively without any external dependencies.
Once both stills are generated, they can be passed to an AI image-to-video engine (like Runway, Pika, or Envato Labs, which already includes that option) to generate the in-between morph sequence.

I’ve also added a custom toolbar button inside VEGAS Pro 23 to trigger the script instantly — this makes it part of my daily workflow.

Next step will be to extend it so that the script can automatically send both frames to an AI generator via HTTP POST and re-insert the resulting video between both clips.

Here’s the current version of the script if anyone wants to test or build on it.
 

using System;
using System.IO;
using System.Windows.Forms;
using ScriptPortal.Vegas;public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        try
        {
            string outputFolder = @"C:\temp";
            if (!Directory.Exists(outputFolder))
                Directory.CreateDirectory(outputFolder);            // Recoger eventos de vídeo seleccionados
            System.Collections.Generic.List<VideoEvent> selected =
                new System.Collections.Generic.List<VideoEvent>();            foreach (Track track in vegas.Project.Tracks)
            {
                VideoTrack vTrack = track as VideoTrack;
                if (vTrack == null)
                    continue;                foreach (TrackEvent ev in vTrack.Events)
                {
                    if (ev.Selected && ev is VideoEvent)
                        selected.Add((VideoEvent)ev);
                }
            }            if (selected.Count != 2)
            {
                MessageBox.Show("Selecciona exactamente 2 clips de vídeo.");
                return;
            }            // Ordenar por posición en la timeline
            selected.Sort((a, b) => a.Start.CompareTo(b.Start));
            VideoEvent leftEvent = selected[0];
            VideoEvent rightEvent = selected[1];            // Calcular frame (usamos 1 frame antes del final del izquierdo)
            double fps = vegas.Project.Video.FrameRate;
            Timecode oneFrame = new Timecode(1.0 / fps);            Timecode leftFrameTime = leftEvent.End - oneFrame;
            if (leftFrameTime < leftEvent.Start)
                leftFrameTime = leftEvent.Start;            Timecode rightFrameTime = rightEvent.Start;            string leftFile = Path.Combine(outputFolder, "frame_left.jpg");
            string rightFile = Path.Combine(outputFolder, "frame_right.jpg");            // Snapshot último frame del clip izquierdo
            vegas.Transport.CursorPosition = leftFrameTime;
            vegas.SaveSnapshot(leftFile, ImageFileFormat.JPEG);            // Snapshot primer frame del clip derecho
            vegas.Transport.CursorPosition = rightFrameTime;
            vegas.SaveSnapshot(rightFile, ImageFileFormat.JPEG);
        }
        catch (Exception ex)
        {
            MessageBox.Show("Error en el script: " + ex.Message);
        }
    }
}

mamomo wrote on 11/10/2025, 3:33 PM


Test

jetdv wrote on 11/11/2025, 9:27 AM

A couple things seem a little complicated. For example, why do you need to sort them when they're added in sorted order to the list already? You're processing them left to right - unless they would be on different tracks and the "second" one was before the "first" one on the timeline they'll already be in order.

To get one frame, you don't need to do the convoluted calculations and you don't need to get the project FPS. Just do this:

Timecode oneFrame = Timecode.FromFrames(1);

You also don't have to move the cursor in order to save the snapshot. Instead of:

            vegas.Transport.CursorPosition = leftFrameTime;
            vegas.SaveSnapshot(leftFile, ImageFileFormat.JPEG);            // Snapshot primer frame del clip derecho
            vegas.Transport.CursorPosition = rightFrameTime;
            vegas.SaveSnapshot(rightFile, ImageFileFormat.JPEG);

you can do:

            vegas.SaveSnapshot(leftFile, ImageFileFormat.JPEG, leftFrameTime);            // Snapshot primer frame del clip derecho
            vegas.SaveSnapshot(rightFile, ImageFileFormat.JPEG, rightFrameTime);

 

mamomo wrote on 11/11/2025, 11:12 AM

Thanks a lot, jetdv! 🙌

You’re absolutely right — I’ve just updated the script following your suggestions:

using Timecode.FromFrames(1) instead of calculating FPS,

and calling SaveSnapshot(..., timecode) directly without moving the cursor.

It’s much cleaner and works perfectly.
I kept the sorting by Start just in case both clips are on different tracks, but everything else is now simplified exactly as you explained.

Appreciate your help! 👌