Summary
Following my conclusion that
Première Pro CS3 cannot do a proper YUV workflow with HDV Progressive footage, I decided to figure out a way to convert my entire project to RGB
after I created it in a normal YUV workflow
(because YUV's the only way to get fluent HD playback during editing - reasonably crucial, and RGB is the only way to export superwhite in a final movie).
lordtangent @ HV20.com hinted about this plugin that allows you to import
.avs into
Première Pro CS3:
VideoEditorsKit.SourceForge.net. Still, I decided to do
Visual Basic Scripting in order to provide Batch Conversion. Turns out
VBScript's grammar sucks major bad coffee, so it took me more time than I dare to admit anyway. But let me explain the workflow, it can save valuable time.
Workflow
-update-
Recent updates to Windows XP cause the .vbs file not to run in Command Prompt mode. If messages appear in Windows-style popups, you're doing it wrong. Make sure you use Command Prompt mode, and ironically, just entering the command in the command line launches Windows mode (AKA wrong).
You either type in the command prompt: cscript filename.vbs
or right-click the .vbs file, choosing "Open with Command Prompt". Here's the situation: I've got this big ass project in
Première and I want to replace all
.m2t sources with
.avs ones that DO PROPER RGB CONVERSION.
The
VBScript is based on
Farnsworth @ HV20.com's
hints about
DGIndex' command line support. Ironicly his line of script almost does the same as the following kilobyte of script, but if you know some (Visual) Basic, you can do some major tweaking in this one.
Code-quoting is something I did not implement very nice on my website yet. Download the code with correct markup at the bottom of this article. Here's a
template in my
DGIndex directory:
RED HV20 709.avs## RED DGDecode Template
## Decode from HV20 709, cropping bad supers
##
## By Redsandro
## 2008-04
## http://www.REDnet.nl/en/
# Default - Open for export (quality - slow)
v=DGDecode_MPEG2Source(d2v="__vid__", iDCT=5)
# Preview - Open for playback (optimized - fast)
#v=DGDecode_MPEG2Source(d2v="__vid__", iDCT=3)
a=MPASource("__aud__")
AudioDub(v,a)
DelayAudio(__del__)
# 709 RGB Conversion
ConvertToRGB(matrix="PC.709", interlaced=false)
# HV20 based levels
Levels(16, 1, 253, 0, 255, coring=false)
# Resize to full-HD
Lanczos4Resize(1920, 1080)
Here's the
Visual Basic Script to put the directory with a bunch of
.m2t's that you use as footage for your project:
DGIndex.vbs'' RED DGIndex script
'' DGindex a whole bunch of files
''
'' By Redsandro
'' 2008-06-30
'' http://www.REDnet.nl/en/
' Usage:
'
' Edit DGIndex and DGTemplate below to point to the correct files
' Copy DGIndex.vbs to the directory containing your M2T files
' Start DGIndex.vbs by either double-clicking or entering the name in a command prompt (to DGIndex all files)
' or:
' Enter DGIndex.vbs -v in the command prompt to decide for every file whether to DGIndex it or not.
Option Explicit
On Error Resume Next
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
Dim arg, args, currentFolder, newFolder, fileDone, fileSkip, fileOther
Dim argVerbose: argVerbose = False
' Set this to your DGIndex executable.
Dim DGIndex: DGIndex = "D:\Software\Video\Tools\DGIndex\DGIndex.exe"
' Set this to your DGIndex AVS template.
Dim DGTemplate: DGTemplate = "D:\Software\Video\Tools\DGIndex\RED HV20 709.avs"
' Set this to the subdir name you want to create for storing DGIndexed files. One level only, no slashes allowed. Do not leave empty. DGIndex will crash.
Dim destPath: destPath = "DGIndex"
' Begin
Main
Sub Main
' set globals
Set currentFolder = fso.GetFolder(".")
fileDone = 0: fileSkip = 0: fileOther = 0
' Get arguments
Set args = WScript.Arguments
For Each arg in args
If arg = "-v" Then argVerbose = True End If
Next
' Begin output
WScript.Echo "DGIndex'ing all files in the following directory: "
WScript.Echo currentFolder.Path
If argVerbose = True Then WScript.Echo "-v Verbose Mode enabled."
WScript.Echo ""
If Not promptYesNo("Continue? (y/n): ") Then Exit Sub
WScript.Echo ""
' Duh
parseFolder currentFolder
' Pause so the promt doesn't close immediately
WScript.Echo fileDone & " files indexed, " & fileSkip & " files skipped and " & fileOther & " files not MPEG."
WScript.Echo "Press ENTER to exit."
Do While Not WScript.StdIn.AtEndOfLine
Dim Input: Input = WScript.StdIn.Read(1)
Loop
WScript.Echo "Done."
End Sub
Sub parseFolder (ByVal Folder)
' Create subdir for DGIndex files
newFolder = Folder.Path & "\" & destPath
If Not fso.FolderExists(newFolder) Then
fso.CreateFolder(newFolder)
End If
' Prepare vars
Dim Files: Set Files = Folder.Files
Dim File
' Loop through dir
For Each File In Files
Dim fileBase: fileBase = fso.getBaseName(File)
Dim fileExt: fileExt = fso.getExtensionName(File.Name)
Select Case UCase(fileExt)
Case "M2T","MPG","MPEG","VOB" doDGIndex File
Case Else fileOther = fileOther + 1
End Select
Next
' Uncomment following if you want to include subfolders (untested
)
'Dim SubFolders: Set SubFolders = Folder.SubFolders
'Dim SubFolder
'For Each SubFolder In SubFolders
' parseFolder SubFolder
'Next
End Sub
Sub doDGIndex (ByVal File)
WScript.Echo File.Name & "..."
If argVerbose = True Then
If Not promptYesNo("DGIndex this file? (y/n): ") Then
fileSkip = fileSkip + 1
Exit Sub
End If
End If
run DGIndex & " -IF=[" & File.Path & "] -OF=[" & newFolder & "\" & fso.getBaseName(File) & "] -AT=[" & DGTemplate & "] -EXIT"
fileDone = fileDone + 1
End Sub
Function promptYesNo (ByVal strMsg)
Do
WScript.Echo strMsg
Dim key: key = WScript.StdIn.ReadLine()
Select Case LCase(Trim(key))
Case "n","no" promptYesNo = False: Exit Function
Case "y","yes" promptYesNo = True: Exit Function
End Select
WScript.StdOut.WriteLine "Just enter 'y' or 'n'..."
Loop
End Function
Sub run(ByVal executable)
'WScript.Echo "Executing: " & executable
Dim shell: Set shell = CreateObject("WScript.Shell")
shell.Run executable, 1, true
Set shell = Nothing
End Sub
Double-click the script and blam, there you have a sub-directory
DGIndex with them
.avs files.
Now for replacing all the
.m2t in the world
(read: in your big project) with
.avs, don't worry about hundred clicks. We're smart.
Open your
.prproj Première Project File in a regular expression capable text editor such as
Notepad++ and you'll see it's sort of an xml file. Fire up your
regexp search-and-replace and use these values:
Find:
<FilePath>(.+)\\([^\\]+).m2t</FilePath> Replace:
<FilePath>\1\DGIndex\\2.avs</FilePath> Save your project
(under a different name), open up in Première, export the timeline
(perhaps as RGB Lagarith .avi for external compressing) et voilà, SUPERS ARE FINALLY THERE!
Copy-paste uncool?
Download the files here:
DGIndex-vbs.zip -update- 2009-07-31
Here's an updated version of the script that allows you to right-click a folder to DGindex all contents at once:
DGIndex-Folder-02b.zip You'll need to add the following to your registry:
HKEY_CLASSES_ROOT\Directory\shell\DGIndexFolder\
@ = DGIndex Folder
HKEY_CLASSES_ROOT\Directory\shell\DGIndexFolder\Command\
@ = cscript.exe D:\Software\bin\DGIndexFolder.vbs "%1"
You know that
@ = means default value, right?

And ofcourse, you can change the first value (right-click command name) to your liking and you need to change the second value to the location of the file on your machine.
I don't do pulldown and any other fancy stuff in the script. Feel free to update the scripts to your liking. If you have problems, please try to find solutions yourself and post them in the comment section. If you make this script into something cooler, please post those changes as well!
