My workflow for Magic Lantern RAW on the Canon 7D

As some of you may know, I’m a late adopter of the Canon 7D, and with the recent Magic Lantern brakthrough of enabling that DSLR to shoot 14-bit RAW footage, I decided to jump onboard.

The image quality is great, the colors are incredible, and the workflow isn’t that bad, although I do prefer working with footage natively, instead of having to transcode. However, with the available tools, transcoding is not that bad at all.

I’m only able to shoot short clips, as the current Magic Lantern (I’m running the 09-29-2013 version):

Here is a .RAW sample file and the comparable .MOV in H.264 so you can see the difference. It’s just a simple shot, but you can really tell the difference:

Unfortunately, at the moment, we can only shoot RAW continuously at very low resolutions, or for a few seconds at higher resolutions, but even at the highest resolution on the 7D, it’s not 1920×1080, but it looks pretty good, even when blown up. I also didn’t have a very fast card (only 400x) so I was very limited. I’ve since ordered a 1000x card and hope to get longer recording times.

I’m still gunning for a Blackmagic Design Pocket Cinema Camera, but fully intend to keep my Canon 7D. I may end up selling my trusty Panasonic HVX200 which has been lying forgotten in a closet. My reasoning is that if I just want something simple for the web, the 7D is plenty capable of delivering with an easier workflow, and with more manageable file sizes. For something more cinematic or with more color grading I’ll end up using the BMPCC. I also love the idea that my old Minolta lenses will have a new lease on life 🙂

And I’m looking forward to throwing some Super 16mm lenses on it, and see what I can get!!

But I digress… to simplify my workflow with .RAW Magic Lantern footage, I decided to put together a little VBScript (you know me, I’m a “technologist”) to allow me to transfer the files from the card to a computer and automatically convert them to .DNG or CineForm .AVI. I have to add another option to do both at the same time, because the Cineform .AVIs are really small and look very decent – but make editing much quicker, and eliminate the need to open the .DNG files in Resolve 10 Lite (which is a bear on resources and takes a while to start up on my machine). With the .Cineform AVIs I can start up Lightworks and start editing right away.

The script was written in such a way that all you have to do is keep it on your Desktop, then open up the card and then drag and drop the footage onto the script’s icon.

The script will then ask you for a Project Name, which is essentially going to become the ReelName (EXIF tag) for all the .DNG files, which Resolve and Lightworks both use.

Then you get a dialog asking where to put the files. You can create a new folder for the project, or select an existing one. The script will create a subfolder for each of the .RAW files, and with the same name, and will extract the .DNG files into the same subfolder.

Then the script starts copying all the .RAW files and notifies you when done. At this point you can erase the card manually, and put it back in the camera while the computer will convert them .RAW into .DNGs or .AVIs depending upon your selection.

I wonder if an option to delete the .RAW files would be useful?

You’ll get some command windows popping up with the RAW2DNG progress for each individual clip, and another for the EXIFTOOL which will add the ReelName tag to all the .DNGs

I normally like to create a new Reel for each Magazine instance, e.g. 1 per camera, per use. So, the first Mag from A cam would be Mag AA, the second would be Mag AB, etc. (even if it’s physically the same card). Mag BA would be the first mag from B cam.

So, the idea is that when you’re on set, you can dump the .RAWs and get the card back as fast as possible. You definitely want a fast card AND a fast reader for this.

[EDIT: if you can’t find RAW2DNG for windows in the link below, you can get it here: RAW2DNG for Windows]

You will also need to download RAW2DNG and the free version of the GoPro Studio which includes the CineForm tools used by this script. If you have the Pro Version, you can get the CineForm option to be -444 instead of -422 to get better color depth. But that’s only good if you’re planning on editing and exporting the .AVIs instead of sending the .DNGs to Resolve for very versatile and powerful color grading (if you’re on the Lite version like me, you don’t have access to the Denoiser, which is a shame).

At any rate, here is the code for the script — copy and paste this into a new Text file and name it something like: MLRAWCONV.VBS (you can also click here to download the file MLRAWCONV – compressed with 7Zip)

