My words on free/open source software

Friday, October 31, 2008

mplayer and ASS subtitles in UTF-16 with BOM

Tina got a piece of .mkv video with ASS subtitles, which was in UTF-16 and began with BOM (0xFF 0xFE), perhaps generated by using some programs from Windows kingdom. mplayer can't load ASS that begins with BOM and produces the following error message:


Matroska file format detected.
VIDEO: [avc1] 864x480 24bpp 23.976 fps 0.0 kbps ( 0.0 kbyte/s)
SUB: Could not determine file format
Cannot load subtitles: file.ass


The remedy:

  1. Convert the ASS file to UTF-8 (or whatever encoding you are comfortable with). I used iconv: iconv -f utf16 -t utf8 < file.ass > result.ass

  2. Play it by using the "-utf8" switch of mplayer: mplayer -ass -utf8 file.mkv. If the ASS contains special characters (such as CJK chars), use a good font by "-font /usr/share/font/cjk.ttf"

2 comments:

Unknown said...

<:3~
Thanks.

Anonymous said...

To hardcode .ass, .srt, .sub to video, you may try iDealshar VideoGo with this easy guide at http://www.idealshare.net/video-converter/add-ass-to-video-avi-mp4-mkv-vob.html

About Me

My photo
Santa Cruz, California, United States