Extracting start times of clips

kentavv wrote on 6/11/2019, 2:07 PM

In a Vegas project, I have one large video that's been split (I pressed the 's' key) several times, aligned manually, and trimmed. I would like to extract either the frame number of the time offset of each of these clips relative to the start of the original video the clip came from. (I'll use this information in a Python script to perform video analysis.) Have can I obtain these values? Using the UI to get the time offset is fine if that's possible; no need to script the time offset extraction.

Comments

Former user wrote on 6/11/2019, 3:34 PM

view>edit details will give you a text you can cut and paste.

wwaag wrote on 6/11/2019, 5:58 PM

In Edit Details, the value you are looking for is named Take Start.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

Musicvid wrote on 6/11/2019, 8:27 PM

Put markers at each cut point. The Edit Details per wwaag will show the time of each marker. You can click the top left square to Select All, then copy and paste the data into any spreadsheet or text editor, even create chapter points for your mo4 by using the correct syntax.

Harold-Linke wrote on 6/12/2019, 12:16 AM

As you have already a Python script to perform your analysis you could use VEGASPYTHON to retrieve the information and immediatly use it in your script.

https://www.hlinke.de/dokuwiki/doku.php?id=en:vegas_python

If I have some time this evenning I may be able to provide you with a PYTHON script that extracts the information.

As you seem to be capable of programming in PYTHON it should not be difficult for you to update your script.

Harold

Grazie wrote on 6/12/2019, 1:13 AM

I use the Edit Details to Copy and Paste into an Excel SS to handover to a client to log their required Ins and Outs for Talent piece to camera. I then get ‘em back and create Markers for further Edit-downs. Job done! EDV? Almost as good as my CSP2 😎

Musicvid wrote on 6/12/2019, 5:10 PM

@Grazie

+1

Harold-Linke wrote on 6/15/2019, 6:46 AM

@kentavv

as promissed, here is the Python code for VEGASPython to extract the time offset of all selected clips on a project:

for track in pyVEGAS.Project.Tracks:
       for evnt in track.Events:
                if (evnt.Selected):
                    print(evnt.ActiveTake.Media.FilePath,":",evnt.ActiveTake.Offset.FrameCount)

Instead of printing you can use the results directly in your python program.

Harold

 

 

kentavv wrote on 7/6/2019, 2:20 PM

Thank you @Harold-Linke, I had no idea of the scripting capabilities of Vegas. pyVEGAS is very impressive! Below is what I used to extract the audio clips. I didn't know what I was doing, so there are surely better ways. For instance, I didn't see a way to specify a track to render so I must solo the track. In Vegas, I set each audio clip to have a unique name, select all clips, and hit Execute. The audio analysis is then done offline. Can the font size of the interactive pyVEGAS editor be increased? Again, Thank you!

dn = 'C:/Users/kent/local/audio_analysis/'
try:
    os.makedirs(dn)
except FileExistsError :
    pass

renderer = pyVEGAS.Renderers.FindByName('FLAC Audio')
template = renderer.Templates.FindByName('44,100 Hz, 16 Bit, Stereo')
ext = renderer.FileExtension[1:]

for track in pyVEGAS.Project.Tracks:
    track.Solo = False

for track in pyVEGAS.Project.Tracks:
    if track.IsAudio():
        track.Solo = True

        for event in track.Events:
            if (event.Selected):
                # print(f'{event.ActiveTake.Media.FilePath}: {event.ActiveTake.Offset} {event.Length}')

                fn = event.ActiveTake.Name + ext
                fn = dn + fn

                print(fn, event.Start, event.Length)

                pyVEGAS.Render(fn, template, event.Start, event.Length)

        track.Solo = False
Harold-Linke wrote on 7/7/2019, 5:29 AM

@kentavv

thank you for your feedback. It is great that you can make use of VEGASPython.

Good hint regarding the font size. In the next version I plan to make the font size configurable.

For more complex python scripts I recommend to use an external editor like the free WING Python IDE Personal edition. This editor allows easy debugging of the script by setting breakpoints and watching variables.

Harold