Add clips to T/L using their timecode.

Comments

rmack350 wrote on 3/24/2014, 12:51 PM
Rob, the In/Out T/C you refer to is not the Date/Time T/C.

Grazie, I think I had a clear idea of what sort of TC Bob was referring to. "Clock" is not a new concept for timecode but it might be new for a lot of Prosumer cameras. We're in a kind of twighlight zone for timecode these days because many file based prosumer/consumer cameras just start every clip at zero. Anyway, I understand the difference between TOD metadata and timecode set to a camera's clock.

That said, I was forgetting just what you can and can't do when copy/pasting into the edit details window. I'm not having any success pasting back into edit details' Events view, but it's pretty easy to copy all the event's data and then trim it up in excel to make a markers list. A simple markers list can be pasted into the Markers view of Edit Details. That might be useful if you have a script to place events at markers.

Copy/paste in the edit details window has some quirks. You can <Cut> from the Events view and then <Paste> the clipboard data back into it. However, if going from the Events view (I made a custom event view of two columns: Position and Active Take Name) you can't directly cut and paste an entire table. What I did instead was <Paste> into Excel and then select the data without the column headers and paste that back into Vegas' Edit Details/Markers view. That works.

Rob
Grazie wrote on 3/24/2014, 12:58 PM
Rob, thanks for putting me straight.

Grazie

johnmeyer wrote on 3/24/2014, 12:58 PM
[I]That said, I was forgetting just what you can and can't do when copy/pasting into the edit details window. I'm not having any success pasting back into edit details' Events view, but it's pretty easy to copy all the event's data and then trim it up in excel to make a markers list. A simple markers list can be pasted into the Markers view of Edit Details[/i]Old trick from long ago: when pasting back into the Edit Details window, you must first click on the little box which you find in the upper left corner at the intersection of the column and row headers in the Edit Details dialog. Doing this will select the entire table. After first doing this, you then press Ctrl-V to paste the data that you've copied from the spreadsheet.

One final thing, when copying back from the spreadsheet, do not select the column headers: these get copied when you copy [I]from[/I] the Edit Details table, but they do not get pasted when going the other way.
rmack350 wrote on 3/24/2014, 1:03 PM
I didn't know about time-of-day option. Probably too new for Vegas to recognize natively.

If the camera is just laying down TC based on it's own clock, the result will just be timecode numbers as far as Vegas is concerned. It won't matter where it comes from.

Rob
rmack350 wrote on 3/24/2014, 1:12 PM
Old trick from long ago:...

I'd gotten that far through trial and error this morning but I can't paste back from Excel or even from NotePad. And this is ringing a bell for me.

Not that this matters if Rosebud's script does the job, but I think the problem is that some of the fields in the Events view are calculated and I'll bet that you can paste into this view if your clipboard data is just right. Someone who writes scripts would probably have a better view of what's needed.

Rob
johnmeyer wrote on 3/24/2014, 2:14 PM
[I] I think the problem is that some of the fields in the Events view are calculated and I'll bet that you can paste into this view if your clipboard data is just right.[/I]True. A lot depends on which selection you make within the Edit Details dialog. With the Markers and also with the Regions view, you can cut and paste all day long, using the "trick" I outlined. With the Event selection, it gets more difficult.

One thing to note: when you do this, I always recommend first setting the ruler to "Absolute Frames" because it makes it infinitely easier to deal with time calculations in Excel. In fact, if you don't do that, I can pretty much guarantee that times will get screwed up.

Back to editing events via this dialog. I just tried a quick test case and simply added a fixed number to the Start time for each event. I then copied the new times, went back to Vegas, clicked on the first row in the Start column, and pasted the results. All events on the Vegas timeline moved to the right by that amount.

Thus, while I haven't tried it, I think I could pretty easily take the timecodes, put them in a spreadsheet, do whatever manipulations might be needed, and then paste these into the Edit Details dialog in order to move the events to specific locations on the timeline.

