Thursday, September 11, 2008

Arabic subtitle, how to make it work under Ubuntu.

I had been using dual boot of Microsoft windows and linux for a long time as I couldn't completely migrate to Linux because of immature Arabic support. booting to windows to watch subtitled movies was not uncommon thing I was doing.
Now with complete linux arabic subtitle support , I rarely boot to windows only to play MS flight simulator.
Most of arabic subtitles files are written in windows-1256 character set encoding and very scarse of them are written UTF-8 encoding.


Ubuntu comes with Totem media player that already support arabic subtitles out of the box
just select Edit > Preferences > General > Encoding > Arabic (WINDOWS-1256)
and make sure to select a font that support arabic, mine is set to "Nimbus sans L". Also make sure that the .sub or .srt file has the same file name as the media files without extensionp; ie. for foo.avi .


Mplayer and VLC require fribidi liberary to support arabic, but the stable version is not mature enough to support arabic joining, that why you will get unjoined arabic charcters on subtitles, so you have to install version 2 of fribidi from CVS repository and compile it yourself or if you are using ubuntu or debian , you can download and install a .deb package from here or zshare mirror here.
Then edit $HOME/.mplayer/gui.conf with your favourite text editor and append the following line at the end of the file

sub_cp = "cp1256"

Now subtitles should properly work, just make sure the video file foo.avi has foo.sub, or subtitle file in the same directory.


For VLC you have to install fribidi version 2 as mentioned before and edit $HOME/.vlc/vlcrc with your favourite text editor, and find the following line and comment it


and change the line that begins with "subsdec-encoding" to


save your file and fireup your vlc opening a subtitled media now you should have a working subtitle with arabic joining.
I have VLC 0.8.6e Janus (wxWidgets interface) installed from ubuntu hardy repository and it looks that it suffer from a bug preventing it from loading subtitles having charcters other than letters and numbers in its location and its filename, for example a file location includes something like this "Chaos.Theory[2007]DvDrip[cut].AC3-aXXo" will not work, just rename the video and subtitles filenames and directory names if needed.


A good thing about fridbidi version 2 is that it will fix arabic shaping/joining problems for other applications that use it like amsn.

Install the arabic fonts package ttf-arabeyes from repository by

sudo apt-get install ttf-arabeyes


Anonymous said...

thanks a lot your description is too helpfull

Anonymous said...

thanx bro

Anonymous said...

thanx bro , u r agood helper

nima said...

Thanks for sharing your experience
May you give me instructions for getting fribidi? because I could not get!!

Thanks for any help or guidance

nima said...

Thanks I have created Debian package for amd64 and problem has been solved.
Again thanks a lot

puat133 said...

Banshee version please..