I’ve been using mplayer for nearly 5 years since my first experience on Fedora Linux.
This time I found that mplayer in Fedora 12 cannot display Chinese subtitle correctly even I am using a correct mplayer config file when it plays videos.
After trying for several times and searching on Google, I found out that it was due to my locale setting.
According to wikipedia: locale is a set of parameters that defines the user’s language, country and any special variant preferences that the user wants to see in their user interface.
I’ve set my locale to en_US.utf-8 globally.But the mplayer in Fedora 12 needs LC_CTYPE to be set to my language code (zh_CN.utf-8) to display the Chinese subtitle. So this becomes easy to solve.
First I think you should make sure that you have a mplayer config file which contains a line subcp=cp936.
Then choose one of the following ways to do:
1. add a line LC_CTYPE=zh_CN.utf-8 (substitute this for yours) to /etc/sysconfig/i18n, this will affect your LC_CTYPE globally.
2. modify .bashrc in the user’s home directory, and add a line LC_CTYPE=zh_CN.utf-8 (substitute this for yours) to the end of it. This will just affect the user itsself.
3. add LC_CTYPE=zh_CN.utf-8 before mplayer, like this:
$LC_CTYPE=zh_CN.utf-8 mplayer my_file_to_play
I don’t think this will affect any locale settings except mplayer, but you need to type such a long command every time. So the better way is add a alias to .bashrc.
alias mplayer='LC_CTYPE=zh_CN.utf-8 mplayer'
Now you can simply type mplayer like before to play your favourite videos with Chinese subtitles displayed correctly.
P.S. This is my first English Blog entry.
mplayer中文字幕显示问题解决方法:
1.如果locale设置为zh_CN,那么请检查mplayer的配置文件 ~/.mplayer/config,看是否存在subcp=cp936一行,没有请添加。添加后即可解决。
1.1 如果仍然不显示,请查看mplayer提示信息,可能原因是字幕字体设置问
题,这时可以在.mplayer目录中做字体的软链接。
ln -s /font_dir/font.ttf ~/.mplayer/subfont.ttf
然后在config文件中添加subfont=~/.mplayer/subfont.ttf
2.如果mplayer配置文件没有问题,请检查locale中的LC_CTYPE设置,将其更改为LC_CTYPE=zh_CN.utf-8
方法:
2.1 在/etc/sysconfig/i18n添加 LC_CTYPE=zh_CN.utf-8
2.2 修改用户主目录.bashrc,添加 LC_CTYPE=zh_CN.utf-8
2.3 临时在shell里修改当前shell的LC_CTYPE,执行 $LC_CTYPE=zh_CN.utf-8
2.4 或者在mplayer之前加上LC_CTYPE=zh_CN.utf-8,然后执行 LC_CTYPE=zh_CN.utf-8 mplayer videofile_to_play
先写这么多吧,欢迎指正。










