VRD Open Source Framework in C#

I was toying around with Harry's Tools 2 and the new feature to host VideoReDo itself. It turned out that it doesn't work as expected. Well, it does work, but every now and then there's a glitch that i don't think is satisfactory like e. g. the logging window suddenly disappers behind the main window. Long story short: i'm revamping the main GUI.

However, the VideoReDo class that i'm using is polished & finished and there's no reason not to share the framework. So everyone who's interested and who wants to use some code of it or make their own framework, feel free to get it from here:


The code is made for C# and .Net 2.0. You can download Visual Studio 2005 for C# free from MS.

I hope you show your work as well if you create something from it ;)

The usage however is of course at your own risk. I take no responsibility for anything.

I included also a sample main project, but all you need is the VideoReDo.cs and the Logging.cs class. Don't worry about some of the dummy-code like e. g. the Logging.cs, it's only a necessary implementation so that the VideoReDo.cs works in another project, i. e. separated from my Tools.

Feel free to ask if you have questions.

Quick usage examples:

create a new VideoRedo instance to toy with:

VideoReDo vrd = new VideoReDo();
simulate play button:

add scene marker:

start ad scan:

write project file:

... and so on, just check the methods in VideoReDo.cs ...

Cheers :)
Last edited:
The hosting site for this project is no longer available. Can I retreive the files elsewhere? I am trying to use the COM object in VS 2008.
Referencing VRD COM in VS2005

I don't reference VRD into C# in TVAP, although I might have done it that way if I had known how 8 months ago. (Instead TVAP launches VB Scripts running in Windows Scripting Host.)

However I believe I've found out how to do it. As others reported in this thread I first tried the VS2005 referencing wizard on videoReDo.tlb and it wouldn't work. Then I used tlbimp.exe. That provides a managed class library interface with Intellisense and Object Browser info. It would compile but I always got the run time error about "Unable to cast COM object ... etc."

What still seems to be needed, I finally learned, was to "register the type library." After I did this (by running "regtlib.exe videoReDo.tlb" in a command window logged to the VRD folder) everything started working. All I've done so far is simple things per the following code snippet:

            VideoReDoSilentClass vrds = new VideoReDoSilentClass();
            IVideoReDo vrd = (IVideoReDo)vrds.VRDInterface;

            bool rv = vrd.FileOpenBatch(mVideoUrl);
            if (rv)
                //double duration = vrd.GetProgramDuration();
                //MessageBox.Show(String.Format("Duration = {0:0.00} seconds", duration));
                string outPath = Path.ChangeExtension(mVideoUrl, ".mpg");
                int sleepSeconds = 0;
                rv = vrd.FileSaveAsEx(outPath, 1);
                while(rv && vrd.IsOutputInProgress())
                MessageBox.Show(String.Format("Output took {0} seconds", sleepSeconds));
                MessageBox.Show("Failed to open file in VRD");
Where mVideoUrl was a path to a .tivo file in my case.

Registering a .tlb is something any decent installer can do, I believe.

There may be issues about disposing although so far I've not seen a VRD process stay running after shutting down the C# program -- unless there was an error. As a worst case it's not too hard to access the running processes from C# and shut one down if you need to.

I haven't tried the other approach defined by Harry in this post.. However I suspect you don't get the Intellisense/Object Browser help with that approach. On the other hand he does give some code for disposing.
Last edited:
More on RCW for VRD

RCW = Runtime Callable Wrapper.

Instead of regtlib.exe, use regtlibv12.exe to register the VideoReDo.tlb type library. Regtlib is not present on all systems while regtlibv12 is part of the .NET 2.0 installation. (In C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727). It also has the advantage that it can uninstall a .tlb. There is no help and almost no documentation for the program. But to register you just use:

regtlibv12 <path>/videoReDo.tlb

To unregister you just add -u

regtilbv12 -u <path>/videoReDo.tlb

You get a message indicating success or failure. You can tell whether a type lib is registered by searching the registry for the file name. If it's registered you will find it in My Computer\HKEY_CLASSES_ROOT\TypeLib. Note the GUID.

I've found that I can put the .tlb for TVSuite 558 in any folder and register it, and code using the RCW created from that version will operate correctly even on a computer that has only VRD Plus installed. I suspect there would be runtime errors if the code called one of the COM functions that have been added only to TVSuite. (E.g. adjust audio sync).

The Inno Setup installer that I use for TVAP does a good job of registering the .tlb (and unregistering upon uninstall). This is on XP Pro, SP2.

I haven't found a way to suppress the startup hints or check-for-updates messages with the RCW, whereas these don't appear when running silently from scripts. Of course these can be de-activated manually beforehand. There probably are registry settings that the C# program could alter to turn these off (and reset them when done).

And you can get message boxes directly from VRD if a file open fails, for example. If I remember correctly, these can occur also during script operation in the silent mode.

All in all, I see no barrier to prevent direct control of VRD in silent mode from C# programs built with VS2005, although I haven't tested all the COM functions.