Home » Linux

mplayer使用中文字幕

By: Zhiqiang Ma On: Jan 13, 2010 Views: 87 No Comment Print Email
Tags: , , , ,

mplayer使用中文字幕文件时经常会出现乱码问题. 以下是解决办法:

1. 外挂字体方法

比如当前目录下有文件为Gone\ with\ the\ Wind.avi, 字幕文件为: Gone.With.the.Wind.1939.Bluray.720p.DTS.2Audio.x264-CHD.chs.srt

可以使用如下命令来播放, 将不会出现中文字幕乱码的问题了:

mplayer -ass -subcp cp936 Gone\ with\ the\ Wind.avi -sub Gone.With.the.Wind.1939.Bluray.720p.DTS.2Audio.x264-CHD.chs.srt

对于以上参数的解释:
-ass: Turn on SSA/ASS subtitle rendering. With this option, libass will be used for SSA/ASS external subtitles and Matroska tracks. You may also want to use -embeddedfonts. NOTE: Unlike normal OSD, libass uses fontconfig by default. To disable it, use -nofontconfig.

-subcp codepage: Specify the subtitle codepage.
The Chinese character codepages:
936 — GBK Supports Simplified Chinese 简体中文
950 — Supports Traditional Chinese 繁体中文

-sub: Use these subtitle files.

另外可以使用sub-fuzziness参数来自动加载字幕文件:
-sub-fuzziness mode: Adjust matching fuzziness when searching for subtitles:
0 exact match
1 Load all subs containing movie name.
2 Load all subs in the current directory.

2. 内嵌字体方法

对于mkv, ogm等内嵌字体文件格式, 可以使用 sid 选项选择内嵌字体:
-sid ID: Display the subtitle stream specified by ID (0-31). MPlayer prints the available subtitle IDs when run in verbose (-v) mode. If you cannot select one of the subtitles on a DVD, also try -vobsubid.

如ID为1的字幕为简体中文:

mplayer *.mkv -sid 1 -subcp cp936

硬盘上的DVD内容:
mplayer dvd://1 -dvd-device /xxx/dvd -sid 0 -subcp cp936

Read more:

Digg del.icio.us Stumble Techorati Facebook Newsvine Reddit Twitter
Mixx LinkedIn Google Bookmark Yahoo Bookmark MySpace LiveJournal Blogger RSS feed
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.