Dear All,
I am testing to replace three videos (HD to UHD), later just with one...
def isSibling(media): #Short one return PureWindowsPath(media.FilePath) #return path object or None def isVideo(media): isVideo = False if media.HasVideo() and not media.IsGenerated(): isVideo = True return isVideo mediaPool = pyVEGAS.Project.MediaPool for media in mediaPool: sibling = isSibling(media) if isVideo(media) and sibling!=None: print(media.FilePath, str(sibling), sep=" - ") newMedia = Media(str(sibling)) media.ReplaceWith(newMedia) # pyVEGAS.WaitForIdle() - The Clash - Should I Stay or Should I Go... ;-) else: print("Nothing to do.")
I read Media ReplaceWith works in script but not in extension. I guess that Harold-Linke crumbled VEGASPython to UndoBlock mentioned by jetdv already (I can see the undo step).
First media is replaced in MediaBin and then I am hitted ...
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at ScriptPortal.Vegas.IMediaPoolIterator.MoveNext(Boolean& atEnd) at ScriptPortal.Vegas.MediaPoolEnumerator.MoveNext() at Python.Runtime.Iterator.tp_iternext(IntPtr ob) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.PyObject.Invoke(PyTuple args, PyDict kw) at Python.Runtime.PyObject.InvokeMethod(String name, PyTuple args, PyDict kw) at Python.Runtime.PyObject.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result) at CallSite.Target(Closure , CallSite , Object , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1) at VegasPython.VEGASPythonManager.Execute_VPython_File_PN(String module, String fileName, List`1 sysargs) ******************************************* at ScriptPortal.Vegas.IMediaPoolIterator.MoveNext(Boolean& atEnd) at ScriptPortal.Vegas.MediaPoolEnumerator.MoveNext() at Python.Runtime.Iterator.tp_iternext(IntPtr ob) at Python.Runtime.Runtime.PyObject_Call(IntPtr pointer, IntPtr args, IntPtr kw) at Python.Runtime.PyObject.Invoke(PyTuple args, PyDict kw) at Python.Runtime.PyObject.InvokeMethod(String name, PyTuple args, PyDict kw) at Python.Runtime.PyObject.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result) at CallSite.Target(Closure , CallSite , Object , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2[T0,T1](CallSite site, T0 arg0, T1 arg1) at VegasPython.VEGASPythonManager.Execute_VPython_File_PN(String module, String fileName, List`1 sysargs)
I've already tested WaitForIdle() (Wait for asynchonous actions (such as building audio peaks) to complete.) without any success.
What I am doing wrong?
Best regards
Jan
Test PC: i7-5820K 3.30, 8GB RAM, W10 last updates, Vegas 18 build:373