Bug report - ReplaceWith file lock - Vegas 18 (Build 527)

mickhardy wrote on 6/23/2021, 12:42 AM

Vegas 18 is maintaining a file lock on media after using the ReplaceWith method in the scripting engine even after the project is closed.

This is similar to the issue described in this bug report.

It occurs whenever the test media use the "compoundplug.dll" decoder. This happens for M2TS files by default and other media files such as MP4 when using a virtual machine for testing. It also happens for MP4 files if you turn on the "Enable legacy AVC decoding" option under File I/O.

If anyone can think of a workaround, it would be greatly appreciated.

I've simplified the steps to reproduce it.

Save the included script as "C:\Program Files\VEGAS\VEGAS Pro 18.0\Script Menu\ReplaceWithLockingIssue.cs"

Copy an m2ts file to "C:\Test\Original.m2ts"

Copy an m2ts file to "C:\Test\Replaced.m2ts"

Open Vegas 18

Run the script | Tools | Scripting | FileLockingIssue

Close the project. There is no need to save.

Try and delete either "C:\Test\Original.m2ts" or "C:\Test\Replaced.m2ts"

The file lock will not be released until Vegas 18 is closed

This does no affect Vegas 9 through 17

using ScriptPortal.Vegas;

public class EntryPoint
    public void FromVegas(Vegas vegas)
        const string originalMedia = @"C:\Test\Original.m2ts";
        const string replacedMedia = @"C:\Test\Replaced.m2ts";
        vegas.NewProject(false, false);
        var videoTrack = new VideoTrack();
        var media = new Media(originalMedia);
        var length = media.Length;
        videoTrack.AddVideoEvent().AddTake(media.GetVideoStreamByIndex(0), true);
        media.ReplaceWith(new Media(replacedMedia));        



mickhardy wrote on 6/23/2021, 1:09 AM

Workaround: Copy the "compoundplug" folder from "C:\Program Files\VEGAS\VEGAS Pro 17.0\FileIO Plug-Ins\".

Edit: This may result in Vegas 18 crashing and is not a suitable workaround.

mickhardy wrote on 6/23/2021, 8:00 PM

It’s similar to the one I linked but not the same. The difference is important to clarify because they have been working on it.

Howard-Vigorita wrote on 6/25/2021, 11:40 PM

Maybe adding this line to your script might help ...

 myVegas.UnloadScriptDomainOnScriptExit = true;


mickhardy wrote on 6/28/2021, 7:24 PM
 myVegas.UnloadScriptDomainOnScriptExit = true;

Thanks for the suggestion but it didn't resolve the issue.