Navigating the animation timeline by keyboard in Photoshop CS3

Posted on July 27th, 2007 in Film technique by emre

Quick navigation tip from an Adobe developer: You can navigate the animation timeline by keyboard if you set up a shortcut.

Go to Edit>Keyboard Shorcuts (Alt+Ctrl+Shift+K) to bring up the Keyboard Shortcuts and Menus dialog:

Keyboard Shortcuts and Menus

Guess what: you can’t use PgUp and PgDn as the shortcuts. The most intuitive pair of keys I could get it to accept were Ctrl+* and Ctrl+/ on the numeric keypad. I then mapped these two keys to my ShuttlePro’s jog dial.

Were they really expecting users to use the mouse every time they want to advance frame? The writer jokingly says “please request this as a feature for next release“. Maybe they should have consulted the After Effects team?

Preparing interlaced files for rotoscoping in Photoshop CS3

Posted on July 23rd, 2007 in Film technique by emre

I thought I would test the new Photoshop’s rotoscoping abilities. On the whole I’m pretty impressed! I might not have to use After Effects at all. One problem is that Photoshop is not smart enough to separate fields with interlaced footage, so you get things like this:

Interlaced clip before separating fields

Good luck trying to rotoscope anything out of that. The solution, as others have noted, is to separate the fields first. One way is to do it in After Effects, as explained above. What do you do if you do not have that? You can use open-source tools Virtualdub and avisynth, as I will explain here.

Another minor problem with using videos in Photoshop is that the Save For Web tool tries to read the entire video when you try to save a single frame. It took me ten minutes just to generate the screen cap above! Save For Web huffed and it puffed, only to give up in the end because there was “not enough memory”. I only asked it to save a single frame, and navigated to it on the time line, so what does it need memory for!? After that it only took a few seconds to copy the canvas on to a blank document and save it with Save For Web. I bet Adobe will use this bug to entice people to upgrade to the next version: “New Save For Web…now compatible with video!”

Back on the topic of separating fields for interlaced footage… First you have to create an Avisynth file that looks like this for an NTSC video:


avisource("file.avi")
SeparateFields()
BicubicResize(720,480)

If you are using SD NTSC, as we did, this will create a 720×480 59.94fps video. The last line in the script instructs avisynth to expand the video vertically so that we can re-use the DV codec, which requires the video to be 720×480. Otherwise we would be working on a squished 720×240 video.

Save this script to a file with an AVS extension, open it in Virtualdub, and export it to something Photoshop can understand. The help file says that Quicktime, MPEG-1, MPEG-2, MPEG-4, MOV, AVI, and FLV are supported. Since AVI is merely a video container, you would think that Photoshop could use DirectShow to open any codec, but this is not the case. My understanding is that Photoshop uses Quicktime to open its files, so you are limited to the subset of codecs compatible with Quicktime. Well what are they? After some experimentation, I discovered that AVI files using DV worked, while those using YUY2, lagarith, MSU, JPEG lossless did not.

Once you have opened your file in Virtualdub you need to make note of the mark in and mark out points in Vegas. Go to the Trimmer and change the ruler to use Absolute Frames so you can input them in Virtualdub. You will notice that Vegas uses the time code of the tape by default, while Adobe naturally starts from the beginning of the clip. To make Vegas reset the counter to the beginning of the clip you have to go into the clip’s properties and reset it yourself, as shown below:

Clip media properties in Sony Vegas

Now you should be able to determine the mark in and mark out points easily from the trimmer:

Reading the trimmer in Vegas

Go to Virtualdub and use Jump to Frame (Ctrl+G) to set the mark in-out points. Since we separated the fields in an earlier step, we need to multiply the frame numbers from the previous step by two to reach the same point in time. To use our example, if the mark in was 151 and mark out was 245, look for frames 302 and 490 in Virtualdub:

Virtualdub's compression dialog

Here we used Mainconcept’s DV codec since it is compatible with Photoshop’s video import filter. Note the AVS file in the applications title bar, and that the RGB 16…235 check boxes have been ticked in both the decoder and the encoder. The first (decoder) ensures that the video imported into Virtualdub looks like it does in Vegas. The second (encoder) ensures that the rotoscoped footage looks like it does in Virtualdub.

You should now have a de-interlaced file you can rotoscope in Photoshop.

Image sequences

For short clips, you can make life easier, and get the highest quality to boot, by using images sequences instead of videos. Just load the Avisynth script in Virtualdub and invoke the image output filter from File>Save Image Sequence…. Use the TARGA file format and enter the file output directory, otherwise Virtualdub will litter its own installation folder with images. Once you have generated the image sequence you can import it into Photoshop by using the Image Sequence tick box in the File Open dialog:

