Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums VEGAS Pro adding photos in vegas MS 10 at different intervals

  • adding photos in vegas MS 10 at different intervals

    Posted by Chris Howland on October 26, 2011 at 1:13 am

    Hey I have learned a lot from reading these forums, now it’s my turn to ask a question.
    I searched for an answer, but could not find this before.

    I have a number of photos of an event (marching band pefromance).
    the photos were taken at various intervals.
    I also have video of this same event.
    I want to import the photos and place them on the timeline, relative to the actual time taken, using the timestamp that the photo was created.
    I tried creating a slide show, or simply adding the photos to the timeline, but that will add them all with a fixed duration and fixed length transition.

    I also tried to import them as a sequence of stills, but that adds them at a frame rate of 30 fps (or 29.whatever).
    I may have 80 – 200 pictures I want to add that were taken over an 8 minute performance, fading between the video and the stills.
    I am hoping there is a simple solution that I am missing. Any help is greatly appreciated.

    Tyson Onaga replied 14 years, 6 months ago 2 Members · 5 Replies
  • 5 Replies
  • Tyson Onaga

    October 31, 2011 at 5:16 pm

    Chris,
    I posted this but in the wrong thread. Sorry about that …
    – T

    ———-

    I know of no automated way to do this. You could put Markers into the Timeline which indicate where each image should go. You would then have to drag the image (one at a time) from the Media Pool to correct Marker location.

    You could try this:

    1. Get a list of the files you want added sorted by time (preferably). You could use something like “dir /od/b *.jpg > dir.txt”.

    2. Open Excel. Tools -> Macro -> VB Editor.

    3. Enter:
    Function MyGetFileDateTime(fileName As String) As Date
    MyGetFileDateTime = FileSystem.FileDateTime(fileName)
    End Function

    4. On the worksheet, copy the values of (1) into col A.

    5. In cell B1, enter:
    =PERSONAL.XLS!MyGetFileDateTime(A1)

    6. Select B1. Format -> Cells -> Time. Select the Type 30:55.2

    7. Copy B1. Select all the rows in B for which you have a value in col A. Paste. You should now have all the file date/time values in col B for each value in col A.

    8. Col C, cell C1, enter 0

    9. Cell C2, enter:
    =B2-Bx
    Yes, you’ll get an error.

    10. Copy C2. Select all the rows from C3 down for which there’s a value in B. Paste. You should now have a bunch of error-ed functions.

    11. Select the error-ed functions. Edit -> Replace. Replace Bx with B1. Each C2 (onwards) should be =B#-B1. I.e, C1 is 0, C2 onwards is the offset in time from 0.

    12. Highlight values in C, Format -> Cells -> Time. Select the Type 30:55.2

    13. In col D, enter a marker name (M.1, M.2, etc.) … or copy the values from col A.

    —> Col C and D should contain Time (offset) and Marker names

    14. Open your .veg

    15. Alt-6, Select Show Markers.

    16. Select the values from Excel, cols C and D. Copy.

    17. In Vegas (Markers) Select All (top leftmost cell). Paste.

    —> You should now have Markers in the timeline.

    Now it is time for drag and drop.

    Note: This assumes that time 0:00.0 is ALSO the start of your video. If it is not, you will need to adjust the time calculation functions accordingly. Alternatively, you could just slide the media in the images Track (forward or backward) until it lines up with your video footage Track.

  • Chris Howland

    November 1, 2011 at 2:18 pm

    Tyson,
    this isn’t very automated, but I like your thinking. This is programmable, and repeatable. I wasn’t aware of this method of creating markers.

    I will try this out and report back with my results!

    Thank you very much.

    Chris

  • Tyson Onaga

    November 1, 2011 at 3:42 pm

    I would try a few images first, maybe 5 or 6. What you need after that is a JavaScript script (a .js file) that has a function in it that takes a mediaPath, trackNo, timeOffset, markerName, mediaLength and:

    a. Inserts a Marker on Track trackNo at timeOffset with name of markerName.
    b. Inserts the Track Event specified by mediaPath on Track trackNo at timeOffset of length mediaLength

    The .js signature might be something like:
    function InsertMediaAndMarker( mediaPath, trackNo, timeOffset, markerName, mediaLength)
    {

    }

    Modify the xls so that:

    1. Col F has the full path to your media (probably a copy of col A).
    2. Col G has the track number
    3. Col H is a copy of col C.
    4. Col I is a copy of col D.
    5. Col J is a default media length; eg. 4
    6. Col K is the difference between Cn and Cn+1 (the time difference between two media events)
    7. Col L is the MIN() of cols J and K; ie, a value of 4 or LESS
    8. Col M is a big CONCATENATE expression to create a string with the parameters to the .js function described above.

    You would then take the contents of Col M and paste it into the .js code. Running it should insert the Markers and Media on the track you desired.

    Of course, you need the .js function.
    I’m not up on the Vegas JavaScript API. Maybe someone could pitch in here!?

  • Chris Howland

    November 1, 2011 at 5:12 pm

    hey thanks again for helping me out.
    One problem – the excel macro seems be looking at the date modified of the file, which might be different than the date that the photo was taken…
    I suppose I could modify the file to change the modified date to equal the date taken, but is there a method to get the file creation time (or the date the photo was taken, if it’s different)??

    thanks

  • Tyson Onaga

    November 1, 2011 at 7:44 pm

    I found some of this online. Note the change to the last function MyGetFileCreatedDateTime().

    Public Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" _
    (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long

    Public Declare Function FileTimeToSystemTime Lib "kernel32" _
    (lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long

    Declare Function FileTimeToLocalFileTime Lib "kernel32" _
    (lpFileTime As FILETIME, lpLocalFileTime As FILETIME) As Long

    Public Type FILETIME
    dwLowDateTime As Long
    dwHighDateTime As Long
    End Type

    Public Type SYSTEMTIME
    wYear As Integer
    wMonth As Integer
    wDayOfWeek As Integer
    wDay As Integer
    wHour As Integer
    wMinute As Integer
    wSecond As Integer
    wMilliseconds As Long
    End Type

    Public Type WIN32_FIND_DATA
    dwFileAttributes As Long
    ftCreationTime As FILETIME
    ftLastAccessTime As FILETIME
    ftLastWriteTime As FILETIME
    nFileSizeHigh As Long
    nFileSizeLow As Long
    dwReserved0 As Long
    dwReserved1 As Long
    cFileName As String * 260
    cAlternate As String * 14
    End Type

    Private Function FileDate(FT As FILETIME) As String
    ' convert the FILETIME to LOCALTIME, then to SYSTEMTIME type
    Dim ST As SYSTEMTIME
    Dim LT As FILETIME
    Dim t As Long
    Dim ds As Double
    Dim ts As Double

    t = FileTimeToLocalFileTime(FT, LT)
    t = FileTimeToSystemTime(LT, ST)

    If t Then
    ds = DateSerial(ST.wYear, ST.wMonth, ST.wDay)
    ts = TimeSerial(ST.wHour, ST.wMinute, ST.wSecond)
    ds = ds + ts
    If ds > 0 Then
    ' FileDate = Format$(ds, "mm/dd/yy hh:mm:ss") ' original line ...
    FileDate = Format$(ds, "hh:mm:ss")
    Else
    FileDate = "(no date)"
    End If
    End If
    End Function

    Function MyGetFileCreatedDateTime(fileName As String) As Time
    Dim hFile As Long
    Dim WFD As WIN32_FIND_DATA

    hFile = FindFirstFile(fileName, WFD)
    If hFile > 0 Then
    MyGetFileCreatedDateTime = TimeValue(FileDate(WFD.ftCreationTime))
    End If
    End Function

    You’d need to put the whole thing into your PERSONAL.XLS using Tools -> Macro -> VB Editor.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy