I am reviewing the code provided for version 5 and attempting to update it to version 6. I can't seem to connect/update the method from v5: GetCutSceneListData in the v6, which is located at line 66 in the code attached/below modified from the original in 2015.
I've tried the method in v6 believing it to be the equivalent of V5: SceneMarksGetSceneMarkTime
The number of scenes detected in my test video file do calculate correctly from the project file under the previous lines of code:
numScenes = vrd.SceneMarksGetCount( )
Wscript.echo("Number of scenes: " & numScenes)
' Before running this script, run VRD and do the ad-scan. This script assumes you
' do your ad-removal in Cut mode, so on completion please click "Invert All Cuts",
' then the Cut list will actually be a list of Scenes. Save this as a project file.
'
' Run this script from command line, with full path of project filename as a parameter.
' Optionally, add a profile name and output file extension as 2nd and 3rd parameters.
' Examples:-
' AdSplit "H:\EDITING\Gardens.Vprj"
' AdSplit "H:\EDITING\Gardens.Vprj" "my H264 Profile" ".mp4"
' Script starts here. Make sure at least one parameter was supplied
if WScript.Arguments.Count < 1 then
Wscript.echo( "Syntax: AdSplit.vbs ""C:\My Movies\Antz.Vprj""" _
& " [""my H264 profile"" "".mp4""]" )
Wscript.Quit 3
end if
' Get the project file name
projectFile = Wscript.Arguments(0)
' Get the extra parameters if supplied, or default to mpeg-2 program stream
outputProfile = "MPEG-2 Program Stream"
outputExtension = ".mpg"
if WScript.Arguments.Count > 2 then
outputProfile = Wscript.Arguments(1)
outputExtension = Wscript.Arguments(2)
end if
' Get project file's parent folder. We will save outputs there, based on same filename.
Set objFS = CreateObject("Scripting.FileSystemObject")
projectPath = objFS.GetAbsolutePathName(projectFile) ' full path including drive
filename = objFS.GetFileName(projectFile) ' filename with its extension
basename = objFS.GetBaseName(projectFile) ' filename minus its extension
folderpath = Left(projectPath, Len(projectPath)-Len(filename))
basepath = folderpath & basename & "_"
if not objFS.FileExists(projectPath) then
Wscript.echo("ERROR - File not found: " & projectPath)
Wscript.Quit 3
end if
' We will be using the old pre-VRD5 COM interface, which is the one still listed
' in VRD5's help. That's OK, because VRD5 still supports the old interface if we
' launch the VRD COM object with the following version of the command.
set vrd = WScript.CreateObject( "VideoReDo6.Application" )
' In VRD, open the project file that contained the ad-scan's scene markers
Vrd.EditSetMode(0)
openflag = vrd.FileOpen ( projectpath, false)
if openflag = false then
Wscript.echo( "ERROR Unable to open project file: " + projectPath )
Wscript.Quit 3
end if
' Find out how many scenes there are
numScenes = vrd.SceneMarksGetCount( )
Wscript.echo("Number of scenes: " & numScenes)
' Gather the list of scenes. Let's allow for up to 1000 of them.
dim startMsec(1000)
dim endMsec(1000)
for scene = 1 to numScenes
startMsec(scene) = vrd.GetCutSceneListData(scene, 0)
endMsec(scene) = vrd.GetCutSceneListData(scene, 1)
next
' Construct output file names, and check they don't already exist
dim outputFile(1000)
for scene = 1 to numScenes
suffix = Right(String(2, "0") & scene, 2)
name = basepath & suffix & outputExtension
outputFile(scene) = name
if objFS.FileExists(name) then
Wscript.echo("ERROR: Found old output file called " & name)
Wscript.quit 3
end if
next
' Change to Scene mode, as we want to add a scene rather than add a cut
vrd.EditSetMode(1)
if not vbYes = MsgBox ( "There are " & numScenes & " scenes. These will be saved as" _
& chr(13) & chr(13) & """" & outputFile(1) & """ etc." _
& chr(13) & chr(13) & "using profile: ''" & outputProfile & """" _
& chr(13) & chr(13) & "OK to continue?", _
vbYesNo, "AdSplit" ) then
vrd.Close()
Wscript.quit 0
end if
' For each scene in the original list...
for scene = 1 to numScenes
' Place that single scene in the scene list
vrd.SceneMarkClearAll( )
startMs = startMsec(scene)
endMs = endMsec(scene)
if not vrd.SceneMarksGetSceneMarkTime( startMs, endMs ) then
Wscript.echo("ERROR selecting scene " & scene & ": " & startMs & "mS to " & endMs & "mS")
Wscript.quit 3
end if
' Then launch the file-save process, and poll until it finishes
'Wscript.echo( "Saving with profile " & outputProfile & " to " & outputFile(scene) )
call vrd.FileSaveProfile(outputFile(scene), outputProfile)
While( vrd.IsOutputInProgress() )
Wscript.Sleep 1000
Wend
next ' ...end of the "for scene" loop
Wscript.echo("Finished splitting into " & numScenes & " files in " & folderpath)
vrd.Close()
Wscript.quit 0