Problem with using Offline Media

rcampbel wrote on 5/15/2004, 1:24 PM
I have been working on a script to let the user capture a long clip (perhaps the entire tape) and then render it into smaller clips without having to capture again. The big problem has always been how to get the capture infomation (tapename, timecodein/out) into the resulting rendered clips, OR get the capture infomation about the rendered clips into the Vegas Capture database. Without at least one of these solutions, there would be no way to recapture a smaller clip if the clip file were to be deleted.

I have recently explored using the Offline Media generation capability in Vegas 5 to get capture information into Vegas Capture. It appears that it is going to work, but I have uncovered a crash as documented below. I submitted this to Vegas support already...

The only drawback to this approach is that the user has to initiate the "Recapture all Offline Media" action to actually launch Vegas Capture. It would be nice if there was a script action to do that, or better yet a script action to simply transfer the offline media info to Vegas Capture for inclusion in the Vegas Capture database. I don't actually need to recapture the media at this point since I have already rendered it to a new file. I just want to get the info about the clips into the capture database in case they need to be recaptured in the future.

Randall Campbell

=== Problem Submission to Vegas Technical Support ====

I have written a script for Vegas 5 to generate offline media (video) in the media pool. The timeline contains a clip that was captured by vegas capture. The user defines one or more regions in this clip and then runs the script. The script creates a offline media object for each region, setting the tapename, timecodein/out from the original clip. Then the region is rendered to a file using the same path that was used to create the offline media. Basically the idea is to break a long clip into smaller clips while retaining the ability to recapture the smaller clips from vegas capture.

When I click on Recapture all Offline Media, video capture is launched correctly and the media is added to the batch capture list. All looks good. Now, if I DON'T capture the media, and just exit the video capture utility, the following exception is thrown when returning to Vegas.

If I delete the rendered clips (that have the same path as the offline media objects) before I launch Vegas capture, then the exception is not thrown.

The problem might be that when Vegas tries to read the clips that capture supposedly just captured, Vegas might be looking for the tapename and timecodein/out fields in the metadata (INFO part of the AVI). Since those fields can not be created by rendering and therefore do not exist in the AVI file, this may be causing the exception.

Thanks,

Randall Campbell

Sony Vegas 5.0
Version 5.0a (Build 134)
Exception 0xC0000005 (access violation) READ:0x8 IP:0x56DA13
In Module 'vegas50.exe' at Address 0x400000 + 0x16DA13
Thread: GUI ID=0xD50 Stack=0x12F000-0x130000
Registers:
EAX=00000000 CS=001b EIP=0056da13 EFLGS=00010206
EBX=02e07940 SS=0023 ESP=0012f350 EBP=0012fdec
ECX=00000000 DS=0023 ESI=7c350420 FS=0038
EDX=0012ee8c ES=0023 EDI=02e07460 GS=0000
Bytes at CS:EIP:
0056DA13: 8B 48 08 8B 50 04 51 52 .H..P.QR
0056DA1B: 8D 83 98 09 00 00 68 78 ......hx
Stack Dump:
0012F350: 02E082C4 02D20000 + E82C4
0012F354: 0074E704 00400000 + 34E704 (vegas50.exe)
0012F358: 00000000
0012F35C: 00000000
0012F360: 00000000
0012F364: 02E07940 02D20000 + E7940
0012F368: 04556114 04390000 + 1C6114
0012F36C: 00000000
0012F370: 00000000
0012F374: 00000001
0012F378: 00000001
0012F37C: 00000000
0012F380: 00000000
0012F384: 00000000
0012F388: 00000000
0012F38C: 00000000
> 0012F3BC: 00780030 00400000 + 380030 (vegas50.exe)
0012F3C0: 00380034 00380000 + 34
> 0012F3C4: 00780030 00400000 + 380030 (vegas50.exe)
> 0012F3C8: 00340032 00340000 + 32 (sfspti2.dll)
0012F3CC: 00000000
0012F3D0: 00000000
0012F3D4: 00000000
0012F3D8: 00000000
> 0012F5BC: 77D43B33 77D40000 + 3B33 (USER32.dll)
> 0012F5C0: 00740053 00400000 + 340053 (vegas50.exe)
> 0012F5C4: 006C0069 00400000 + 2C0069 (vegas50.exe)
- - -
0012FFF0: 00000000
0012FFF4: 00000000
0012FFF8: 007287E0 00400000 + 3287E0 (vegas50.exe)
0012FFFC: 00000000

Comments

rcampbel wrote on 5/26/2004, 6:51 PM
I finally got a response from Sony support, but the support person doesn't event know what scripting is in Vegas! Is there some other path for scripting bug support that we are supposed to take?

Randall
jetdv wrote on 5/27/2004, 7:19 AM
If you want to post the script here (or e-mail to a regular here) with more details, maybe one of us can figure out what's going on. Also, Sony engineers DO monitor this forum.
rcampbel wrote on 5/27/2004, 5:22 PM
Thanks for the offer Edward. I have a workaround for my real script, so mainly I was just trying to help Sony improve the quality of Vegas.

