Archive for May, 2010

Intermediate Usage of the Matrox MPEG-2 I-Frame HD Codec

UPDATE: A different, simpler way to convert to Matrox’s AVI.

UPDATE 2: Make sure you don’t have both Matrox AVI and a Cineform decoder installed on the same PC, at the same time. When you do that, you’ll get red/black frames and crashes with recent Vegas versions. So only have installed one or the other, depending on your project.

I’ve been suggesting either Cineform or Avid DNxHD to transcode into for your dSLR/AVCHD slow footage, but Matrox just released this bug-fixed version of their intermediate codec, that is pretty good too. It’s free, and faster than DNxHD, but not as fast as the $100 Cineform. DNxHD works on a Mac too though. So if you’re PC-only, and you have no money for Cineform, this might be your best option.

1. Install the Matrox codecs from here.

2. Install the latest 32bit Avisynth from here.

3. Install the latest DirectShowSource plugin, by manually placing it on Avisynth’s “plugins” folder (usually C:\Program Files\Avisynth 2.5\plugins\, or Program Files (x86)).

4. Install the latest full version of AC3Filter.

5. Install the MatroskaSplitter (aka Haali Media Splitter).

6. Install the 32bit version of VirtualDub. Do not use the 64bit version.

7. Install the latest ffdshow-tryouts version. Make sure that avisynth and virtualdub plugins are checked, and h.264 decoding is enabled too (it will ask you all that during installation). If you already have CoreAVC installed, you might either want to skip this step, or you can still install it (if you can’t get sound to work) but disable h.264 decoding.

8. Open Notepad and copy/paste the following in it:

@echo off
cls
set root=C:\Users\Eugenia\VideoFootageFolder
set input=%root%
for %%I in ("*.MOV") do @echo DirectShowSource("%input%\%%~nI.MOV") >> "%%~nI.avs"

In the code above, you will have to edit it, and change the video footage folder name, so it points to your own folder with footage. Also, I’d suggest that your folder path has no spaces, and no non-english characters. If your camera does not record in MOV format, change the two instances of the word MOV, with the suffix of your format (e.g. M2TS, MTS, MP4). Save that script file with the name of avs.bat on the same folder as your footage.

9. Open an MS-DOS Command Prompt, and navigate to your footage folder (it obviously requires that you know how to navigate folders using the command prompt, it’s basic MS-DOS usage). Once there, run the script by simply invoking its name: avs.bat

10. For every .mov file in your footage folder, an equivalent .avs file is now created. E.g. 001.MOV now has a very small 001.AVS companion file. Creation of these .avs files will be almost instantaneous.

11. Open VirtualDub (it’s important you follow the follow the steps in the order presented, or you might hit a bitrate-related bug). Select File, Queue Batch Operation, Batch Wizard. Click the litte […] button, and select your footage folder, then click OK. Then, drag-n-drop in that Batch Wizard dialog all the created .avs files (make sure to only drag the .avs files, not the .mov ones). Click Filter Output Names, and type: “avs” (without the quotes) for the “Search for:” input box, and “avi” (without the quotes) on the “Replace with:” box. click Ok. Then click Add to Queue, and then select: Re-Save as AVI. Then, click OK.

12. Click Video, Full Processing Mode.

13. Click Video again, then Compression. From the long list, scroll down, and select the “Matrox MPEG-2 I-Frame HD” codec. Click Configure. In it, select the data rate you want (I’d suggest about 150 MB/sec), and the right frame rate (same frame rate you shot your footage at). Click OK, and OK again.

14. Click File, Job Control. All the .avs files you drag-n-dropped on step #10 will be listed there. Click “Start” to start encoding them. This will take a while.

15. When everything is done, close down VirtualDub, and load on your Vegas/Premiere/MovieMakerHD video editor the newly created .avi files (not the MOV or the AVS files, but the AVI ones). Edit as usual.

Note 1: If you shot some 720/60p or 1080/30p and you want to slow-motion that to 23.976 fps (e.g. music videos do that a lot), then you can do that during this transcoding (no need to do it through your video editor later). Select “Direct Stream Copy” instead of “Full Processing Mode” on step #12. And then click Video again, Frame Rate, and change the frame rate to 23.976 fps (type it). If you shot in 720/50p, type 25.00 in there instead. If you don’t care about the audio (since it won’t sound properly when the video is slowed-down) you can disable its transcoding by clicking in the main menu: Audio, No Audio. Then, continue with step 13 and beyond.

Note 2: Also, if you’re working with AVCHD or HDV footage instead of progressive dSLR footage, VirtualDub can de-interlace for you, or even remove pulldown, during this transcoding process. You just need to load the right internal filters: If you only want to deinterlace 50i/60i footage, just click Video, Filters, De-interlace, Add, and select “interpolate, yadif” from the list. The continue with step #13. If you want to remove pulldown instead (e.g. for PF24 footage), you can modify the MS-DOS script file above to also add TIVTC commands in the generated avisynth .avs scripts.

Note 3: If Vegas thinks that your progressive footage is interlaced, then use this trick to make it think otherwise.