Subtitles application for movie screening

March 2nd, 2009

Five years ago I wrote a small application for PÖFF(Black nights film festival) to show subtitles for foreign movies. Those movies were typically screened only once and didn’t have any subtitles at all, so they were translated by volunteers from script text and sometimes from movie itself.

This program was quick and dirty solution to get subtitles shown, but worked out fine and I got to see all movies for free. Anyway, the cinema where PÕFF was held started to use it for their own non standard film events, then also the cinema buss and I’ve been told at least one open air film festival in Tartu uses it also.

Last week I received a call from the cinema about this program and they asked for some minor changes. It’s so nice to hear stuff made by you actually helping someone, so now this I declare this software freeware and open it to public. If you need some quick solution for subtitles it might help you out.

So how it works

Subtitle application diagram

Subtitles are added to movie as layer from second projector. This projector is connected to laptop which runs the subtitles application. Laptop screen is black except the white subtitles.

Things you need:
* projector
* Laptop
* operating person (Toksija)

Subtitles in program screen

Screenshot of programm running

Subtitle file format

Most simple text file. Use file-> save as… -> unicode text file from Word document. Subtitles are separated by single empty line.

Example of subtitle.txt:

Are you nuts?!

- The joy of being a woman...

Bloody hell!

The joy of being a woman...î

Did you just fall off
the turnip truck? (Two line title)

And here goes another subtitle...

How this application is made

This application is a full screen flash that reads subtitles from text file and shows them one by one. There’s no automatic timing, person behind laptop must click from one to next. Sounds clumsy? Yet for movie that is only shown once its good enough and it requires no preparation. On the flash side, it has scale mode of exact fit and is always resized to full screen. Subtitles text field uses device fonts and depends on system code page, so you can display whatever characters windows can display. Text size can be changed run time and if you want your subtitles on top of the movie screen there is a second version of the program just for that.

I used Screenweaver to extend flash for browsing subtitle text file and to force application to always be full screen and on top of other windows. Screenweaver also packs Flash player into executable, so it works out of box on any windows computer.

Download it here: subtitles_app.zip

Eero Koplimets Uncategorized , , ,

EncryptedLocalStore speed test

February 5th, 2009

For intoduction read my saving data with adobe AIR post

Saving data to user computer with Adobe AIR EncryptedLocalStore class is simple and syncronous process. API is very straight forward and easy to implement. Nontheless be aware that syncronous code execution in actionscript means your application UI will hang until all of the data saveing or loading is finished. This freez can ruin application user experience, so we need to predict if the hang time is over normal and then try to soften the impact with “please wait” message.

So, test the speed test… all tests are done on Macbook Pro 2,4 Ghz.

Adobe AIR data encryption and write/read speed chart

Adobe AIR write read performance chart

OSX

Test 1: 0,25Mb file

first time save: 2500ms, load 200ms
save time: 200ms, load time:150ms

Test 2: 6.5mb file
save: 2700ms, load:2700ms

Windows Vista

Test 1: 0,25Mb file

first time save: 857ms, load 162ms
save time: 180ms, load time:179ms

Test 2: 6.5mb file
save: 6300ms, load:3900ms

Conclusion

The first time encrypted local store is used expect +500ms penalty.

The maximum usable single save data size is around 5mb. For slow computers even this causes over 10 seconds of hang time.

There seems to be no difference if storage already contains data, write/load time remains almost the same. So maybe splitting up large data can result better user experience.

Windows is several times slower.

Test by yourself:

Eero Koplimets AIR

Ways to store data with Adobe AIR

February 2nd, 2009

There are four ways you can store data to user computer with Adobe AIR:

  1. Save to file
  2. Save to local shared object
  3. Save to local sqlite database
  4. Save to encrypted local storage

Most AIR applications I’ve seen use first and second options.

AIR applications can read and write to file, but Adobe recommends to use application storage directory for application specific data. The application storage folder is in ‘/Users/username/Library/Preferences/appID/Local Store/’. (All folders examples are on OSX, windows has equivilent ‘users/username/application data/…). Writing files there is fast, but you must handle encoding decoding of data yourself and there is no built-in encryption.

The second way (also used in web flash), is to write data to local shared object ie flash cookie. This works great for user preferences as it’s fast and requires no encoding/decoding. Actual data is saved in flash player iternal AMF format to folder: ‘/Users/username/Library/Preferences/appID/Local Store/#SharedObjects/’

Third way to store data is by creating local sqlite database, save it to file and access it with the built-in sqlite API. Advantages are sqlite sorting/search etc.

The least known and used method to store data is with EncryptedLocalStore class. The purpose of this class is to enable store sensitive data to user machine with strong (and relativly fast) encryption. This mechanism uses operating system features- Keychain on OSX and DPAPI on Windows. Encryption used in both cases is 128-bit AES-CBC. Adobe recommended maximum data size 10MB.

Encrypted files are stored in folder: ‘/Users/username/Library/Application Support/Adobe/AIR/ELS/{appID}/’.

Adobe AIR EncryptedLocalStore API

Very straight forward – all data is stored syncronously as key-value pairs to encrypted hastable. Key type is String; value binary BytesArray type.

API is very simple:

EncryptedLocalStore.setItem(storeKey, dataBytes);
EncryptedLocalStore.getItem(storeKey);

EncryptedLocalStore.removeItem(storeKey);
EncryptedLocalStore.reset();

Example code:

//Writing encrypted data
var bytes:ByteArray = new ByteArray();

//write string text as UTF8 bytes
bytes.writeUTFBytes("Any string can be here");
EncryptedLocalStore.setItem("MyDetails", bytes);


//Reading encrypted data
var storedBytes:ByteArray = EncryptedLocalStore.getItem("MyDetails");

//read bytes as they were UTF8 encoded string
var myValue:String = storedBytes.readUTFBytes(storedBytes.length));
trace(myValue);

Eero Koplimets AIR , ,

Oh hi!

October 3rd, 2008

“I will start a blog!” ran thought my mind after finding out that my last homepage update was two years ago. “Yeah, blogging is easy… and cool” was second idea. So here I go.

My goal with the blog is to charm readers with information of things I know best (and work with) – Adobe Flash, Adobe Flex and AIR. You should hear mostly about my own ideas and experiments, but as my profession requires I must keep myself updated with latest happenings and here you might also find posts to things that wow me.

For introduction. My name is Eero Koplimets, I’m 25yo estonian now living in Prague, Czech Republic Tallinn, Estonia. I work for Skype as Senior Flash developer. I’ve been more or less related to flash world since the Macromedia Flash 4 hit the road back in 1999.

Eero Koplimets life , ,