How to Copy Image File Size Attribute?

hurricane1951 wrote on 7/2/2023, 3:40 AM

I have a number of image files that I want to add to my videos and they are very short in length (about a second). The sizing needs to be precise to sync with the audio track. This is not a constant string, i.e., there a video clip, then a few image files, then another video clip.

I though Paste Event Attributes would work, but it does not. I can't seem to find another command to do this. I have Vegasaur, but so far I haven't found a utility to do this.

Comments

jetdv wrote on 7/2/2023, 6:47 AM

So the image files need to evenly fill the space between the videos? A script could absolutely do that.

hurricane1951 wrote on 7/2/2023, 7:10 AM

No, not exactly. I have a video clip. then three image files of a specific length, then three shorter images, then another video clip and so on. Vegas doesn't seem to have a way to even set the width precisely unless you pre-set the width before adding it to the project. Anyway, there are two different sizes.

I figured I could get the right dimensions, then paste the widths onto the rest of the images. I had assumed Paste Attributes would do that. At this point, I have about 75 images and I'm going to be adding more. The only way I've found to match the width is to zoom into the timeline until you get each frame in view, and drag the image to match the number of frames.

jetdv wrote on 7/2/2023, 7:24 AM

If you need a bunch of images to be an exact number of frames long and they all need to be the same length, that can easily be done using a script. I'm sure Vegasaur has that ability. I know Excalibur does (it's the one I wrote).

Or you can write your own script for that by following the tutorials on my YouTube channel: https://www.youtube.com/channel/UCbRCTmKY_LO-8kJwX-knW3Q/

Basically, something like this which would change all selected images to 15 frames, for example:

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    foreach (TrackEvent evnt in myTrack.Events)
                    {
                        if (evnt.Selected)
                        {
                            evnt.Length = Timecode.FromFrames(15);
                        }
                    }
                }
            }

 

hurricane1951 wrote on 7/2/2023, 7:28 AM

I've gone through the Vegasaur utilities and haven't found it yet. There's a command that sounds like it does, but doesn't seem to do what I want.

I've never written a script, but I'll visit your site.

jetdv wrote on 7/2/2023, 7:30 AM

This would be the full script with everything needed to actually run. Just save it as "Set Length.cs" in [My Documents]\Vegas Script Menu and then you will be able to run it by going to Tools - Scripting - Set Length
 

using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;

        public void Main(Vegas vegas)
        {
            myVegas = vegas;
            
            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    foreach (TrackEvent evnt in myTrack.Events)
                    {
                        if (evnt.Selected)
                        {
                            evnt.Length = Timecode.FromFrames(15);
                        }
                    }
                }
            }
        }
    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}

Change this line for different lengths:

evnt.Length = Timecode.FromFrames(15);

Dexcon wrote on 7/2/2023, 7:33 AM

Depending on how different the image sizes of the video events are and assuming that are not all that different, an approach could be to put all the different image sized video events onto their own individual tracks and use Video Motion in the track header of each track to size the media on that track to adjust to how you want it to be.

Cameras: Sony FDR-AX100E; GoPro Hero 11 Black Creator Edition

Installed: Vegas Pro 15, 16, 17, 18, 19, 20, 21 & 22, HitFilm Pro 2021.3, DaVinci Resolve Studio 19.0.3, BCC 2025, Mocha Pro 2025.0, NBFX TotalFX 7, Neat NR, DVD Architect 6.0, MAGIX Travel Maps, Sound Forge Pro 16, SpectraLayers Pro 11, iZotope RX11 Advanced and many other iZ plugins, Vegasaur 4.0

Windows 11

Dell Alienware Aurora 11:

10th Gen Intel i9 10900KF - 10 cores (20 threads) - 3.7 to 5.3 GHz

NVIDIA GeForce RTX 2080 SUPER 8GB GDDR6 - liquid cooled

64GB RAM - Dual Channel HyperX FURY DDR4 XMP at 3200MHz

C drive: 2TB Samsung 990 PCIe 4.0 NVMe M.2 PCIe SSD

D: drive: 4TB Samsung 870 SATA SSD (used for media for editing current projects)

E: drive: 2TB Samsung 870 SATA SSD

F: drive: 6TB WD 7200 rpm Black HDD 3.5"

Dell Ultrasharp 32" 4K Color Calibrated Monitor

 

LAPTOP:

Dell Inspiron 5310 EVO 13.3"

i5-11320H CPU

C Drive: 1TB Corsair Gen4 NVMe M.2 2230 SSD (upgraded from the original 500 GB SSD)

Monitor is 2560 x 1600 @ 60 Hz

hurricane1951 wrote on 7/2/2023, 7:39 AM

jetdv

So I select in Vegas all the images I want to be a specific length, then run the script to act upon only thos images? Have I got that right?

jetdv wrote on 7/2/2023, 7:44 AM

jetdv

So I select in Vegas all the images I want to be a specific length, then run the script to act upon only thos images? Have I got that right?

yes

hurricane1951 wrote on 7/2/2023, 8:10 AM

