Adding video delay in PixelConduit

When working with live video, the aim is usually to keep delay to a minimum. However it’s fairly common that we end up doing the opposite: adding delay in some parts of the system to compensate for a delay that we can’t eliminate elsewhere.

PixelConduit doesn’t have a built-in “Video Delay” node widget. But that’s no obstacle — we can create it with literally just two clicks of the mouse.

In the Project view, create a Scripted Effect node widget. (This happens by drag’n'dropping from the node box on the left-hand side of the window.) Connect the Scripted Effect between your video source and display output:

Screenshot of the Project view

In this screenshot I’m using a video file as the source, but of course it would be more common that you’d want to delay a live video input… I just wanted to show that this effect isn’t exclusive to live video.

You’ll see the Viewer blank out, as the Scripted Effect isn’t rendering anything useful by default. We’ll fix this in a second.

Click on the “Edit Script” button in the Scripted Effect node widget. This opens the Script Editor window. At the top of the window, click on the Favorites button and choose “Frame delay” from the list:

Screenshot of Script Editor

That’s it! Our custom “Video Delay” node widget is ready to use.

Look back in the Project window, and you’ll note that the user interface of the Scripted Effect node widget has changed:

Screenshot of project view

The script that we loaded has created a slider for controlling the delay. This is obviously handy — now ¬†we don’t need to edit the script to modify this elementary parameter.

It’s not just sliders either; you can create very complex user interfaces in a script node widget too. They can include buttons, labels, custom drawing areas with images… For some examples, have a look at the example templates that are provided with PixelConduit: in the Welcome screen, look for the “Movie Deck” and “Jittered 3D Layer” templates.

What about performance? You may be wondering if this scripted “Video Delay” effect is much slower than it a built-in effect would be. Luckily that’s not the case. The effect is written using PixelConduit’s Surface API and it makes full use of the GPU for storing the video frames. So, everything renders essentially as fast as it would be in native code. If you’re interested in how it works, have a look at the source code in the Script Editor — it’s fairly well commented.

I’m looking for ideas to cover on this blog. Do you have anything in mind that you’d like to see done in PixelConduit using a script or otherwise? Let me know! You can post a comment here, or why not post on the PixelConduit discussion forum and feedback channel.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>