Vegas 18 is maintaining a file lock on media inserted using the scripting engine even after the project is closed.
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\FileLockingIssue.cs"
- Copy an mp4 file to "C:\Test\Test.mp4"
- Open Vegas 18
- Run the script | Tools | Scripting | FileLockingIssue
- Close the project. There is no need to save.
- Try and delete "C:\Test\Test.mp4"
- 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 testMedia = @"C:\Test\Test.mp4";
var videoTrack = new VideoTrack();
vegas.Project.Tracks.Add(videoTrack);
videoTrack.AddVideoEvent().AddTake(new Media(testMedia).GetVideoStreamByIndex(0));
}
}
EDIT: This issue only occurs when Vegas uses "compoundplug.dll" to decode the media file.