Photoshop CS3's File Open dialog

Your screen may look different if you use the OS dialog rather than Adobe’s (which allows you to see the metadata). The next step is to select the frame rate, which is actually the field rate in our case. For NTSC it is 59.94.

The final step is to set the pixel aspect ratio. Since we are working with fields, we have half the vertical resolution of a frame, therefore the PAR has to be halved. Therefore, set it to 4:9=0.4444 for full screen and 16:27=0.5926 for widescreen. It should now look like it used to before separating the fields.

Once you are finished go to File>Export>Render Video. If you export to another sequence of images, you can combine the fields using an avisynth script like this:

imagesource(”retouched%03d.png”,000,147,59.94)
assumefieldbased
weave

The first line indicates that the sequence of images to load has file names retouched000.png to retouched147.png.

Exchanging DV clips between Sony Vegas and After Effects

Posted on July 16th, 2007 in Film technique by emre

After Effects 7.0

While doing some rotoscoping for TFII I noticed that my retouched clips looked funny upon bringing them back into Vegas. I understood that this is because Vegas uses “studio RGB” (aka ITU-R BT.601, limiting luma to 16 < Y < 235) while After Effects 7.0 does not. To be more precise, what happens is that Vegas uses its own DV codec, while After Effects, opens the same file with the maligned Microsoft DV codec. An editing codec should be fast, capture as much information and suffer as little generation loss as possible. Sony’s DV codec is good, by this measure. You could dumb Vegas down to use Microsoft’s DV codec, but there is a better way.

To work around the problem, I convert my DV clips to something lossless like huffyuv or MSU Lossless Video Codec. Unfortunately this means that Vegas comes to a halt when try to play the rotoscoped clips, due to their size, but it is burden with which I am willing to live. If I were more lazy I could use Vegas to convert those clips back to its own DV format, but I do not want to incur another generation loss. Once rotoscoped, the footage can be exported to an alternative DV codec, such as Mainconcept’s, if you wish to avoid Microsoft’s.

After Effects CS3

New to CS3 is end-to-end color management. This means, for instance, that you can assign a color space to your imported footage and preview it on your calibrated monitor, just like you can in Vegas.

You can enable it from File>Project Settings by selecting an appropriate working space under the Color Settings section. Do not forget to use enable Use Display Color Management from the View menu. Veteran Photoshop users will know that the View menu also houses the Soft Proof feature, which in After Effects has been renamed to the simpler Simulate Output. If you go into the Custom… section of the menu item, After Effects allows you to perform color space conversion between a respectable list of films and devices. Video has finally caught up with photography in color management!

Project Settings dialog

When I select SDTV NTSC 16-235 and enable RGB 16-235 in the Mainconcept DV codec’s settings I get retouched clips that seamlessly blend in upon being re-imported in Vegas:

Mainconcept DV codec

Conclusion

In practice I simply import my clips into After Effects CS3 with the Microsoft codec, and set the color space to SDTV NTSC 16-235 and it looks just like it does in Vegas. Instead of using the Mainconcept DV codec to export I use lagarith, which is lossless. This makes a visible difference in retaining chroma information.

Next week I will explain how to do rotoscoping in Photoshop CS3.

Calibrating your monitors: audio and video

Posted on July 8th, 2007 in Film technique by emre

Have you ever wondered why your project looks and sounds wrong on someone else’s equipment? This happens because their output devices are configured haphazardly and behave differently natively. So what can you do about it? Calibrate your equipment to a common standard, of course. In this brief article I will show what can be done on a small budget.

Video

I use a pair of 19″ CRTs for all my editing. If I wanted to go all out I would add a television monitor to the mix. I do not feel an urgent need to do this as I know my CRTs are showing me accurate colors. I routinely calibrate and profile both of my monitors with Colorvision OptiCAL. The way it works is that I attach a small hardware device (called a colorimeter) to the screen and run the calibration utility. The utility generates a series of colors, and the colorimeter measures them so the utility can determine the difference between the measured value and the proper value. The result is an ICC profile.
Microsoft Color Control Panel
To take advantage of the ICC profile I use Microsoft’s Color Control Panel to load the LUT when Windows starts up. Once the applet is installed, you need to place wincolor.exe in your Startup folder and run it as follows:
"C:\Program Files\Microsoft Color Control Panel\WinColor.exe" /L
This will ensure that your profile gets loaded when you start Windows. Macintosh users will naturally use ColorSync. Isn’t it amazing how similar MCCP and ColorSync look? I wish Microsoft would copy Safari too, and implement color management in Internet Explorer so we could take it for granted. Maybe in five years from now, when the next version of Windows is released…