'Batch file to Copy and Convert ML Raw footage to a specified location using drag and drop
' By Val Gameiro
Option Explicit

Dim arg, newarg(), projname, destfolder, subfolder, wshShell, i, response, objShell, objFolder, objFolderItem
Dim bullit, intIndex, argcount
Set arg = WScript.Arguments
bullit = Chr(10) & " " & Chr(149) & " "
argcount = arg.Count

' Input Magazine name for EXIFTOOL - Create folder in Browse Folder dialog (Folder = Project)
projname = UserInput( "Enter Magazine Name for EXIFTOOL tagging (e.g. Test Shoot Mag A): " )
If projname = "" Then WScript.Quit

' Select where to store the files and conversions
Const DESKTOP = &H10&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(DESKTOP)
Set objFolderItem = objFolder.Self
'Wscript.Echo objFolderItem.Path
destfolder = BrowseFolder( "objFolderItem.Path", False )
If destfolder = "" Then WScript.Quit

' Select Conversion option
 response = InputBox("Select conversion format:" & Chr(10) & bullit & "1) CinemaDNG (RAW2DNG)" & bullit & "2) GoPro CineForm .AVI compressed" & bullit & "4) Quit" & Chr(10), "Enter option number:")
 If response = "" Then WScript.Quit 'Detect Cancel
 If IsNumeric(response) Then Exit Do 'Detect value response.
 MsgBox "You must enter a numeric value.", 48, "Invalid Entry"
If response = 4 Then WScript.Quit
'MsgBox "The user chose :" & response, 64, "Yay!"

' Copy files and notify it's done, so user can remove card
Set wshShell = WScript.CreateObject ("")
i = 0
ReDim newarg(argcount)
Dim components, objFileCopy, objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")

