We give a very warm welcome to Fox Mahoney as he joins our roster of talented writers. He probably knows more about fonts and 3D in Motion than anybody outside of Cupertino, so we are very happy that he has agreed to let us in on a few secrets. His first tutorial is building a custom Motion generator to automatically generate subtitles in Final Cut Pro X.
Just to give you an idea of Fox's FCPX, Motion and plugin knowledge, he was the first person to work out how to convert onscreen control points into corners for shapes. If you have ever built a plugin using that method then you can thank him for doing the hard detective work of figuring the process out. He's also one of the top producers of 3D models using fonts in Motion and FCPX, so please make sure you check out his YouTube page and store. (Worth a look just for his awesome recreation of a 3D Gibson Les Paul in Motion)
After that introduction, it's over to Fox...
Apple Motion is just a lot of fun and I enjoy using it on a daily basis for all kinds of illustrations, 3D modeling, exploring ideas, etc. However, in this article, I’d like to discuss a more practical application: subtitles.
Subtitles are quite easily accomplished in Apple Motion and in my opinion, easier than any other type of subtitling software available. You don’t even need timecode!
It will depend on the project. A short project, 20 - 30 minutes or less can be handled quite easily. Longer projects like full length motion pictures or an hour broadcast, depending on the density of dialog will probably need to be broken up into smaller 15-20 minute segments or clips. Still not a big deal.
The reason is two-fold. One, there is a limit to the amount of text that Motion can handle with the File text generator (it’s been a few years since I calculated that and cannot quite remember but somewhere around 15000 characters seems familiar — it doesn’t matter because) two, keyframing the File generator is more difficult if there are too many lines per file. So, simply, reason two takes care of reason one automatically. Don’t try to subtitle a full length motion picture with a single file.
In FCPX, it’s easy to split video into shorter segments with the Range tool. Use markers to set up your segment divisions and turn Snapping on. Use the Range tool, which will snap to the markers and Share/export your segments (Audio only will do.) Whatever you export, you will be deleting it from the Motion project before you save so you don’t duplicate the footage.
I recommend creating a duplicate project for this purpose. Modify the resolution settings to 960x540 (custom) and ProRes 422 Proxy. ProRes will not slow down Motion as any MP4/H.264 footage will.
For the text, formatting is key but not nearly as critical as SRT file format (like I said: no timecode.) If you are typing the text from scratch, start your text file with one or two blank lines (video that starts with speaking right off the bat is rare.) Write as much text as you want to appear on the screen at one time and type two newlines at the end (double space the document).
Speech has a start time and an end time and there is usually a space between the two sentences. In other words, more often than not, text is on the screen for a length of time, then it is off the screen for a length of time, then the next line appears. The double spacing makes turning off text easier. If you know the text runs together from one line to the next, then you can skip the double spacing between those lines.
If you’re working with a subtitle file (.srt) then you need to strip out everything needed by the subtitling software and reduce the file to just text. This is unbelievably simple if you use a text editor like TextWrangler (free from BareBones software). Open the SRT file in TextWrangler, Command-F to find will call up a dialog. In the Find text box, type:
and select the “grep” option. Then: click the Replace All button. If you don’t understand this, it is a regular expression and its meaning is not that important, it just works (and very quickly!) You start out with something like the left column and end up with something like the right column:
Remember to add the first one or two newlines at the top of the file and save. The above example shows “broken” lines that will appear one after another in time, but double spaced where there will be a time gap between lines.
Create a new Generator or Title in Motion. Import the audio (or video with audio) into the project. Adjust the time length of the project to include all of the media (or as much as you want to do at a time). You can click on the clock under the canvas to select the project length time and drag up on the timecode to include the entire media in the project time. (The clock icon hands change from ~12:07 to 12:15 or vice versa.) Make sure the Play Range Out is also reset to the end of the media by clicking and dragging the indicator to the end of the project, or moving the playhead to the end and typing option-command-O.
To the project, add a Generators > Text Generators > File object.
In the Inspector, Browse to find and load the text file.
Set the Speed to Custom and clear the default keyframes (click the disclosure triangle to the right of Custom Speed and select Reset Pararmeter).
At this point, before any keyframes are set, you should scan through the custom speed parameter of the file generator and take an overview look at how the text will lay out and make decisions as to font, size, tracking, line spacing, color, drop shadow, etc. I recommend going into the Layout section and setting the Layout Method to Paragraph.
Set up the Paragraph on the canvas for text width and placement on the canvas. Paragraph format is convenient because it will automatically break up long lines into multi-lines (line-wrapping). You can also set Auto-Shrink so you can force the text to stay within "text safe" boundaries if there is more than will normally fit.
Set a new keyframe on the first frame for the first line (it should be a blank line). Play through the project, at the start of any new spoken line, pause play (adjust frames if necessary), adjust the custom speed slider to reveal the next line of the text. It helps to resize the Inspector pane much larger so that using the slider becomes easier, especially for larger text files. (It's normally "ok" to be a few frames past [or before] the beginning of the actual speech.)
When you want a line to turn off, you need to set another keyframe (move the custom speed slider up to display the next blank line.) It can also be helpful to open up the Audio Timeline (speaker icon bottom right corner of the window), expand the “layer” by grabbing the divider line under the audio label in the left side inspector and dragging down to reveal a better view of the sound wave.
When done playing through the project and setting keyframes, right click on the Custom Speed parameter and select "Show in Keyframe Editor". Select one keyframe and type Command-A to select all of them, right click on any of the selected keyframes and select Interpolation > Constant. If you skip this step, lines will transition between keyframes and timing will be completely off. All of the keyframes should look “stepped”:
Minor timing adjustments can be made by selecting individual keyframes and using command-left arrow or command-right arrow to carefully move the keyframe back or forward in time by frames. Once the keyframing is completed and before saving the template, delete the video and/or audio media you imported. It is not necessary in FCPX and Motion will add that media into the Media folder of the template, essentially duplicating files you will never need. No sense in wasting the HD space especially since it will be on your internal drive. The average size of a text only template will be less than 250KB and the size of the media may add as much as a gigabyte or more (depending on codec, size, etc.)
Save the Motion project/template to a (new) Subtitles category and name it something you'll recognize (nameOfProj-SegNum-sub works). You can trash the template after the project is baked. In FCPX, set the playhead to the beginning of the clip/section being subtitled and place the subtitle generator (or title) at the playhead -- everything should be exactly aligned/sync'd. Remember you can “nudge” the template with the comma and period keys.
You could simply bake the subtitle as a video and exported as ProRes 4444 and use it as an overlay in FCPX, but that creates an unnecessarily large file.
One of the great benefits of creating Motion generators or titles for subtitling is being able to right click on the template in FCPX and Edit in Motion if you have any minor corrections to make. At that point, you will not use the original document you loaded into Motion to create the subtitles, you will go into the template’s Media folder and find the copy of the the TXT file you imported to edit.
Another benefit of using Motion for subtitles… it doesn’t require any special knowledge of the time codes used by SRT.
If you’re not up to date with current versions of Motion, there was a few versions in the past for which Motion failed to place the TXT file copy in the Media folder. If that file is missing from the Media folder, FCPX will crash. You might want to make sure a copy of the text file is present in that location before adding the template to your storyline.
You may be wondering what to do about conversations which requires two separate lines to be on the screen at the same time. There’s the rub. However, if you create a secondary text file (or use the original twice with a separate File generator) you can keyframe two versions at the same time. (You would have to decide if that was a practical move; you might just need one second line here and there and it would be faster or more expedient to just add a regular text object with its in and out points to match the time of its appearance).
I mentioned you can make decisions about font, size, color, etc., Well, you can also keyframe numerous parameters concerning positioning (and other qualities like color, size, etc.) along with each line’s timing. It’s not difficult to move text around so that more than one instance can appear at the same time and not the same place! The possibilities are extremely flexible.
Here’s a small clip of this subtitling technique used in FCPX, created in Motion. (There is no sound since the audio track still has a copyright attached to it.)