Once the LUT is loaded, you need to tell your editing application about it. If Windows had been designed with color management in mind, applications would do this behind the scenes with a few API calls, but it was not designed that way, so here we are wasting time configuring our applications. I use Sony Vegas, so I go Options>Preferences>Preview Device and select Windows Secondary Display from the drop-down list.

Sony Vegas' Preview Device options

Let’s take a closer look at the configuration above. Basically I instructed Vegas to show the full-screen video on my second (right) monitor at its current resolution. The virtue of this is that it avoids constant resolution changes that would occur whenever you start and stop previewing, which is not good for CRTs. If you use an LCD, you will of course want to use its native resolution at all times. For obvious reasons, you want your video to fill the screen rather than be too small (SD) or too large (HD), so you tick Scale output to fit display. Also you don’t want to get a headache looking at interlaced footage so you tick Apply deinterlace filter. However, the most interesting option, as far as this article is concerned, is the Use color management option, which you should also tick. This tells Vegas to take the video from its native color space (e.g., NTSC DV) and convert it to your monitor’s color space, as defined by the Monitor color profile. If you use Vegas’ native DV codec, tick the Use Studio RGB option too. This tells Vegas that a luma setting of 16 actually corresponds to RGB (0,0,0) and a luma setting of 235 corresponds to (255,255,255). In other words, it expands the luma scale, but this is only true of certain DV codecs. This is what the help file has to say:

DV Codec Studio RGB Setting
Sony On
Microsoft Off
Matrox Off
Mainconcept Off
Canopus On
Quicktime Off

Audio

Mixing in surround is de rigeur so that is what I assume. There is not much to configure with a pair of stereo speakers anyway. With regard to the speakers, there are two options: self-powered and amplifier-powered; I have the latter, for historical reasons. This means that my sound card interfaces with my receiver. Again, there are two options: digital and analog. For the former, there are once again two options: coaxial and optical. It does not matter which you use, since digital is digital; my m-audio sound card uses coaxial. To digitally transmit audio the audio has to be encoded (to define what exactly the ones and zeros mean). The two standards are S/PDIF (consumer) and AES/EBU (professional). These standards support PCM stereo, AC3, and DTS. Unfortunately, there is no consumer standard for PCM surround, except for the ones defined by HD, and you certainly can’t get that at the consumer production level yet. Unfortunately this means that you have to work in analog…

Six channels means three pairs of stereo cables: front left & right, surround left & right, center & LFE. Connect these from your sound card to your receiver, then go into Vegas’ Audio Device options. If you are lucky (or you chose well), your sound card should have an ASIO driver, for reduced latency (processing delay). My preferences look like this:

Audio Device preferences in Sony Vegas

Once you have properly connected your sound card to your receiver, you still have to properly position the speakers and calibrate them. This is pretty complicated stuff, and expensive to do right; the room’s shape and materials have to be taken into consideration. That is what recording studios are for. I assume people reading this do not have the means for that, but there is still a lot that can be done.

First, let us consider the speaker positions. I used Dolby’s Surround Mixing Manual as my guide. Sections 2.2 and 2.3 tell you all you need to know, so I will not repeat them here. Ideally you want all your speakers to be identical, positioned at eye level, so you can pan the sound from one to another without noticing any difference. If the Dolby manual isn’t enough for you, Wendy Carlos goes into excrutiating detail.

Once you have properly positioned the speakers, you will want to calibrate them to the correct sound level, and the way to do that is with a sound level meter (cf. 2.3.9). I picked up an Extech 407735 off eBay for $70. The idea is to get each speaker to generate a particular sound level when fed a particular signal. Dolby calls for an 85dBC (front) or 82dBC (rear) SPL, slow response with -20dBFS pink noise. The LFE is more tricky since sound level meters are not said to be as accurate at such low frequencies but I ignored the warnings, for lack of a better option. Of course, there is the possibility that your SPL meter might need to be calibrated but let us not get bogged down :) You can use these audio files for your own calibration. I use band-limited pink noise in order to reduce room interaction effects, as explained here.

If you really want to polish it off you can equalize your monitors to linearize their frequency response with a spectrum analyzer.

“Once There Was…” post-production diary

Posted on July 1st, 2007 in OTWOTW by emre

I think I broke a speed record for myself by editing four scenes today; that’s eight minutes. I started with scene two, followed by scene one, then three (a) and (b). My eyes are sore and I need a rest. Watch a snippet!