Saturday, October 27, 2007


「本來諗住關心下佢… 點知越講越衰」

Thursday, October 25, 2007

12 years

what can you accomplish in 12 years?

Sunday, October 21, 2007

DVD authoring

Recently downloaded a video in MKV format. MKV is quite a popular format when distributing video contents. One of the reasons is that MKV is extremely flexible. It can virtually mix any video/audio content in it. But this also posts a challenge when converting it.

First, let's check what is in the MKV file so that we know what to do. mkvtoolnix is a handy tool for that. Use the mkvmerge command to see the file structure:

mkvmerge -i 5Centimeter.mkv

And this is the output for my MKV file:

File '5Centimeter.mkv': container: Matroska
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_AC3)
Track ID 3: subtitles (S_VOBSUB)
Track ID 4: subtitles (S_TEXT/ASS)

Here is the analysis:

  • The first track is the video in MPEG4 format. We will need to convert it to MPEG2 for DVD

  • The second track is the audio in AC3 format. We can just reuse it in the DVD. No conversion required

  • The video is a Japanese anime and track 3 is the subtitle file

  • Someone is nice enough to include a translation of the subtitle in Simplified Chinese format in track 4. But note that it is in text format . So we will need to convert it into image format for the DVD

Initially I thought I could use avi2dvd to do most of the conversion jobs since it supports MKV format and subtitle generation etc. But after several days of struggle, I concluded that it can't handle Chinese subtitle nicely. So instead, I just used it to do the video and audio conversion, format/frame rate changes, pull down etc tedious tasks and generate a "DVD ready" ISO for me, without the subtitles.

avi2dvd is actually an GUI for many freeware programs. There are many options to choose from. BTW, I used the HCenc encoder, which is slow (almost 3 hours to encode the 1 hour video on my 3200+) but is supposed to give good result.

Once we have the ISO file, we need to demux it. This is to get the converted video (and audio) files so that we can multiplex them with the subtitles. I used VobEdit for that.

The subtitle requires lots of work here. First, use mkvmerge to extract the text from track 4 into a file. It is in SRT format with GB encoding. As I couldn't find a freeware tool that can handle SRT directly for DVD authoring, so here is the process on how to convert it into SUP format:

  • Since I prefer to read Traditional Chinese, so I used ConvertZ to convert the content into Big5.

  • Use Subtitle Workshop to convert the SRT file into Substation Alpha (SSA) format

  • Use MaestroSBT to convert the SSA file into SON, with the text rendered as bitmap. Choose the output to be 4-bit compressed bitmap files. Since I am rendering Chinese text with Big5 encoding, I changed the default font setting. Also need to adjust the margin etc. In the Color Rendering section, I chose "Two colors for text, one for outline, no antialias". Note down the color used. We will need this info later.

  • Use son2vobsub to convert the SON file to SUB format

  • Use SubToSup to convert the SUB file into SUP format

... and finally... we have a usable subtitle file... orz...

Next, use IfoEdit for the final mutliplexing. Choose "DVD Author" -> "Author new DVD". Select the video, audio and subtitle files. Set the correct language for the audio and subtitle. Then click OK to generate the DVD files (those VOB, IFO etc files).

Then a little trick. Since the subtitle is generate in specific colors, we need to set it in the IFO file so that it can overlay nicely on the video. In IfoEdit, select the "VTS_PGCITI"->"VTS_PGC_1" node. Then look for the "Color 0 Y Cr CB", "Color 1 Y Cr CB" etc entries. They are the color codes for the subtitle:

Color 0 = Background
Color 1 = Outline
Color 2 = Letters
Color 3 = Anti-alias

Here are the codes for different colors:

White: EB 80 80
Brown: 30 B8 6D
Black: 10 80 80
Green: 50 50 5A
Oliv: 71 89 47
Naval: 1C 76 B8
Púrple: 3D AF A5
Turquese: 5D 47 92
Grey: 7D 80 80
Silver: B4 80 80
Red: 51 EF 5A
Lime: 90 22 35
Yellow: D2 92 10
Blue: 28 6D EF
Fucsia: 6A DD CA
Aqua: A9 10 A5

Change the values to reflect the colors used when we generate the subtitle images using MaestroSBT. Click "Save" to update the IFO. Then click "Disc Image" to generate the final ISO.

Preview the ISO. To get the position right, I needed to re-generate the subtitle file a few times... orz. When everything is OK, use a burning program (e.g. DVD Decryptor) to burn the image to a DVD-R... and we are done!

Saturday, October 20, 2007

Encoding video for N80

The Nokia N80 has a bright and (relatively) high resolution screen (352x416). But unfortunately, the RealPlayer on the phone can't play MP4 streams at the max native resolution. After some trail-n-error and some googling, here are the settings for encoding video for N80:

  • File format: MP4

  • Video codec: MPEG-4

  • Audio codec: AAC

  • Resolution: 352x288

Monday, October 15, 2007

十下十下 Revolution

係剛過去既星期六又係「十下十下」中渡過。五個人烚下烚下又一晚。今次唯一特別係我除左事前洗洗切切一輪之外,其餘買料呀,食完之後洗砂煲罌罉之類 D 粗重野全部有人代勞…哈哈,爽呀!

不過唔知點解,經過連續幾個禮拜既「十下十下」,我屋企個雪櫃 D 野不少反多。依家成個雪櫃都係 D 咩丸乜丸、肥牛、烏冬、汽水…… orz

Saturday, October 6, 2007

十下十下 Reloaded


PS. 今次有食烏冬,仲要係「手打烏冬」!事關某人兄話「我呢世人唔係手打烏冬唔食既!!」 :P

Thursday, October 4, 2007



man month

Monday, October 1, 2007


曾幾何時,我個個禮拜都至少會係屋企一個人烚下烚下打邊爐一次的。D 屋企人覺得我好奇怪,一條友有咩好打邊爐。不過… 一條友其實出街亦都冇咩好食 orz …。 可惜,對上一次租住間屋因為太多雜物,連食飯枱都冇張,所以都冇係屋企打邊爐好耐。難得今日係「十一國慶暨搬屋兩個月後終於清曬 d 紙箱有番個廳用」的大日子,決定要十下十下黎慶祝。


新界菜心。$7 斤。又平又靚。食左半斤咋。

$5 金菇。吉之島有 d 好靚既金菇 (個菇頂真係金色嫁!)…不過貴。下次先試。食住 d 平野先!

$20 「游水蝦」半斤。事關六點幾先決定要十下十下,去到街市時已經冇曬活蝦…好在呢 d 蝦都 ok。至少肉質都爽。

$75 澳洲和牛。成餐至貴係佢,不過食落真係唔同 d :p 。

當然唔少得 d 乜丸物丸…仲有雜菜餃添!


湯底一邊係清雞湯加鮮番茄,另一邊係李錦記麻辣湯底 o_0 。

好飽呀!不過係洗洗洗洗洗洗洗完曬 d 碗碗碟碟之後又有 d 餓… 先發覺唔記得食包烏冬… =_="

PS. 同場加映,我終於有番個廳用喇!