Final Cut Pro

FCP howto: Use Batch Export to create a directory of still frames from a bin of clips

Wednesday, February 3rd, 2010

If you’ve got a bunch of clips in a Final Cut Pro Browser window, and you’d like to quickly generate a still frame for each clip, you can use the “Still Image” feature of FCP’s ancient “Batch Export” feature to automate much of the process. Here’s how:

Rt Overlays (Ignored By Utest)
1. Choose a representative frame in each clip. (Click any of these images to see them nice and big.

Making Stills From Fcp Step 2
2. Send the clips to FCP’s Batch Export feature and bring up its “Settings” window.

Exporting Stills From Fcp Step 3
3. Choose the destination for the exported files and set Batch Export to create still images.

The result will be a folder full-resolution PNG images, each named after its parent clip, deposited in the chosen destination folder.

I often end up processing directories full of such uncompressed images further using the excellent command-line Imagemagick utilities using the tcsh shell’s 1 “foreach” command to iterate through all the images. 2 It generally goes a little something like this:

$ tcsh 3
% cd directory_of_images 4
% foreach foo (*.png) 5
foreach? convert -geometry 330x800 "$foo" "$foo:r.jpg" 6
foreach? rm "$foo" 7
foreach? end 8

The result of this command is a set of JPEG-compressed images, one per clip selected in step 2, each resized proportionally to fit within a 330×800 rectangle.

  1. This is also easy to do with OS X’s default bash shell, but I’m more fluent in tcsh. ↩︎
  2. You may prefer GraphicConverter, Photoshop, or MS Paint. Imagemagick combined with the command line is mad fast for both image transformations and automatically renaming files. ↩︎
  3. Switching to the tcsh for this because I have yet to internalize Bash’s foreach syntax. ↩︎
  4. If you’re unfamiliar with command lines and shells, please note that the “%” character here represents the tcsh command-prompt, the “$” in the previous line represents the typical Bash command-prompt. Don’t type these characters in your commands, they’re just here for show. ↩︎
  5. “foo” is a placeholder of my choosing. There’s nothing special about the string “foo”. You can replace it with anything you like, such as “image”, “placeholder”, or “your_mom”. Just make sure to use the same string in place of all the “$foo” commands below. ↩︎
  6. Each time tcsh iterates through your commands, it will replace the string “$foo” with the filename of an image from the set chosen by “*.png”, which is every file in the directory ending in “.png”. Adding a “:r” to “$foo” indicates that tcsh should expand the filename but leave off the period and filename extension –in this case “$foo:r.jpg” removes “.png” from the file and adds “.jpg” in its place. The quotes around “$foo” are optional if your filenames do not contain spaces or special characters. ↩︎
  7. Removing the original png file because all I ever wanted were the tiny JPEGs. ↩︎
  8. One more note from Captain Obvious: If you try to copy and paste any of these commands, be sure not to copy and paste the superscript numbers that lead to these footnotes. ↩︎

assistant editor Unix tricks

Monday, January 25th, 2010

It’s time to take apart some Final Cut Pro xml and add some newly received VFX clips to the VFX database. One of these days, I’ll explain all of these steps and how they might be useful in other workflows. For now, enjoy a look at a relaxing vacation from graphical user interfaces and mouse-clicks; A trip to the Terminal. If you have any Unix or XML knowledge, there might be something of interest in here.

Assistant-2:20100125 CAB$ xmlstarlet sel -t -m "//children/clip"\
-v "name" -o "," \
-v "out - in" -o "," -v "in" -o "," -v "out" -o ","\
-v "media/video/track/clipitem/start" -o "," \
-v "media/video/track/clipitem/end" -o ","\
-v "media/video/track/clipitem/file/timecode/frame" -o ","\
-v "media/video/track/clipitem/file/name" -o ","\
-v "media/video/track/clipitem/file/timecode/string" -o ","\
-v "media/video/track/clipitem/file/timecode/reel/name"\
-n 20100123_vfx_received.xml | tee 20100123_vfx_received.csv

52A-2_01_VFX_v1,178,0,178,0,178,,52A-2_01_VFX_v1.mov,,
52A-2_02_VFX_v1,141,0,141,0,141,,52A-2_02_VFX_v1.mov,,
52B-2_01_VFX_v1,152,0,152,0,152,,52B-2_01_VFX_v1.mov,,
53-3A_01_VFX_v4,307,0,307,0,307,,53-3A_01_VFX_v4.mov,,
54-3A_01_VFX_v1,188,0,188,0,188,,54-3A_01_VFX_v1.mov,,
C100_C016_0920LS_03_VFX_v1,102,0,102,0,102,,C100_C016_0920LS_03_VFX_v1.mov,,
C102_C011_0903RU_03_VFX_v1,79,0,79,0,79,,C102_C011_0903RU_03_VFX_v1.mov,,
C102_C011_0903RU_04_VFX_v4,256,0,256,0,256,,C102_C011_0903RU_04_VFX_v4.mov,,
C102_C011_0903RU_05_VFX_v2,200,0,200,0,200,,C102_C011_0903RU_05_VFX_v2.mov,,
C102_C011_0903RU_06_VFX_v2,147,0,147,0,147,,C102_C011_0903RU_06_VFX_v2.mov,,

Assistant-2:20100125 CAB$ cd thumbs/
Assistant-2:thumbs CAB$ tcsh
[Assistant-2:additions/20100125/thumbs] CAB% foreach foo (*.png)
foreach? convert -geometry 330x800 "$foo" "$foo:r.jpg"
foreach? rm "$foo"
foreach? end
[Assistant-2:additions/20100125/thumbs] CAB%

The starting point is a bin of clips in an FCP project. I’ve exported that bin as FCP XML, and have also batch exported the clips inside it as stills (to PNG, the default). The commands above are the meat of the process. Then the comma-separated-value list of clips I generate with the xmlstarlet command gets imported into an openoffice (or Excel) spreadsheet (a step I’ve ommitted here), and is massaged into a csv format for import into a Filemaker Pro database of VFX clips. Finally I import the thumbnails for each clip into the database. Fun stuff, pretty much.

An error message I’d love to see improved in Snow Leopard

Tuesday, April 7th, 2009
OS X's "disk is in use" error dialog

Oh how I hate the above error message. It’s not that it’s completely uninformative, but it’s a perfect case of “so close but yet so far”…

Anyone who uses as many external disks on a Mac as I do is apt to occasionally have trouble properly unmounting and ejecting those disks 1. Before unmounting a disk, it’s necessary to stop accessing files on the disk. This is often an easy thing to do –if I’ve loaded a file from an external disk into an application, I just close the document or quit the application entirely. If I’ve goofed and am still using files on the drive, OS X will refuse to unmount the drive and will display the error dialog I’ve pasted above. 2

But often it’s less than obvious which application or function built-in to the operating system is using a file on the drive. There are applications that don’t play nice, and keep file handles open to files on a disk even after you’ve closed all documents that use those files 3. There are functions built into the operating system that access files on a disk without calling any attention to themselves. This error message could and should be a hell of a lot more informative and useful.

A simple set of commands in Terminal 4 can reveal which application is using a file on a particular disk. Since this information is available, is incredibly useful, and can be quickly retrieved in the Terminal, I see no reason that it is not just included in the initial error message. Telling me that a disk is still in use is not nearly as useful as telling me that a disk is still in use by Microsoft Word, or that a disk is still being shared with another computer.

In this case, the terminal command “lsof | egrep -i 400Gb” reported that a process named “smbd” was still using the drive. Since I’m a Unix geek this is useful information to me, but since OS X tries to also be useful to people who wouldn’t know a Samba daemon if it ate their grandmother, this process should be simplified. In an ideal world, the error message above would read “The disk ‘400Gb_Thing’ is in use by OS X’s Windows file sharing. Would you like to stop sharing this drive and eject it?” and would feature both “OK” and “Cancel Ejection” buttons.

This is a no-brainer. Apple, please fix. Thanks.

Technorati Tags: , , , , , , , , ,

  1. It’s a good idea to actually unmount disks prior to unplugging them, modern filesystems need to be given a proper send-off before disconnection to keep the data in good shape. ↩︎
  2. Windows users (and I am one), please refrain from feeling smug at this tale of Mac woe. Don’t get me started on the Windows “Safely Remove Hardware” dialogue and how much fun it is to try to remember the model numbers of each of my external drives so that I can find them in that list. It’s unconscionable that this feature wasn’t redesigned for Windows Vista. They must have used a single USB drive as the test case. ↩︎
  3. I often just have to quit Final Cut Pro before ejecting a drive for this reason, sometimes it just won’t let go of a file even when all FCP projects have been closed and I’m looking at an empty Browser ↩︎
  4. “lsof | egrep -i portion-of-disk-name”, or in this case “lsof | egrep -i 400Gb”, without the quotes. ↩︎

SmoothCam test #1: AJ developing a musical idea on a piano

Tuesday, March 24th, 2009


A SmoothCam Test – AJ testing an idea on the piano from ZachFine on Vimeo. Available in larger size for playback and/or download here.


This is a test of Final Cut Pro’s “SmoothCam” motion stabilization filter. I’ve set two videos side-by-side. On the left, the original clip. On the right, the SmoothCam version with the following settings:

Auto Scale: 1
Actual Scale: 138%
Translation Smooth: 1.5
Rotation Smooth: 2
Scale Smooth: 0
Mix: 100

The original clip was shot with a Canon HV20 mounted on a Steadicam Merlin, so it was fairly smooth to begin with. I was pleased with how well the SmoothCam filter ironed out the rotational skewing of the camera without being noticeable about it. I do wish the filter didn’t autoscale the entire clip to match the worst of the movement, and instead the adjusted clip could start with the wide and then smoothly scale in to cover the adjustments, then smoothly scale out for segments that were more stable. Had I shot with a higher shutter speed, the motion blur on the subject wouldn’t be as bad.

I’m sure I’ll end up using this SmoothCam filter on some footage one of these days. It’s a nice effect. I’ve already had FCP batch analyze all my footage from the SXSW festival. The fact that the filter works very quickly on clips whose motion has already been batch analyzed is a deal-maker.

Technorati Tags: , , , , , , , , , , ,

Final Cut Pro can batch analyze clips for stabilization, in the background yet

Monday, March 23rd, 2009
A screenshot of the Final Cut Pro Browser and Background Processes windows showing the SmoothCam Analysis in progress.
A screenshot of the Final Cut Pro Browser and Background Processes windows showing the SmoothCam Analysis in progress. Click the image to see it at a legibly large size.

I ran around the South by Southwest festival last week shooting behind-the-scenes video of my cousin AJ and his band on my Canon HV20, stabilized with a Steadicam Merlin. I’m still learning to use the Merlin –it is a fantastically engineered piece of kit, but it takes a light touch to float it about, and it’s much easier to use for choreographed moves than for impromptu run-and-gun documentary-style shooting.

Final Cut Pro and Motion both inherited a feature from Shake called “SmoothCam”, which is a motion stabilization filter. SmoothCam analyzes movement within a clip and moves the frame around to compensate for high-frequency movement while preserving the lower-frequency moves –i.e. it tries to remove bumps and vibrations while preserving smooth, intentional camera movements. I ran a few tests on some of my relatively smooth clips, and SmoothCam seemed very good at doing exactly that.

When the SmoothCam filter is applied to a clip, that clip is put into a queue and Final Cut Pro begins to analyze the motion in the clip. Once FCP’s analysis concludes 1 , the SmoothCam filter will have data to use for its calculations and its effect will finally become visible. One can then adjust the SmoothCam settings and see the results instantaneously (with a computer of sufficient power).

I’m happy to note that it is possible to have Final Cut Pro analyze the motion of a batch of clips, and then later if the SmoothCam filter is applied to any of these clips its results can be seen without delay. The motion analysis data for each clip is written to disk alongside the clips themselves.

Since I may or may not want to use the SmoothCam filter on many of my clips, and I don’t plan to do any more editing on my computer tonight, I’ve set FCP to batch analyze the motion in all of my footage from the last week. To do so, I enabled the “SmoothCam” column in FCP’s Browser, selected all the clips I wanted analyzed, right-clicked in the column and chose “Run Analysis” from the clip’s contextual pop-up menu. Now the analysis is puttering away, and tomorrow I can play.

The things one can learn by glancing at the manual!

Technorati Tags: , , , , , , , , , , ,

  1. The entire clip is analyzed, regardless whether only a portion of it is in use in a timeline. A clip’s In and Out points are ignored. The analysis can take a while, and I would strongly recommend converting any clips in a long-gop format such as HDV to Prores beforehand for markedly faster analysis. ↩︎

A Fun Little Motion Project

Monday, January 23rd, 2006

a frame from my Motion project
A friend of mine is putting together a behind-the-scenes featurette for the DVD of his short film. In his film, he made extensive use of Apple’s Final Cut Pro 5 software for editing and Motion 2 for effects and motion graphics. For his featurette, he wanted to explain the integration, or round-trip, between these two applications. I volunteered to create a Motion project that would demonstrate the basic concept through the use of animated titles. In the featurette, this animated demonstration/title-card will be followed by in-depth real-world examples using his footage and workflow.

The result can be seen here as a QuickTime file. As an aside: That movie is 720×480 resolution, 29.97fps, and 16 seconds long. It is a testament to the capabilities of the QuickTime H.264 codec that the resulting file is only 716k. Unbelievable! If your computer complains and won’t play the file, install QuickTime 7 (mac || windows) and it should play just fine.

If you have Motion 2 on your computer and wish to take a crack at my project — to alter it or see how it was done, the project is here.