rmack350 wrote on 3/24/2014, 3:37 PM
clicked on the first row in the Start column, and pasted the results.

That was the secret sauce. I got a little confused at my first attempt because I clicked the track header rather than the first field, and of course clicking the track header sorts the whole table. However, if you just click the top cell of a column and then paste a column of data from excel, it works.

The caution of setting your ruler to absolute is a good idea, although it wouldn't matter if you aren't making calculations in excel. I think you could go either way in this case since they're just text values.

Actually, this would allow Bob to skip a lot of steps. I just grabbed some Quicktime files with Timecode (Yay, Vegas now sees the TC, Boo, too late to do me much good) and dropped them onto the timeline in random order. I then went to Edit Details/Events, Copied the Timecode In values of the media, and pasted those values into the Start column. Viola, all the clips have been moved to new locations. No need to round-trip it through Excel.

Need to make sure your ruler matches the TC in the clips but otherwise Bob's yer Uncle, so to speak.

The other thing I did was to reset my ruler to start at hour 4 since all my media started there.

Rob
johnmeyer wrote on 3/24/2014, 5:10 PM
[I]The caution of setting your ruler to absolute is a good idea, although it wouldn't matter if you aren't making calculations in excel.[/I]Yes, that's generally true if you are copying/pasting to/from something like Notepad. However, in anything which has to deal with numbers (which is what we are talking about here with timecodes), problems may loom ahead. This is certainly true with Excel.

I haven't upgraded Excel for almost a decade, so maybe the newer versions handle timecodes more easily. What I have found with my versions is that if I take a timecode like:

12:03

and paste it into Excel, Excel then converts that to a decimal time number internally (0.502083333333333 in this case), but formats it into a time. If you then try to paste this back into Vegas, you get strange results because not only is the information no longer a text value, but its format doesn't match anything that Vegas can deal with.

It gets even worse if you have the Vegas ruler set to a timecode which includes frames as the last set of digits. My version of Excel (and I suspect later versions as well) has absolutely no formatting to deal with that.

If instead you convert the ruler format to Absolute Frames, everything works without having to do anything whatsoever. I can almost guarantee problems for anyone who does it any other way.

videoITguy wrote on 3/24/2014, 5:38 PM
Excel (or any other spreadsheet) software is exceedingly programmable. The cell container has default values which can be changed to some other default OR even better you can set a formula of cell source to a cell destination can that can do a whole lot of manipulations. just sayin, although surely it is beyond the scope of discussion wanted here.
rmack350 wrote on 3/24/2014, 6:14 PM
When I paste into Excel I get a set of numbers like:
04:16:03:00
04:16:16:23
04:16:38:00
04:17:13:23
04:17:33:00
04:17:51:00
04:18:10:23

Excel (or Libre Office Calc) assumes a number format of General. If I were to just import a number like 5:27 Excel would assume a custom time format. Either format will make a mess if you try to do math on it, whereas Absolute Frames would be easy to do math on. (Although, several of those clips don't start on whole frames. The last one starts at "371,783.200" for example. I'm not sure why that is, perhaps the media was shot at 29.97 with pulldown...not my problem.)

However, for Bob's problem you can simply copy the timecode of the media from the "Timecode In" column to the "Start" column without ever using Excel. Takes all of 15 seconds to lay out the media according to timecode (and I wouldn't have figured it out without your input, btw.) It works whether the ruler is set to Absolute frames or to the media's framerate. I think if you use Absolute you probably don't need to worry about whether the ruler needs to match the media.

Rob
johnmeyer wrote on 3/24/2014, 8:58 PM
[I]Excel (or any other spreadsheet) software is exceedingly programmable. The cell container has default values which can be changed to some other default OR even better you can set a formula of cell source to a cell destination can that can do a whole lot of manipulations. just sayin, although surely it is beyond the scope of discussion wanted here.[/I]Yes, I know, and at the risk of being immodest, I have done more programming inside of Excel than, well, most people. As one slightly absurd example, I have a program that uses linear programming to give me the ideal answer of exactly how many $0.49, $0.21, $0.20, and $0.03 stamps to use in order to exactly reach a given postage, without going under or over.