The problem is not with the script since the script is already finished running when the Vegas crash occurs. I went ahead and took the time to write a very simple JScript (vs. my real script which is in C#) to recreate the problem for Sony. I just sent this and a sample clip to Sony support so that they will be able to recreate.

Randall
rcampbel wrote on 6/2/2004, 7:44 AM
This is my last post on this subject. Sony support finally got back to me with the following:

"Thanks for replying. Unfortunately scripting is not supported by our department. The scripting forum on the website at http://mediasoftware.sonypictures.com/forums/ShowTopics.asp?ForumID=21 is the only support for that feature. I have however forwarded the stuff on to the development team so they can look into it. I will let you know if they respond to me otherwise they will respond to you via the fourm once you entered your problem in your fourm account."

So, for completeness sake, I am entering my last post to support here as well.

=====

Hello. I have written and attached a very simple JScript script that will recreate this crash in Vegas 5.0a. I have also attached a short DV clip to use with the script, however any clip captured by Vegas Capture will work.

I already have a work around to this problem for my real script, so I am mainly providing this info to you so that you can recreate and debug Vegas.

Here are the steps to recreate the crash:

1. Download the OfflineMediaBug.js file and the Test.avi file to a folder on your test computer.

2. Start Vegas 5 with a new default project.

3. Add the Test.avi file to the timeline (it should occupy track 1 and 2 and start at 00:00:00).

4. Run the OfflineMediaBug.js script.

5. Once the script has completed, you may need to switch the focus to another running windows program such as Windows Explorer (without exiting Vegas) and then back again to Vegas to cause the crash.

The OfflineMediaBug.js script is very simple and has no error checking. Basically it creates an offline media file called OfflineTest.avi in the same folder as the Test.avi file, then renders a one second long file to the OfflineTest.avi file. If you want to run the script again, you should manually delete OfflineTest.avi.

When Vegas tries to read the new OfflineTest.avi file it gets confused and crashes.

At this point, you are probably saying, why would someone want to do this? The reason is to take a captured long clip, cut it into smaller clips by rendering to new files, AND putting the information about the smaller clips into the Vegas Capture database so that if the small clips are ever lost, they can be recaptured directly from the source tape.

Regardless of whether you think this approach is valid, Vegas should not crash in this situation. It should simply reread the media and adjust its setting to what the media contains.

Again, I have a workaround to this problem, so I am mainly providing you this info to help improve the quality of Vegas.

==== OfflineTest.js Script ====

/**
* This script demonstrates a bug with offline media handling in Vegas 5
*
**/

import System;
import System.IO;
import Sony.Vegas;

// Use the first event in the first track
var track : Track = Vegas.Project.Tracks[0];

// Get info about the source media
var trackEvent : TrackEvent = track.Events[0];
var path : String = trackEvent.ActiveTake.MediaPath;
var media : Media = Vegas.Project.MediaPool.Find(path);
var tapeName : String = media.TapeName;
var tcIn : Timecode = media.TimecodeIn;
//var tcOut : Timecode = media.TimecodeOut;

// Put the output file in the same folder as the media
var outputFile : String = Path.GetDirectoryName(path) + Path.DirectorySeparatorChar + "OfflineTest.avi";

// Create a offline media event for this region
var offlineMedia : Media = new Media(outputFile);
offlineMedia.TapeName = tapeName;
offlineMedia.TimecodeIn = tcIn;
offlineMedia.TimecodeOut = tcIn + Timecode.FromSeconds(1);
offlineMedia.CreateOfflineStream(MediaType.Video);

// Now that the offline media has been created, render to the same file name
var renderer : Renderer = Vegas.Renderers.FindByName("Video for Windows");
var template : RenderTemplate = renderer.Templates.FindByName("NTSC DV");
Vegas.Render(outputFile, template, Timecode.FromSeconds(0), Timecode.FromSeconds(1) );

// Once the render is complete, Vegas should crash...

====================================

Thanks,

Randall
johnmeyer wrote on 6/2/2004, 9:46 AM
Unfortunately scripting is not supported by our department. The scripting forum on the website at [the Sony forum] is the only support for that feature.

I always suspected this. Having just lamented, yesterday, the inability to finish two scripts because of lack of support (lack of access to basic calls in Vegas), I was already thinking of abandoning script writing. If this is true, then I certainly am not going to spend anymore time doing something for an unsupported feature.

I wonder if Network Rendering is viewed the same way? I get the feeling that it is also a feature that "escaped the lab." Both appear to be a labor of love of one engineer that the rest of the team never really embraced. (That's just my educated guess -- I admit I have no evidence, other than experience, that makes me believe this).
SonyPJM wrote on 6/6/2004, 11:19 AM
Randall,

Thanks for the detailed bug report. I was able to reproduce the
problem and find a work-around.

The work-around (which I am not sure is the same as the one you've
already found) is to also add an audio dummy stream to the offline
media. It makes sense to do so since you're creating a DV AVI file
which has a video stream and an audio stream. So here's the correct
way to prepare the offline media:


// Create a offline media event for this region
var offlineMedia : Media = new Media(outputFile);
offlineMedia.TapeName = tapeName;
offlineMedia.TimecodeIn = tcIn;
offlineMedia.TimecodeOut = tcIn + Timecode.FromSeconds(1);
offlineMedia.CreateOfflineStream(MediaType.Video);
offlineMedia.CreateOfflineStream(MediaType.Audio);


I'll try to fix the crash as well. Thanks again.
rcampbel wrote on 6/7/2004, 3:42 PM
Glad to be of help. Your work around is different. For mine, I just made sure to delete the offline media before I rendered to the new file. I tried your suggestion also and it does not crash. Turns out that it does not help the workflow, since once the clip is rendered you can no longer run Recapture all offline media, since the media now appears to be online.

I am going to be releasing my script that uses this within the next week or so. It would be nice in the future to have an option to Recapture All Offline Media from the script API. (or better yet, an API for the Vegas Capture database).

Thanks,

Randall