0

arial.ttf 存在于 C:\Windows\Fonts 文件夹中。跑步

ffmpeg.exe -i D:\imagesequence\test.mov -vf drawtext="arial.ttf=':text='TEST'" D:\imagesequence\testo.mov

或者

ffmpeg.exe -i D:\imagesequence\test.%04d.jpg -vf drawtext="arial.ttf=':text='TEST'" D:\imagesequence\testo.mov

结果是

ffmpeg.exe -i D:\imagesequence\test.%04d.jpg -vf drawtext=fontf
ile="arial.ttf=':text='TEST'" D:\imagesequence\testo.mov
ffmpeg version N-34549-g13b7781, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov  6 2011 22:02:08 with gcc 4.6.1
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope
ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en
able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger -
-enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
  libavutil    51. 24. 0 / 51. 24. 0
  libavcodec   53. 28. 0 / 53. 28. 0
  libavformat  53. 19. 0 / 53. 19. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 47. 0 /  2. 47. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Input #0, image2, from 'D:\imagesequence\test.%04d.jpg':
  Duration: 00:00:01.24, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p, 768x576 [SAR 1:1 DAR 4:3], 25 fps, 25 t
br, 25 tbn, 25 tbc
File 'D:\imagesequence\testo.mov' already exists. Overwrite ? [y/N] y
w:768 h:576 pixfmt:yuvj420p tb:1/1000000 sar:1/1 sws_param:
[drawtext @ 01C80260] Could not load fontface from file 'arial.ttf=': cannot ope
n resource
Error initializing filter 'drawtext' with args 'fontfile=arial.ttf=:text=TEST'
Error opening filters!
4

1 回答 1

1

LordNeckbeard 是正确的,您需要使用“fontfile”指定您尝试使用的字体的完整路径。此外,如果您的输入和输出文件位于同一目录中,则无需指定它们各自的目录(省去了命令行的麻烦)。在您的情况下,这应该有效:

ffmpeg.exe -i test.mov -vf drawtext=fontfile=/Windows/Fonts/arial.ttf:text="TEST" testo.mov
于 2012-06-18T17:23:15.887 回答