KMTTG Work in Progress (formerly API changed?)

SamuriHL

Member
WScript.CreateObject: Could not locate automation class named "VideoReDo.VideoReDoSilent".

I'm getting this error now since the release. I've run it as admin just to ensure everything's registered correctly (afaik?). This seems to have changed in 802. Any insight on this one? Thanks!
 

hydra3333

Member
Wondering

you saw this ?
We haven't actually updated the scripts for v6 yet, so ignore the ones in the install folder.
v6 uses a different object name and has a few minor changes to the API but I don't think any of them will affect that script. In fact if you just update that script to use "VideoReDo6.X" instead of "VideoReDo5.X" where the objects are created it should work just fine.
Also in v6 VideoReDo consumer and Pro will have different names as well, so if you're using Pro then that would be "VideoReDoPro6.X"

and this ?
 

SamuriHL

Member
Ok, so, it's because I uninstalled V5 after upgrading to 802 that caused my problem. But that's a good thing anyway because I WANT the program I'm using to use V6. Simply changing the calls from VideoReDo5 to VideoReDo6 did not work in my case for any of the scripts that they're calling. This has completely broken a piece of software I use regularly until I have time to sort out what the new calls are going to be. The biggest one I care most about is being able to qsfix. Don't know if the params have changed on that. This isn't really my problem to fix anyway, it's more a kmttg problem, but, as I'm a developer, I tend to try to fix things myself. LOL
 

Dan203

Senior Developer
Staff member
The com interface was changed slightly so you could have multiple versions of VideoReDo installed and ensure you were calling the proper on. The new interface names for v6 all start with VideoReDo6. As in...

VideoReDo6.VideoReDoSilent
 

SamuriHL

Member
Yea, that's what I changed it to in the script and I still got errors. I'm not sure what's going on with that yet.
 

Dan203

Senior Developer
Staff member
If you run the batch manager it will ensure that the COM interface is properly registered with the system and offer to fix it for you if it's not.
 

SamuriHL

Member
Batch manager seems fine. I ran the qsfix.vbs from a command line and all I get now is "? Problem opening output file: xxx". Well that sucks. LOL
 

Danr

Administrator
Staff member
Ok, so, it's because I uninstalled V5 after upgrading to 802 that caused my problem. But that's a good thing anyway because I WANT the program I'm using to use V6. Simply changing the calls from VideoReDo5 to VideoReDo6 did not work in my case for any of the scripts that they're calling. This has completely broken a piece of software I use regularly until I have time to sort out what the new calls are going to be. The biggest one I care most about is being able to qsfix. Don't know if the params have changed on that. This isn't really my problem to fix anyway, it's more a kmttg problem, but, as I'm a developer, I tend to try to fix things myself. LOL
If you were using the VideoReDo5 interface then you should be able to change it VideoReDo6 and things should work. However, if you were using the old VideoReDo interface that will need some additional work. In Version 5, we mentioned that the VideoReDo interface was deprecated and being replaced with VideoReDo5. Some of the calls and methods were changed in the process. Considering that people had quite a few years to upgrade to the new interface we dropped support for the old interface in V6.
 

SamuriHL

Member
If you were using the VideoReDo5 interface then you should be able to change it VideoReDo6 and things should work. However, if you were using the old VideoReDo interface that will need some additional work. In Version 5, we mentioned that the VideoReDo interface was deprecated and being replaced with VideoReDo5. Some of the calls and methods were changed in the process. Considering that people had quite a few years to upgrade to the new interface we dropped support for the old interface in V6.
They're using the v5 interface and I changed it to v6. I didn't get a lot of time to really dig into the issue. It's creating the object but the calls they're making don't seem to work. My guess is it has to do with profile changes but again didn't get time to dig into it too far.
 

Danr

Administrator
Staff member
I just modified vp.vbs, changing VideoReDo5 to VideoReDo6 and it worked OK.
 

SamuriHL

Member
Ok. I'll work on it when I get home. Ideally the author of kmttg will release an update before then but if not I'll work on getting it to work.
 

Dan203

Senior Developer
Staff member
One minor change to the API that might be causing issues...

ProfilesGetProfileEnabled has changed to ProfilesGetProfileIsEnabled

Also all of the old AdScan functions have been renamed to have "Interactive" in front of them.

