Convert 4:3 DV AVI files to 16:9 in Windows

Written by Jarno Elonen <elonen@iki.fi>, jan 2010, released into the Public Domain

The following VB script uses the Enosoft DV Processor (on Windows) to convert/reset the aspect ratio flag of all .AVI files from 4:3 to 16:9 in the directory where the script is executed (losslessly, without any recompression). It writes the modified files to a subdirectory "out/", which must exist.

' Batch VB script to change aspect ratio of AVI DV files to 16:9
' using Enosoft DV Processor (in Windows).
' The script processes all .AVI files in the execution directory
' and makes 16:9 copies into folder ".\out" (that must exist).
'
' Written by Jarno Elonen <elonen@iki.fi>, 20010-01.
' Released into the Public Domain.

Set fso = CreateObject("Scripting.FileSystemObject")

Set folder = fso.GetFolder(".")
Set files = folder.Files
For each folderIdx In files
  If InStr(folderIdx.Name, ".avi") > 0 Then

    Dim App
    Set App = CreateObject("EnoDVProcessor.EnoDV2DVApplication.1")
    App.Visible = True
    App.Caption = "Setting AR 16:9 for " & folderIdx.Name

    App.AVIInputDisableSeeking = True
    App.EmbeddedEnable = True

    App.InputAsFile = fso.GetAbsolutePathName(folderIdx.Name)
    App.SetOutputAsFile fso.GetAbsolutePathName("out\" + folderIdx.Name), False, True

    App.EmbeddedAspectRatioEnable = True
    App.SetEmbeddedAspectRatioConfig False, 2 ' IEC16x9FullFormat

    App.AVIInputDisableSeeking = True
    App.EmbeddedEnable = True

    ' start processing
    App.RunProcessor
    ' wait for the processor to stop by polling the graph state every few seconds
    Do Until App.ProcessorGraphState = 0
      WScript.Sleep 1000
    Loop

    App.Quit

  End If
Next