понеделник, 7 октомври 2013 г.

How to embed cyrillic subtitles in a video, 2013

Finally I got this to work. I needed to embed Cyrillic subtitles in a video, to be able to watch it on a lame device which likes to screw the subtitles (which it would otherwise read ok).
Anyway, we tried this for quite long but the final try was the working one. I follow this guide.
1. First, locate a working Cyrillic font. I ran a kfind to find Tahoma.TTF
2. Edit ~./mplayer/config
and add:
# Set font.
#set your ttf fonts here, example:
font=/path/to/Tahoma.TTF
# Set font encoding.
subfont-encoding=unicode
# Set subtitle file encoding.
unicode=yes
utf8=yes
3. Close this file.
4. Open your subtitles file with kwrite and then click Save As and pick UTF8 as encoding.
5. Well, that's it, then just use:
$ mencoder -UTF8 -sub movie_subtitle.srt -ovc xvid -xvidencopts bitrate=70000 -oac copy -o new.movie.name.avi movie.avi
and mencoder will do the rest. Well, it takes some time, but it works.
Note, if you do -ovc copy, it won't embed the subtitles, just copy the whole movie.
I'm not sure how high you should go with bitrate.
Also, I've found this: -subfont-text-scale 3
if you want to increase the font size. I haven't tried it yet.
For people wanting to try with cp1251, you can try this link, but it didn't work with me.
You can also read this guide, with which you can do a lot of cool things. But all I need is to embed the subtitles, so I'm fine with this command.
Enjoy!