Also as DanR mentioned the legacy COM interface, the one that matched v4, has been completely removed. So if you were using that you'll have to upgrade to the new interface completely.
 

SamuriHL

Member
They had updated the scripts they're using for v5 with a separate code path for v4 and lower. I'm not hitting that code path. The ProfilesGetProfileEnabled is definitely one call that was failing so I'll change that. That's good at least. I'll keep messing around with it tonight.
 

Dan203

Senior Developer
Staff member
I looked at the kmttg code. It's a little messy. Some of the other problems I see is that they are using hard coded profile names and IDs. Those have changed in v6. The biggest potential issue I see is that in v5 we had separate profiles for individual codecs, but in v6 all default profiles are "Match Source" by default. That could require a change in logic depending on the intended outcome of the script. (i.e. is the logic attempting to match the profile to the source, in which case that's no longer necessary, or does the logic expect the file to be recoded to the specific format, in which case that's not really possible with the default profiles.
 

SamuriHL

Member
Yup, that's exactly what I'm working on right now. I ripped out all the v4 crap to simplify this a bit and am working on profiles now. It's attempting to match the source it's NOT trying to encode anything in this particular script. It's just a qsfix. So I'm working on rewriting it to work with v6. You're saying I don't need the profiles at all if I just want to match source?
 

SamuriHL

Member
Ok my fellow kmttg people. I've only rewritten 2 of the scripts so far. This is enough for me at the moment. I will continue rewriting them when I get time.

getProfiles.vbs

Code:
'Create VideoReDo object.
On Error Goto 0
set VideoReDoSilent = wscript.CreateObject( "VideoReDo6.VideoReDoSilent" )
set VideoReDo = VideoReDoSilent.VRDInterface

' Get number of profiles available.
numProfiles = VideoReDo.ProfilesGetCount()
if ( numProfiles > 0 ) then
    for i = 0 to numProfiles-1
       if (VideoReDo.ProfilesGetProfileIsEnabled(i)) then
          wscript.echo(VideoReDo.ProfilesGetProfileXML(i))
       end if
    next
end if

' Close VRD
VideoReDo.ProgramExit()

' Exit with status 0
wscript.quit 0
qsfix.vbs

Code:
set Args = wscript.Arguments
if Args.Count < 2 then
   wscript.stderr.writeline( "? Invalid number of arguments")
   wscript.quit 1
end if

' Check for flags.
VrdAllowMultiple = false
lockFile = ""
x = ""
y = ""
dimensions = false
for i = 1 to args.Count
   p = args(i-1)
   if left(p,3)="/l:" then lockFile = mid(p,4)
   if left(p,3)="/x:" then x = mid(p,4)
   if left(p,3)="/y:" then y = mid(p,4)
   if p = "/m" then VrdAllowMultiple = true
next

' Check that a lock file name was given
if ( lockFile = "" ) then
   wscript.stderr.writeline( "? Lock file (/l:) not given" )
   wscript.quit 2
end if

' Check if x & y dimensions were given
if ( not x = "" ) then
   if ( not y = "" ) then
      dimensions = true
   end if
end if

'  Decide on output types
profileName = "Transport Stream"
if ( c = "mp4" ) then
   profileName = "MP4"
end if

Set fso = CreateObject("Scripting.FileSystemObject")
sourceFile = args(0)
destFile   = args(1)

'Create VideoReDo object and open the source project / file.
if (VrdAllowMultiple) then
   On Error Goto 0
   Set VideoReDo = WScript.CreateObject( "VideoReDo6.Application" )
else
   On Error Goto 0
   set VideoReDoSilent = wscript.CreateObject( "VideoReDo6.VideoReDoSilent" )
   set VideoReDo = VideoReDoSilent.VRDInterface
end if

'Hard code no audio alert
 VideoReDo.ProgramSetAudioAlert( false )

' Open source file
' 2nd arg has to be true for qsfix mode to apply
 openFlag = VideoReDo.FileOpen(sourceFile, true)

if openFlag = false then
   wscript.stderr.writeline( "? Unable to open file/project: " + sourceFile )
   wscript.quit 3
end if

if (dimensions) then
   wscript.stdout.writeline( "Dimensions Filter Enabled: x=" + x + " y=" + y)
   VideoReDo.FileSetFilterDimensions x, y
