Creating a video from stills using VirtualDub and AviSynth

Prompted by a request for help from Neven. A step-by-step guide to turn a sequence of images into a video.

Download VirtualDub and unzip it to where you lateron want to use this program.

Download and install Avisynth. It is a frame server for VirtualDub and is working by passing an avs-script to VirtualDub. Documentation can be found in the project’s wiki, you can skip that for now.

Download the images you want to process and organize them in subfolders.

Copy and paste the following script into a text-editor and save the file in the base folder of your image data using an extension ‘.avs’

## read in a series of images. the substring "%03d" is place holder for a zero-padded three-digit number. it will run from 111 to 114. the frames will be shown at 5 frames per second
v1=ImageReader(file = "vid1\Arctic_r05c03.2010%03d.terra.4km.jpg",start = 70, end = 177, fps = 5)
## you could have a second set of images you want to show alongside the first clip
# v2=ImageReader(file = "vid2\img%d.jpg",start = 0, end = 21, fps = 5)
## Have a single image span a series of frames, e.g. as backdrop for subtitles.
# v3=ImageSource(file = "footer.jpg", start = 1, end = 21, fps = 5)

## Stack the named clips. The need to be of the same width. StackHorizontal stacks in horizontal direction, here clips need to have the same height. A stacked clip is again just one clip, so you can use a series of stack commands to assemble a table of clips.
# StackVertical(v1,v2,v3) ## This command would stack the three videos above and return it as the current clip

## set v1 to be the current clip
v1

## subtitles need to be done one at a frame, see documentation for the "align" paramenter. Best done in a spreadsheet and copied here.
subtitle("day 111", align=2, first_frame=0, halo_color=$00FF00FF, text_color=$0000FF00, size=36, last_frame=0)
subtitle("day 112", align=2, first_frame=1, halo_color=$00FF00FF, text_color=$0000FF00, size=36, last_frame=1)
subtitle("day 113", align=2, first_frame=2, halo_color=$00FF00FF, text_color=$0000FF00, size=36, last_frame=2)
subtitle("day 114", align=2, first_frame=3, halo_color=$00FF00FF, text_color=$0000FF00, size=36, last_frame=3)

Adapt the filename-mask and parameters in the second line (starting “v1=ImageReader”) to match your images. Adapt the subtitles.

Start VirtualDub and open that avs-script. Select ‘Audio/No Audio’, select ‘Video/Compression…’ and select a codec like “Microsoft Video 1” or XVid (the latter requires an extra download and install). Select ‘File/Save as AVI…’ and enjoy the result.

Now for more detailed explanations. The syntax for the commands used in the script can be found at the wiki: ImageReader/ImageSource (IR for multiple, IS for single images) and Subtitle. Each command creates a clip, i.e. a sequence of frames. It can either be assigned to an identifier (e.g. “v1”) or simply put out as the current clip. The script needs to end with a clip, so the last line needs to be a command or a clip identifier. “#” comments out lines. Commands act either on the clip named as the first parameter or the current video. As long as parameters are left in the correct order, you can drop the descriptors, like so:

v1=ImageReader("vid1\Arctic_r05c03.2010%3d.terra_4km.jpg", 111, 114, 5)
# v2=ImageReader("vid2\img%d.jpg",start = 0, 3, 5)
# v3=ImageSource("footer.jpg", start = 0, 3, 5)

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Creating a video from stills using VirtualDub and AviSynth

  1. Neven says:

    Bluegrue, thanks for this great tutorial! Coincidentally I have both applications on my computer already, having used them for ripping DVDs. The animated gifs I’m making are working now (like this one), but I’ll be sure to use this trick if I want to make larger animations.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s