Well, the script kept crashing Vegas, but that's ok because I found the command in Vegasaur that let's me do it after all. I appreciate the help mightily. It seems every time I ask for help from this forum I'm never disappointed.

m3lquixd wrote on 7/2/2023, 10:14 AM

@hurricane1951 That? Link

Last changed by m3lquixd on 7/2/2023, 10:15 AM, changed a total of 1 times.

About me:
Hi! Melqui Calheiros Here. I've been using Vegas as my only video editor for over 10 years. I edit professionally for various influencers, public bodies and small businesses. My goal is to squeeze Vegas to the fullest! And end the prejudice that software has here in Brazil.

⬇️ Some of my jobs. ⬇️
https://www.vegascreativesoftware.info/us/forum/post-your-vegas-creations--109464/?page=37#ca872169

PC Specs:
Operating System:
    Windows 11 Pro 64-bit
CPU:
    AMD Ryzen 7 5700G 3.80 GHz
RAM:
    32,0GB Dual-Channel DDR4 3200MHz
Motherboard:
    ASRock B450M Steel Legend (AM4)
Graphics:
    MSI RTX 4060 Ventus 2X Black OC 8GB
Storage:
    476GB ADATA SU650 (SATA (SSD))
    931GB KINGSTON SNV2S1000G (SATA-2 (SSD))

hurricane1951 wrote on 7/2/2023, 10:47 AM

Something like that, but it's in the Vegasaur toolkit.

jetdv wrote on 7/2/2023, 4:23 PM

@hurricane1951, I whipped that out before going to church this morning and did not actually test it. What error message were you getting?

I just tested it and it worked fine. I just copied the above and pasted it into a .cs file and run the .cs file. No issues at all in shortening the selected event.

Reyfox wrote on 7/3/2023, 9:09 AM

@hurricane1951 curious as to what command you are using in Vegasaur.

Newbie😁

Vegas Pro 22 (VP18-21 also installed)

Win 11 Pro always updated

AMD Ryzen 9 5950X 16 cores / 32 threads

32GB DDR4 3200

Sapphire RX6700XT 12GB Driver: 25.5.1

Gigabyte X570 Elite Motherboard

Panasonic G9, G7, FZ300

hurricane1951 wrote on 7/3/2023, 11:24 AM

Timeline | Still Images Panel. Just select the images, set the length (in time) and apply.

Reyfox wrote on 7/4/2023, 4:58 AM

With Vegasaur, I use Beat Detector to put markers on the timeline and adjust accordingly. I don't know of any plugin that will trim/extend image/clips to fit to the beats since music does change tempo. I'd get the the length settings as close as possible, then adjust.

 

Last changed by Reyfox on 7/4/2023, 4:59 AM, changed a total of 1 times.

Newbie😁

Vegas Pro 22 (VP18-21 also installed)

Win 11 Pro always updated

AMD Ryzen 9 5950X 16 cores / 32 threads

32GB DDR4 3200

Sapphire RX6700XT 12GB Driver: 25.5.1

Gigabyte X570 Elite Motherboard

Panasonic G9, G7, FZ300

hurricane1951 wrote on 7/4/2023, 7:28 AM

That's not an issue here. It's just a few still images between video clips, about 5 seconds worth. It doesn't go on long enough to get out of sync.

Reyfox wrote on 7/4/2023, 8:45 AM

Sorry, I don't quite follow you on this. You can stretch an image to any length that you want.

Newbie😁

Vegas Pro 22 (VP18-21 also installed)

Win 11 Pro always updated

AMD Ryzen 9 5950X 16 cores / 32 threads

32GB DDR4 3200

Sapphire RX6700XT 12GB Driver: 25.5.1

Gigabyte X570 Elite Motherboard

Panasonic G9, G7, FZ300

hurricane1951 wrote on 7/4/2023, 11:26 AM

No problem.

I insert a video clip in the timeline, about 1 minute in length. It has a dialog track with it, plus a music track that runs the entire length of the project. At the end of the first clip. I insert 3 still images, about 1 sec each, to correspond to cymbal crashes in the audio (quarter notes), immediately followed by three more stills about .11 sec each (eighth notes). Then I repeat the process, with a different video clip and different still images. So, video clip + 3 stills + 3 stills, then video clip + 3 stills + 3 stills, etc.

Reyfox wrote on 7/5/2023, 4:55 AM

I do videos like you describe, but have always done it manually. I set the image length in Preferences>Editing tab as close to the length that I want. Sometimes, I still have to make a slight adjustment on the length to keep things on the "beat".

Newbie😁

Vegas Pro 22 (VP18-21 also installed)

Win 11 Pro always updated

AMD Ryzen 9 5950X 16 cores / 32 threads

32GB DDR4 3200

Sapphire RX6700XT 12GB Driver: 25.5.1

Gigabyte X570 Elite Motherboard

Panasonic G9, G7, FZ300

hurricane1951 wrote on 7/5/2023, 5:58 AM

I would have done the same except for the fact that I had two different lengths, and I would not have much flexibility should I wish to add or change the images. This works so well that I think it will be my preferred choice in the future.