FFmpeg |字幕格式的字幕

时间:2018-10-25 11:43:47

标签: ffmpeg subtitle

我想生成带有动态字体的字幕

[Script Info]
ScriptType: v4.00+
PlayResX: 1280
PlayResY: 720
Title: WoFox

[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,Arial,30,&Hffffff,&Hffffff,&H0000FF,&H0000FF,0,0,0,0,100,100,5,0,3,1,0,3,10,10,10,1
Style: Default1,/home/nodeuser8/tmp/CharmonmanRegular.ttf,40,&Hffffff,&Hffffff,&H0000FF,&H0000FF,0,0,0,0,100,100,5,0,3,1,0,3,10,10,10,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,00:00:00.0,00:00:03.0,Default,,0,0,0,,My first subtitle! Click this text to edit
Dialogue: 0,00:00:00.0,00:00:03.0,Default1,,0,0,0,,This box shows the amount of text that fits into one caption. As you change the style of the captions, you can preview how

我的ffmpeg代码是

ffmpeg -i ./tmp/source.mp4 -t 5 -filter_complex "ass=filename=./tmp/subtitles.ass" ./t mp/output.mp4 -y

但是我没有得到预期的输出。

控制台是

[Parsed_ass_0 @ 0x58680c0] Shaper: FriBidi 1.0.5 (SIMPLE)
[Parsed_ass_0 @ 0x58680c0] Using font provider fontconfig
[Parsed_ass_0 @ 0x58680c0] Added subtitle file: './tmp/subtitles.ass' (3 styles, 2 events)
Stream mapping:
  Stream #0:0 (h264) -> ass (graph 0)
  ass (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[Parsed_ass_0 @ 0x5cd4180] Shaper: FriBidi 1.0.5 (SIMPLE)
[Parsed_ass_0 @ 0x5cd4180] Using font provider fontconfig
[Parsed_ass_0 @ 0x5cd4180] Added subtitle file: './tmp/subtitles.ass' (3  styles, 2 events)
[Parsed_ass_0 @ 0x5cd4180] fontselect: (Arial, 400, 0) -> /usr/share/fonts/liberation/LiberationSans-Regular.ttf, 0, LiberationSans
[Parsed_ass_0 @ 0x5cd4180] fontselect: (/home/nodeuser8/tmp/CharmonmanRegular.ttf, 400, 0) -> /usr/share/fonts/dejavu/DejaVuSans.ttf, 0, DejaVuSans
[libx264 @ 0x5869880] using SAR=1/1
[libx264 @ 0x5869880] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x5869880] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x5869880] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 Output #0, mp4, to './tmp/output.mp4':

我在这里尝试从/home/nodeuser8/tmp/CharmonmanRegular.ttf加载字体,但是ffmpeg从/usr/share/fonts/dejavu/DejaVuSans.ttf加载字体。

那么如何为ass字幕加载字体文件?

0 个答案:

没有答案