end if

' Open output file and start processing.
 outputFlag = VideoReDo.FileSaveAs( destFile, profileName )
 outputXML = ""

if outputFlag = false then
   wscript.stderr.writeline("? Problem opening output file: " + destFile )
   wscript.stderr.writeline(outputXML)
   wscript.quit 4
end if

' Wait until output done.
while( VideoRedo.OutputGetState <> 0 )
  percent = "Progress: " & Int(VideoReDo.OutputGetPercentComplete()) & "%"
  wscript.echo(percent)
  if not fso.FileExists(lockFile) then
     VideoReDo.OutputAbort()
       endtime = DateAdd("s", 15, Now)
       while( VideoReDo.OutputGetState <> 0 And (Now < endtime) )
           wscript.sleep 500
       wend
     VideoReDo.ProgramExit()
     wscript.quit 5
  end if
  wscript.sleep 2000
wend

VideoReDo.ProgramExit()

' Exit with status 0
wscript.echo( "   Output complete to: " + destFile )
wscript.quit 0
I make no promises but it's working for me. I'll take a look at encode.vbs next as I think these 3 will be the most important. I'm personally curious about adscan.vbs but I won't have time to mess with that soon and that needs to be documented before i can really dig in. Hope this helps someone! And thanks very much for the support!

NOTE: These scripts will ONLY work for V6 VRD...which I'm assuming if you're here that's what you're looking for. ALSO, I removed support for Program Stream output because at this point in time, why do you want that in a qsfix? LOL Transport Stream and MP4 output is supported.

EDITS:

I've updated the qsfix.vbs script to simplify it even further. I made it quite straight forward. See notes above for limitations.
 
Last edited:

SamuriHL

Member
encode.vbs

Code:
set Args = wscript.Arguments
if Args.Count < 2 then
   wscript.stderr.writeline( "? Invalid number of arguments")
   wscript.quit 1
end if

' Check for flags.
VrdAllowMultiple = false
lockFile = ""
profileName  = ""
for i = 1 to args.Count
   p = args(i-1)
   if left(p,3)="/l:" then lockFile = mid(p,4)
   if left(p,3)="/p:" then profileName = mid(p,4)
   if p = "/m" then VrdAllowMultiple = true
next

' Check that a lock file name was given
if ( lockFile = "" ) then
   wscript.stderr.writeline( "? Lock file (/l:) not given" )
   wscript.quit 2
end if

' Check that a profile name was given
if ( profileName = "" ) then
   wscript.stderr.writeline( "? Profile name not given" )
   wscript.quit 2
end if

Set fso = CreateObject("Scripting.FileSystemObject")
sourceFile = args(0)
destFile   = args(1)

'Create VideoReDo object and open the source project / file.
if (VrdAllowMultiple) then
   On Error Goto 0
   On Error Resume Next
   Set VideoReDo = WScript.CreateObject( "VideoReDo6.Application" )
else
   On Error Goto 0
   set VideoReDoSilent = wscript.CreateObject( "VideoReDo6.VideoReDoSilent" )
   set VideoReDo = VideoReDoSilent.VRDInterface
end if

'Hard code no audio alert
VideoReDo.ProgramSetAudioAlert( false )

' Open source file
openFlag = VideoReDo.FileOpen(sourceFile, false)

if openFlag = false then
   wscript.stderr.writeline( "? Unable to open file/project: " + sourceFile )
   wscript.quit 3
end if

' Open output file and start processing.
outputFlag = VideoReDo.FileSaveAs( destFile, profileName )

if outputFlag = false then
   wscript.stderr.writeline("? Problem opening output file: " + destFile )
   wscript.quit 4
end if

' Wait until output done and output % complete to stdout
while( VideoRedo.OutputGetState <> 0 )
  percent = "Progress: " & Int(VideoReDo.OutputGetPercentComplete()) & "%"
  wscript.echo(percent)
  if not fso.FileExists(lockFile) then
     VideoReDo.OutputAbort()
       endtime = DateAdd("s", 15, Now)
       while( VideoReDo.OutputGetState <> 0 And (Now < endtime) )
           wscript.sleep 500
       wend
     VideoReDo.ProgramExit()
     wscript.quit 5
  end if
  wscript.sleep 2000
wend

VideoReDo.ProgramExit()

