Wednesday, December 16, 2009

Making sense out of MVC in Flex

Now that the video project is nearly out of the way, I'm anxious to get back more to Flex and to do this MVC is a top priority. Looking around the web there are a lot of tutorials but most focus on using frameworks like Cairngorm and PureMVC and very light info on the concepts of MVC and how they are implemented in AS3. Fortunately I stumbled upon this one--from the writers of an OReilly book on the subject -- and it's so good I'm thinking about buying the book:

http://www.as3dp.com/category/design-patterns/mvc/

Tuesday, November 10, 2009

Subtitle issues in DVD Studio Pro

After a lot of experimenting, we have settled on the following subtitle settings for the NTSC and PAL versions of the DVD.

PAL: Helvetica Bold 34pt
NTSC: Arial Bold 29pt

We found that when we used Helvetica Bold for the NTSC version, the lower case "w" was a lot smaller than the other letters and looked very odd. Also the dot on the lower case "i" was not clear so it looked more like an "l".

We also liked that the top stem of the "t" was angled down a bit, making it a bit easier to read. Going back we might have used Arial for the PAL version too but we didn't have the time to test it.

For Persian text we found that the only good way of getting subtitles to look good was to do them in Photoshop -- one by one. We used a black font with a bold yellow outline, saved it as a png and imported into DVDSP. This will show up as a white letter and black outline. Make sure the outline is thick enough.

To do this for both NTSC and PAL:

1. Create the subtitle at 1024x576 (PAL 16:9). White background, black letter, yellow outline. Make sure to create guides for the title safe and keep the subtitle within this area.

2. Keep the subtitles in a separate folder and save backups--you'll use this set of subs to create the compressed NTSC and PAL subtitles.

3. Once you have all of the subs do a batch convert of them and resize them to 720x576. This will give you the PAL subtitles.

4. The do another batch conversion of the original set and resize them to 720x480. This is the required size for NTSC.

As far as our timing between the subtitles, we used a 4 frame gap -- but in retrospect we could have used 3 or 2 if necessary. It was also a happy accident that we did all of this on the PAL timeline (at 25 frames per second) and we were able to use the exact same stl file for NTSC. We didn't test this but I'm pretty sure that DVDSP would cough up an stl file for a PAL project that used the 29 frames per second timing.

Friday, October 16, 2009

Keylistener failing in Flex with creationComplete

Just a quick note. It appears that the stage does not get initialized in a Flex app until the applicationComplete event is fired (not creationComplete).

So if you have an init() function that sets up the listener like this:

private function init():void{
stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDownHandler);
}

calling it from the application tag like this will fail:



but this will work:

AS3 writeUTF vs writeMultiByte with diacriticals, curly quotes and other special characters

I'm working on an Air app that allows a user to modify blocks of video subtitle timecodes. The user can open an stl file, splits the file into an arrayCollection and puts it into a datagrid. They can then select a block of timecodes and adjust them based on the modified start time. This will be a huge timesaver since the film we had completed required a re-edit and we have thousands of subtitles that will now need to be changed as a result.

In any event, when the work is done the user can save the file to the system. In the save process, I naturally used the writeUTF() method but found that although it's supposed to save using utf-8 encoding, things like diacritics, question marks, curly apostrophes and quotes were broken in the resulting file.

So what should have looked like this: “This is a quote”
Looked like this: “This was a quoteâ€o

However, if you use the writeMultiByte() method and set the encoding to utf-8 it works perfectly.

So instead of : fileStream.writeUTF(myText);
try: fileStream.writeMultiByte(myText,"utf-8");

Since Google came up empty for search for the answer to this problem I though I would post this. Maybe it will help someone else....

Wednesday, October 14, 2009

Great replaceAll in AS3

Simple and powerful. Found at:

http://snipplr.com/view/10998/replace-all/


var theContent:String = "Test String with lots of t's"
trace(replace(theContent, "t", "z"));

function replace(str:String, fnd:String, rpl:String):String{
return str.split(fnd).join(rpl);
}

Monday, September 28, 2009

"This PNG contains additional data for Adobe Fireworks, which will be discarded upon save."

This prompt appeared when I had modified a number of files with Fireworks and then tried to execute a batch command in Photoshop on the files:

"This PNG contains additional data for Adobe Fireworks, which will be discarded upon save."

And although I clicked ok for the first file, it appeared again for each one--rendering the batch process useless. I couldn't find a solution in Google, so it seems that the only logical way to solve the problem was to run the batch using a Fireworks command instead. And it is just as easy to create a "command" in FW than an "action" in PS:

1. Open a file in Fireworks
2. Open the History dialog box
3. Make sure the History list is clear
4. Go through whatever steps you wantto modify the image as needed
5. In the History panel, highlight the steps that you want to set as the command
6. In the History options drop down select "Save as Command"
7. Give your command a descriptive name
8. Select File>Batch Process
9. Select the files you want to run the command against
10. In the next step (Batch Process dialog) open the Commands list and select the command you made.
11. Run it
12. Done!

Sunday, September 27, 2009

NDF and DF problems in converting subtitles for use in Final Cut Pro and DVD Studio Pro

It has proven to be extremely complicated to do subtitles for this project using DVD Studio Pro and Final Cut Pro. The latest wrinkle was to export the STL file back into Final Cut pro using Subbits. The program works well--but is not well documented so a lot comes down to trial and error.

The subtitles STL file we created for DVD Studio pro worked out fine but when we took the exact same file and converted it to XML using Subbits, the subtitles slowly got out of synch as the film advanced. The solution required us to adjust the STL in Subbits using the "Recalculate NDF to DF" option (a completely undocumented feature in the Subbits manual). On top of that when you choose the option it prompts you with the alert: "This will shift all timecodes down from 30fps to 29.97 fps. Are you sure you want to continue?" but since we are using PAL this makes no sense.

However, chosing this option -- despite the erroneous warning -- solved the out of synch issue with FCP.

** Update: It appears that this solution only fixed one out of the 4 subtitle STLs that we were working with. The others simply needed to have the Subbits settings for the project set to PAL instead of NTSC. (Clcik Edit>Preferences>PAL). Don't have the time to figure out why the two STLs needed to be processed differently--could have been a FCP setting instead. All in all though I still say Subbits is the best -- and lowest cost -- solution to the problem. I hope Apple will just create a more logical work flow to work with subtitles in FCP and DVD Studio Pro in their next version!