While i < argcount
 components = Split(arg(i), "\")
 subfolder = "\" & Left(components(Ubound(components)), InStrRev(components(Ubound(components)), ".")-1)
 ' Create FileSystemObject. So we can apply .createFolder method
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 ' Here is the key line Create a Folder, using strDirectory 
 If Not objFSO.FolderExists(destfolder & subfolder) Then
 Set objFolder = objFSO.CreateFolder(destfolder & subfolder)
 End If
 'MsgBox "xcopy """ & arg(i) & """ " & """" & destfolder & """" & " /V /Q"
 wshshell.Run "xcopy """ & arg(i) & """ " & """" & destfolder & subfolder & """" & " /V /Q", 4, True
 'MsgBox "Error: " & Err.Number
 If Err.Number = 0 Then 
 newarg(i) = destfolder & subfolder & "\" & components(Ubound(components))
 'Wscript.Echo "File name: " & newarg(i)
 ' Uncomment the next line to automatically delete the source file
 End If
 i = i + 1
Msgbox "Files have been copied, you can now erase and remove the card/media"

' Convert files
' Include option to put DNGs in Subfolder, or same folder as .RAW
i = 0
Dim fullfilename, filename, tofile, filepath
While i < argcount
 Select Case response
 Case 1 ' Using RAW2DNG
 components = Split(newarg(i), "\")
 fullfilename = components(Ubound(components)) 'including .ext
 filename = Left(fullfilename, InStrRev(fullfilename, ".")-1)
 'filepath = Replace(newarg(i), fullfilename, "")
 'MsgBox "md """ & filepath & "DNG"""
 tofile = Replace(newarg(i), fullfilename, filename)
 'wshshell.Run "md """ & filepath & "\DNG"""
 'tofile = Replace(newarg(i), fullfilename, "DNG\" & filename) 
 'MsgBox fullfilename & " / " & tofile & "-"""
 'MsgBox "raw2dng """ & newarg(i) & """ " & """" & tofile & "-"""
 'wshshell.Run "%comspec% /k " & "raw2dng """ & newarg(i) & """ " & """" & tofile & "-"""
 wshshell.Run "raw2dng """ & newarg(i) & """ " & """" & tofile & "-""", 4, True
 'MsgBox "exiftool -v1 -ReelName=" & """" & projname & """" & " *.DNG -overwrite_original_in_place"
 wshshell.Run "exiftool -ReelName=" & """" & projname & """" & " *.DNG -overwrite_original_in_place", 4, True
 Case 2 ' Using RAW2CF from CineForm Tools 422
 components = Split(newarg(i), "\")
 fullfilename = components(Ubound(components)) 'including .ext
 filename = Left(fullfilename, InStrRev(fullfilename, ".")-1)
 'filepath = Replace(newarg(i), fullfilename, "")
 'MsgBox "md """ & filepath & "DNG"""
 tofile = Replace(newarg(i), fullfilename, filename)
 'MsgBox fullfilename & " / " & tofile & "-"""
 'MsgBox "raw2gpcf """ & newarg(i) & """ " & """" & tofile & ".avi"""
 wshshell.Run "raw2gpcf """ & newarg(i) & """ " & """" & tofile & ".avi""", 4, True
 End Select
 i = i + 1

' House cleaning
Set arg = Nothing

Function BrowseFolder( myStartLocation, blnSimpleDialog )
' This function generates a Browse Folder dialog
' and returns the selected folder as a string.
' Arguments:
' myStartLocation [string] start folder for dialog, or "My Computer", or
' empty string to open in "Desktop\My Documents"
' blnSimpleDialog [boolean] if False, an additional text field will be
' displayed where the folder can be selected
' by typing the fully qualified path
' Returns: [string] the fully qualified path to the selected folder
' Based on the Hey Scripting Guys article
' "How Can I Show Users a Dialog Box That Only Lets Them Select Folders?"
' Function written by Rob van der Woude
 Const MY_COMPUTER = &H11&
 Const WINDOW_HANDLE = 0 ' Must ALWAYS be 0

Dim numOptions, objFolder, objFolderItem
 Dim objPath, objShell, strPath, strPrompt

' Set the options for the dialog window
 strPrompt = "Select a folder to store files:"
 If blnSimpleDialog = True Then
 numOptions = 0 ' Simple dialog
 numOptions = &H10& ' Additional text field to type folder path
 End If

 ' Create a Windows Shell object
 Set objShell = CreateObject( "Shell.Application" )

' If specified, convert "My Computer" to a valid
 ' path for the Windows Shell's BrowseFolder method
 If UCase( myStartLocation ) = "MY COMPUTER" Then
 Set objFolder = objShell.Namespace( MY_COMPUTER )
 Set objFolderItem = objFolder.Self
 strPath = objFolderItem.Path
 strPath = myStartLocation
 End If

Set objFolder = objShell.BrowseForFolder( WINDOW_HANDLE, strPrompt, _
 numOptions, strPath )

' Quit if no folder was selected
 If objFolder Is Nothing Then
 BrowseFolder = ""
 Exit Function
 End If

' Retrieve the path of the selected folder
 Set objFolderItem = objFolder.Self
 objPath = objFolderItem.Path

' Return the path of the selected folder
 BrowseFolder = objPath
End Function

Function UserInput( myPrompt )
' This function prompts the user for some input.
' When the script runs in CSCRIPT.EXE, StdIn is used,
' otherwise the VBScript InputBox( ) function is used.
' myPrompt is the the text used to prompt the user for input.
' The function returns the input typed either on StdIn or in InputBox( ).
' Written by Rob van der Woude
 ' Check if the script runs in CSCRIPT.EXE
 If UCase( Right( WScript.FullName, 12 ) ) = "\CSCRIPT.EXE" Then
 ' If so, use StdIn and StdOut
 WScript.StdOut.Write myPrompt & " "
 UserInput = WScript.StdIn.ReadLine
 ' If not, use InputBox( )
 UserInput = InputBox( myPrompt )
 End If
End Function

Let me know if you need any help with this, or want some simple changes made!

This will only run on machines that have the Windows Script Host installed (you can download it separately, but Windows 7 and up come with it by default)