Introducing: ViDBuG

About a year ago I had a video project to work on.  I wanted to take two videos and combine them.  In some parts of the video would be split screen showing parts of both videos at the same time.  I also had to do a lot of time line editing.  Finally, I wasn’t actually going to spend actual money on this project.  Sounds simple enough, right?

What I discovered was that there wasn’t much open source software to do what I wanted.  I tried a few things and was never satisfied until I discovered an open source program called AVISynth.  This program was capable of doing everything I wanted to do and far more.

AVISynth uses a scripting language to explain how to manipulate a video.  AVISynth is itself a frameserver, that is a little app that allows you view the video output of these scripts in any video player that supports AVI files.  I was a little uneasy about using a scripting language instead of GUI, but I am familiar with programming and hey, this program does everything I was looking for.

I quickly got annoyed with the scripting language.  I was able to write code for it easy enough and it usually did what was expected.  Unfortunately, with the large amount of time line editing I was doing, mixed with some other effects, my script was somewhat long.  AVISynth only displays the last video described by the video.  Logically there are a number of different videos created as intermediate steps in the processing.  Exactly what happens in these intermediate steps can only be inferred from the final result, possible modified by other steps.

What was missing here is a debugger.  Something that would let me stop everything in the middle and see what those intermediate videos look like.  I finished up the project without it, but the problem of debugging these scripts stuck with me and I thought about how it could be done.

The AVISynth script is repeated for every frame.   This is a problem because a typical debugger requires you to stop everything at some point.  The ideal thing, though would be to be able to see multiple frames at a breakpoint.  Esentially, you want to run to a breakpoint, create the frame, then go back to the beggining to create the next frame.  A classic debugger won’t work well.

Eventually, what I came up with was a display of each step of the process.  I would have to parse the script and allow the user to expand each step.  I decided that a filmstrip which shows a sample of the images from the video would be easier to use than a bunch of little video players all over the place.  This presents a bit of a problem.  There can be dozens of steps and to represent the step I would need around 10 images.  Maybe more.  With hundreds of images on the screen it can become a mess quickly.

sketch.PNG Around this time I heard about a programming environment designed to introduce children to programming called Sketch.  In Sketch (and many similar visual programming environments) programs are created by connecting blocks that preform different functions.  I thought this would be an interesting idea for an AVISynth editor.

Combining these two ideas I came up with an editor for AVISynth files that would show you every step of the process so you can quickly verify that what you are creating actually does what you think it will.  The resulting application is both an editor and a debugger.  If you prefer editing directly in script, you can open it with this app and see what its doing, or you can take the Sketch approach and connect filters to create the video you want.

vidbug.PNG

I’ve spent some time working on this project over the past year.  Usually it fell to the side for months at a time.  I decided last week to get it finished to the point where I can open source it.  It is not quite ready to be used as an editor and it will be a long time before it will be able to debug any AVISynth file.  Hopefully, what is available is enough to give people an idea of what I am creating.

I’ve open sourced the code.  It can be found on sourceforge.  You can download the .msi file and install it on your computer, or you can download the source file and take a look at the code.  I’ve also created a wiki homepage to document the project.

Leave a Reply