The problem with timecodes is that you can't solve the issue I've describe in previous posts with either programming (in the cell, or via macros); or with formatting commands; or with various copy and then "paste special" commands. What's more, if you want to do math on the timecode information copied into Excel from Vegas, such as moving events to different locations, as I illustrated in my earlier post, it is almost impossible to do this unless you convert to Absolute Frames. What's more, even if you eventually manage to get it to work using minute:second:frames timecode (and I have actually done it this way) you will then run into all sorts of interesting rounding issues, especially when dealing with 29.97 material. Have you ever looked at the Vegas programming API to see how 1000/1001 * 30 NTSC time is stored internally inside of Vegas? You don't want to have to emulate this inside of Excel. Once you start dealing with numbers like 0.999000999000999 (the result of the 1000/1001 division that is at the heart of NTSC frame rates) programming gets exceedingly messy.

Since it takes exactly one second to change the ruler format to Absolute Frames, and then change it back to whatever time format you were using before you made the change, I view that two-second tradeoff as the ultimate no-brainer as to how to reduce my time to complete a given project.

farss wrote on 3/24/2014, 9:45 PM
The script mentioned above works :)

It does have a curious bug though. I had to run it three times to get every clip in the right place. Not a big issue as the ones in the wrong place were way out of wack and therefore quite obvious.

Copy of it:

/**
* This script will move events to start at their timecode.
*
* Written By: Edward Troxel
* Modified: 07-04-2007
**/

using System;
using System.IO;
using System.Text;
using System.Drawing;
using System.Reflection;
using System.Diagnostics;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Sony.Vegas;

public class EntryPoint
{
Vegas myVegas;

public void FromVegas(Vegas vegas)
{
myVegas = vegas;

foreach (Track track in myVegas.Project.Tracks)
{
foreach(TrackEvent evnt in track.Events)
{
Media media = vegas.Project.MediaPool.Find(evnt.ActiveTake.MediaPath);
if (null == media)
{
MessageBox.Show("missing media");
throw new ArgumentException("missing media");
}

evnt.Start = media.TimecodeIn;
}
}

}



}


I suspect the problem is as each event in the media pool is changed by the code it is reordered in the pool so it's possible the "for each ....in" can miss some at each pass.

Having all the video events at the correct time on the T/L it was then simple to put my three audio files at the correct place. My Edirol R44 names it's files using its own time of day clock but that's only to the nearest second. Much to my amazement though it was frame accurate at the start and still good after 4 hours, I guess you've got to win some :)

Bob.
videoITguy wrote on 3/24/2014, 9:45 PM
johnmeyer, and for those of us, and that really includes me who are old enough...I DO still have my timecode calculator - these were produced around the time we were editing film on flatbed moviola desktops. Do you recall that era? I just got to replace some button batteries and I am good to go.
johnmeyer wrote on 3/25/2014, 12:41 AM
I still have my slide rule from college, and also have my dad's pre-war decitrig slide rule.

No timecode calculator, however.
ushere wrote on 3/25/2014, 3:11 AM
still have my slate and piece of chalk from primary school - still getting erase errors....
Grazie wrote on 3/25/2014, 3:25 AM
You had CHALK?!?! - Pure Luxury.... We'd draw Cosine and Vector formula in t'Sand with 'twig! CHALK?!? You were lucky!

G

PeterWright wrote on 3/25/2014, 3:52 AM
We used to dream of 'aving twig!
Grazie wrote on 3/25/2014, 4:14 AM
Dream?!? Dream?!? You were lucky!! - We never slept . . . . we'd get up 4 hours afore we went t'bed . . . Dream?!? Dream?! Shear luxury . . . . .
ushere wrote on 3/25/2014, 5:06 AM
LOL
paul_w wrote on 3/25/2014, 6:50 AM
This is the script i was linking to: Working perfect here. It takes media straight from the media pool and copies it to the TL rather than having to have everything on the TL in the first place. Try this:

*
* Add clips at ruler timecode
* November 12 2010 / Gilles Pialat
*
*/

using System;
using System.Windows.Forms;
using Sony.Vegas;

public class EntryPoint
{
Vegas myVegas;
public void FromVegas(Vegas vegas)
{
myVegas = vegas;
Media[] selectedMedia = myVegas.Project.MediaPool.GetSelectedMedia();

if (selectedMedia.Length == 0)
MessageBox.Show("Please select media in mediapool before to run this script");
else
{
myVegas.Project.Tracks.Add(new VideoTrack(0));
myVegas.Project.Tracks.Add(new AudioTrack(1));
foreach (Media media in selectedMedia)
{
VideoEvent videoEvnt;
AudioEvent audioEvnt;
TrackEventGroup group = new TrackEventGroup();
myVegas.Project.Groups.Add(group);

foreach (MediaStream mediaStream in media.Streams)
{
if (mediaStream.MediaType == MediaType.Video)
{
videoEvnt = new VideoEvent(media.TimecodeIn, media.Length);
Take activeTake = new Take(mediaStream, true);
myVegas.Project.Tracks[0].Events.Add(videoEvnt);
videoEvnt.Takes.Add(activeTake);
group.Add(videoEvnt);
}
if (mediaStream.MediaType == MediaType.Audio)
{
audioEvnt = new AudioEvent(media.TimecodeIn, media.Length);
Take activeTake = new Take(mediaStream, true);
myVegas.Project.Tracks[1].Events.Add(audioEvnt);
audioEvnt.Takes.Add(activeTake);
group.Add(audioEvnt);
}
}
}
}
}
}


Paul.
Grazie wrote on 3/25/2014, 7:20 AM
Ah! I'd seen that script before, but didn't have enough knowledge to pickup on its value - huh! Nice one Gilles.

G

johnmeyer wrote on 3/25/2014, 11:11 AM
Well, we've now almost exactly duplicated this earlier thread, also started by Bob back in 2010, with Bob making almost the identical comment after discovering and then using what I think is the same Giles script as posted above:

Add clips at ruler timecode

This reminds me of most of my current-day conversations with my wife, after forty years together ...

P.S. Bob, if you read the old thread, Giles gives you a small modification to his script (which is different than Ed's script, which is also shown in that thread). This modification might give you exactly what you want.
paul_w wrote on 3/25/2014, 11:22 AM
Yes John, You posted the same link i posted a few back! :)

Paul.
rmack350 wrote on 3/25/2014, 1:36 PM
Well, we've now almost exactly duplicated this earlier thread...

Yep, I was getting a chuckle out of reading the older thread and seeing how it mostly repeated the current conversation. I've been embarrassed a few times searching posts and finding I'd written the exact same things 5 or 6 years earlier, and entirely forgotten it.

Anyway, I saved Giles script and tried it out in my test project. It's sure fast once you've got it prepped and placed, although not significantly faster than what I was doing by copying and pasting a column of data within the Edit Details window.

There IS a snafu, though. I'd already set my ruler to start at hour 4 since I knew all my media timecode started at hour 4 (it was reel 4 of that shoot.) Giles' script places all the media at an offset from the start of the timeline rather than *at* the timeline coordinate. So, for example, it placed a clip whose "Timecode In" was 04:18:10:23 at a "Start" coordinate of 08:18:10:23.

The advantage to the script is that it only moves the media you've selected in the project media window. This makes it easy to shuffle media clips into an already built project. You could also do this with the non-scripted copy/paste method but, as pointed out, you need to already have the clips on a track. That's easy enough to work out and it might be that you wanted them on their own track anyway so I'm not sure that's an issue.

On Absolute Frames...I just want to point out that when you're looking at Absolute Frames, its a measure of timeline frames, not media frames. The Absolute Frames count depends on your project's framerate. It's a minor distinction but take from it what you will.