' Close VRD
VideoReDo.ProgramExit()

' Exit with status 0
wscript.echo( "   Output complete to: " + destFile )
wscript.quit 0
adscan.vbs

Code:
set Args = wscript.Arguments
if Args.Count < 2 then
   wscript.stderr.writeline( "? Invalid number of arguments")
   wscript.quit 1
end if

' Check for flags.
VrdAllowMultiple = false
lockFile = ""
for i = 1 to args.Count
   p = args(i-1)
   if left(p,3)="/l:" then lockFile = mid(p,4)
   if p = "/m" then VrdAllowMultiple = true
next

' Check that a lock file name was given
if ( lockFile = "" ) then
   wscript.stderr.writeline( "? Lock file (/l:) not given" )
   wscript.quit 2
end if

Set fso = CreateObject("Scripting.FileSystemObject")
sourceFile = args(0)
destFile   = args(1)

' Create VideoReDo object and open the source project / file.
if (VrdAllowMultiple) then
   On Error Goto 0
   Set VideoReDo = WScript.CreateObject( "VideoReDo6.Application" )
else
   On Error Goto 0
   set VideoReDoSilent = wscript.CreateObject( "VideoReDo6.VideoReDoSilent" )
   set VideoReDo = VideoReDoSilent.VRDInterface
end if

'Hard code no audio alert
 VideoReDo.ProgramSetAudioAlert( false )

' Open source file
 openFlag = VideoReDo.FileOpen(sourceFile, false)

if openFlag = false then
   wscript.stderr.writeline( "? Unable to open file/project: " + sourceFile )
   wscript.quit 3
end if

' Start Ad Scan
'VideoReDo.AdScanSetParameter 0, false
'VideoReDo.AdScanSetParameter 1, false
 VideoReDo.InteractiveAdScanSetParameter 2, true
 VideoReDo.InteractiveAdScanToggleScan()
 scanStarted = VideoReDo.InteractiveAdScanIsScanning()

if scanStarted = false then
   wscript.stderr.writeline("? Unable to start Ad Scan on file: " + sourceFile )
   wscript.quit 4
end if

' Wait until scan done and output % complete to stdout
 fileDuration = VideoRedo.FileGetOpenedFileDuration()
 while( VideoRedo.InteractiveAdScanIsScanning() )
    percent = "Progress: " & Int(VideoReDo.NavigationGetCursorTime()*100/fileDuration) & "%"
    wscript.echo(percent)
    if not fso.FileExists(lockFile) then
       VideoReDo.OutputAbort()
       endtime = DateAdd("s", 15, Now)
       while( VideoRedo.InteractiveAdScanIsScanning() And (Now < endtime) )
          wscript.sleep 500
       wend
       VideoReDo.ProgramExit()
       wscript.quit 5
    end if
    wscript.sleep 2000
 wend

' Write output project file
 VideoReDo.FileSaveProjectAs(destFile)

' Close VRD
 VideoReDo.ProgramExit()

' Exit with status 0
wscript.echo( "   Output complete to: " + destFile )
wscript.quit 0
EDITS:

-Tested encode. Works
-Added adscan and tested. Also works.
 
Last edited:

Dan203

Senior Developer
Staff member
Yup, that's exactly what I'm working on right now. I ripped out all the v4 crap to simplify this a bit and am working on profiles now. It's attempting to match the source it's NOT trying to encode anything in this particular script. It's just a qsfix. So I'm working on rewriting it to work with v6. You're saying I don't need the profiles at all if I just want to match source?
You don't need the specific MPEG2 or H264 parts of the profile. All profiles in v6 are match source so you can just use the "Transport Stream" profile and it'll pick MPEG-2 or H.264 automatically based on the source. The profile IDs have also changed. Although I'm not sure what he's using those for. I don't think we use profile IDs as input on any of the functions. Just the name or full XML of the profile.

There are also some tricks with the COM you could use. If you provide no profile at all it will attempt to pick a profile based on the extension of the output file. So if the output file is video.mp4 it'll pick the first profile that uses the .mp4 extension. There is also a hidden option where if you pass "sas" as the profile name it'll actually automatically find the profile that most closely matches the source file. This works for both codec and format. So if you pass in an H.264 .tivo file it will output an H.264 .tivo file.
 
Top Bottom