ArticleDirectory
- 1. subtitle file
- 2. Specify the encoding format of subtitle files
- 3. Specify the subtitle font
- 1. Two execution files, three startup methods, and four configuration files
- 2. Modify ~ /. Mplayer/config
- 3. Modify ~ /. Mplayer/GUI. conf
- 4. Enable mplayer to automatically recognize and load subtitle files
Mplayer subtitle garbled Problem Solution
By Soli
I. tailism
If you are in a hurry to watch a movie, open the movie with the following command to display Subtitles:
Mplayer-sub name_of_movie.srt-subcp cp936-Font/usr/share/fonts/TrueType/arphic/gkai00mp. TTF name_of_movie.avi
Note:
- -Sub is followed by a subtitle file-subcp is followed by the encoding format of the subtitle file-font is followed by a font file that supports Chinese Characters
- In addition, ensure that the encoding format of the subtitle file must be consistent with the encoding format specified by the-subcp option (iconv can be used to convert each encoding ).
- The four are indispensable.
Ii. Command Line Parameters
If you haven't solved the problem of subtitle Garbled text through the above command, please read the following content patiently and make corresponding adjustments according to your specific situation, you can see normal subtitles. If the code is still garbled, leave a message and we will discuss the solution together.
1. subtitle file
To enable mplayer to display subtitles, you must have a correct subtitle file. If you do not have any subtitle files, go to shooter.cn to search for them.
Generally, subtitle files downloaded from the Internet are in the cp936 encoding format. If not, use iconv conversion. For example, to convert utf8 to cp936, the command is as follows:
Iconv-F utf8-T cp936-O name_of_movie.cp936.srt name_of_movie.utf8.srt
With the subtitle file, you must tell mplayer which subtitle file to use. You can use the-sub option.
2. Specify the encoding format of subtitle files
In fact, you do not need to convert the encoding format of subtitle files. Instead, use the mplayer Command Option-subcp to tell mplayer what encoding format the subtitle file is.
3. Specify the subtitle font
If the above two options are correctly specified and the subtitles are garbled, it should be the font issue. The default font file (~ /. Mplayer/subfont. TTF) Languages (such as Chinese) that do not support subtitles ). -Font must be used to specify a Chinese font. I usually use the font/usr/share/fonts/TrueType/arphic/gkai00mp. TTF
3. Configuration File
After the above three steps, start mplayer on the command line to watch a movie. You should be able to see normal subtitles.
However, it is really troublesome to enter such a long command every time. Below we will write these options into the configuration file, so that you can directly mpalyer some. Avi or right-click "open with mplayer.
1. Two execution files, three startup methods, and four configuration files
First, we need to know: Two execution files, three startup methods, and four configuration files. The two execution files are mplayer and gmplayer. The three startup modes are mplayer, gmplayer, and right-click. The four configuration files are/etc/mplayer. conf,/usr/local/etc/mplayer. conf ,~ /. Mplayer/config and ~ /. Mplayer/GUI. conf.
Right-click the mplayer or gmplayer, and both of them exist. The right-click menu contains two projects named "open with mplayer.
For configuration files, the first two configuration files are global and may not exist. The lowest priority. You can leave it alone.
~ /. Mplayer/config can be used for mplayer and gmplayer.
~ /. Mplayer/GUI. conf is only used for gmplayer. Therefore, many people modify the options in this configuration file, but it does not work if it is started with mplayer.
Their relationships are as follows:
Priority |
Configuration File |
Mplayer |
Gmplayer |
Low |
/Usr/local/etc/mplayer. conf |
Use |
Use |
Low |
/Etc/mplayer. conf |
Use |
Use |
High |
~ /. Mplayer/config |
Use |
Use |
Highest |
~ /. Mplayer/GUI. conf |
|
Use |
Therefore, if you are used to using mplayer, modify it ~ /. Mplayer/config. If you are used to using gmplayer, modify ~ /. Mplayer/GUI. conf. It is best to modify these two configuration files at the same time without moving the two global configuration files.
2. Modify ~ /. Mplayer/config
First modify ~ /. Mplayer/config. Add the following two items:
Subcp = "cp936"
Font = "/usr/share/fonts/TrueType/arphic/gkai00mp. TTF"
Because the subtitle files of different movies are different, you cannot specify the subtitle files in the configuration file. The following describes how to enable mplayer to automatically recognize and load subtitle files. The encoding format of the subtitle file is cp936. Therefore, you must convert the downloaded subtitle file to this encoding format. You can select a Chinese font you like.
3. Modify ~ /. Mplayer/GUI. conf
Then modify ~ /. Mplayer/GUI. conf. As follows:
Sub_cp = "cp936"
Font_name = "/usr/share/fonts/TrueType/arphic/gkai00mp. TTF"
It can be seen that the same configuration file has different names for the same configuration item. Please note that you should not confuse it. Otherwise, mplayer will complain about "Warning unknown option sub_cp at line 3" and the subtitles are still garbled.
The encoding format and font of the subtitle file are all ready. The rest is to let mplayer find the corresponding subtitle file.
4. Enable mplayer to automatically recognize and load subtitle files
The simplest thing is to modify the subtitle file so that it has the same name as the movie (excluding the last extension ).
Sometimes the subtitle files we download are like name_of_movie.chs.srt and name_of_movie.cht.srt. If you need to modify the name of the subtitle file every time, it is a bit troublesome. In fact, we can use the following method to make mplayer smarter.
In the configuration file ~ /. Add the following two lines to mplayer/config:
Slang = "CHS, CHT, eng"
Sub-Fuzziness = 1
The second line indicates adjusting the matching blur degree when searching for Subtitles: 0 indicates exact match (the subtitle file name must be exactly the same as the movie file name, excluding the extension ); 1. Load all subtitles containing the movie name (with the higher priority of the language specified by slang); 2. Load all subtitles in the current directory.
The first line indicates that the title file name contains the CHS (such as name_of_movie.chs.srt), name_of_movie.cht.srt, and name_of_movie.eng.srt, find another subtitle file with a file name.
5. Target gmplayer
In addition, for gmplayer, in the configuration file ~ The following two items need to be modified or noticed in/. mplayer/GUI. conf:
Sub_auto_load = "yes"
Sub_unicode = "yes"
You can directly modify the configuration file or use the graphic interface. The method is as follows:
Right-click gmplayer,
- Preferences-> subtitle & OSD
- Select Simplified Chinese charset (cp936) at encoding );
- Select "Unicode subtitle ";
- Deselect "Disable subtitle autoloading ";
- Preferences-> font
- Enter the full path of the font file (for example,/usr/share/fonts/TrueType/arphic/gkai00mp. TTF );
- Select Unicode at encoding.
Iv. Final
So far, if you haven't solved the problem of subtitle Garbled text, please leave a message to discuss it together.