example 1.
在ffmpeg 加入libass时, 如果找不到libass, 可在脚本中加入
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/ass/lib/pkgconfig
./ffmpeg -f mpegts -i ../film1.ts -an -c:v libx264 -vf "subtitles=tt.srt" ff.ts
./ffmpeg -f mpegts -i ../film.v -an -c:v libx264 -s 720x480 -b:v 1000k -vf "ass=tt.ass" ass.ts
记得将下述文本保存为utf-8格式
1
00:00:00,000 --> 00:00:01,284
《吸血鬼日记》前情提要
Previously on "the vampire diaries"...
2
00:00:01,335 --> 00:00:02,835
吸血鬼和狼人过去可以自由地出没
Vampires and werewolves used to roam freely
3
00:00:02,920 --> 00:00:05,839
直到一个巫师对他们施加了诅咒来限制他们的能力
Until a shaman put a curse on them to limit their power.
4
00:00:05,840 --> 00:00:08,091
从那以后,狼人们只能在满月时变身
Since then, werewolves can only turn on a full moon
5
00:00:08,142 --> 00:00:09,509
而吸血鬼不能见日光
And vampires are weakened by the sun.
6
00:00:09,594 --> 00:00:12,562
狼人的诅咒封印在月光石中
The werewolf part of the curse, it's sealed with a moonstone.
7
00:00:12,630 --> 00:00:14,464
他跟我说了你的前女友 Katherine
So tell me about your ex, Katherine?
8
00:00:14,515 --> 00:00:15,465
你一定是Elena
You must be Elena.
9
00:00:15,516 --> 00:00:17,267
我们怎么会长得一模一样
How do we look exactly alike?
2. tt.ass file
[Script Info]
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: *Default,微软雅黑,21,&H00FFFFFF,&H0000FFFF,&H2D804000,&H32000000,-1,0,0,0,100,100,0,0,0,2,1,2,5,5,5,134
Style: logo,微软雅黑,21,&H00FFFFFF,&HF0000000,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,2,1,2,5,5,5,134
[Events]
Format: Layer, Start, End, Style, Actor, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.03,0:00:01.55,*Default,NTP,0000,0000,0000,,吸血鬼日记前情提要\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}Previously on "the Vampire Diaries"...
Dialogue: 0,0:00:01.58,0:00:04.51,*Default,NTP,0000,0000,0000,,Elena很享受你们兄弟俩对她的爱慕吧\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}Does Elena enjoy having both of you worship at her altar?
Dialogue: 0,0:00:04.51,0:00:05.44,*Default,NTP,0000,0000,0000,,我听说过你\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}I've heard about you,
Dialogue: 0,0:00:05.46,0:00:07.72,*Default,NTP,0000,0000,0000,,疯狂又冲动的吸血鬼\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}the crazy,impulsive vampire
Dialogue: 0,0:00:07.76,0:00:09.24,*Default,NTP,0000,0000,0000,,爱上了弟弟的女朋友\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}in love with his brother's girl.
Dialogue: 0,0:00:09.27,0:00:10.11,*Default,NTP,0000,0000,0000,,Stefan在哪儿\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}Where's Stefan?
Dialogue: 0,0:00:10.13,0:00:12.11,*Default,NTP,0000,0000,0000,,为了救他哥哥 他把自己献给了Klaus\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}He gave himself over to Klaus to save his brother.
Dialogue: 0,0:00:12.14,0:00:14.77,*Default,NTP,0000,0000,0000,,Klaus是有狼人血统的吸血鬼\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}Klaus is a vampire born of a werewolf bloodline.
Dialogue: 0,0:00:14.77,0:00:16.89,*Default,NTP,0000,0000,0000,,诅咒使他体内的狼人特征无法显现出来\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}The curse has kept his werewolf aspect from manifesting,
Dialogue: 0,0:00:16.90,0:00:19.10,*Default,NTP,0000,0000,0000,,一旦他打破诅咒 他就变成了彻底的混血\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}but if he breaks it, he'll be a true hybrid.
Dialogue: 0,0:00:19.13,0:00:21.41,*Default,NTP,0000,0000,0000,,我要创造更多像我这样的\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}I want to create more of me.
Dialogue: 0,0:00:21.44,0:00:23.72,*Default,NTP,0000,0000,0000,,你可是我这么久来见到的第一个狼人\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}Now, you being the first werewolf I've come across,
Dialogue: 0,0:00:23.75,0:00:26.14,*Default,NTP,0000,0000,0000,,我要你带我去你的部落\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}I need you to direct me to your pack.
Dialogue: 0,0:00:26.18,0:00:27.24,*Default,NTP,0000,0000,0000,,你知道我死过 对吧\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}You know I died, right,
Dialogue: 0,0:00:27.27,0:00:29.72,*Default,NTP,0000,0000,0000,,然后Bonnie用魔力让我起死回生\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}and Bonnie used magic to bring me back to life?
Dialogue: 0,0:00:29.78,0:00:32.95,*Default,NTP,0000,0000,0000,,自从我复活后 我总能看到些不该看到的东西\N{\1c&HFFFFFF&}{\3a&H82&\4c&H030303&}{\fnArial Black}{\fs20}{\b1}{\fe0}{\shad1}{\3c&H030303&}{\4c&H030303&}Ever since I came back, I've been seeing things I shouldn't be seeing.