FFmpeg drawtext = enable'between(t,0,5)'不起作用

时间:2018-07-24 16:20:14

标签: video ffmpeg drawtext

我正在尝试使用ffmpeg在不同的时间间隔在视频上绘制文本。以下是我的说明:

    ffmpeg -i input.mp4 -vf "drawtext=fontfile='C:\arial.ttf':text='Text1':x=5:y=20+24-max_glyph_a:fontsize=24:fontcolor=yellow:box=1:boxcolor=black@0.5:boxborderw=5:enable='between(t,0,20)', drawtext=fontfile='C:\arial.ttf':text='Text2':x=100:y=20+24-max_glyph_a:fontsize=24:fontcolor=yellow:enable='between(t,5,20)', drawtext=fontfile='C:\arial.ttf':text='Text3':x=200:y=20+24-max_glyph_a:fontsize=24:fontcolor=yellow:enable='between(t,10,20)'" output.mp4

我试图在水平线上绘制文本,在开始的5秒内只希望使用Text1,然后在5秒到20秒之间只希望使用Text2,而从10秒到结束则只希望Text3。

执行此操作时,我的第一个文本停留约15秒钟,而后两个则出现在视频的最后4秒钟中。我的指令有问题吗?我是否正确使用了启用功能?

以下是ffmpeg -i input.mp4 -vf showinfo -vsync 0 -f null-:

的日志
    ffmpeg version N-91399-g9f0077cc03 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 18.102 / 56. 18.102
  libavcodec     58. 20.104 / 58. 20.104
  libavformat    58. 17.101 / 58. 17.101
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 25.100 /  7. 25.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'onlyVideo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf56.37.100
  Duration: 00:00:20.00, start: 0.000000, bitrate: 73 kb/s
    Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 640x720 [SAR 1:1 DAR 8:9], 73 kb/s, 0.20 fps, 0.20 tbr, 16384 tbn, 1 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[Parsed_showinfo_0 @ 0000019e4ef73140] config in time_base: 1/16384, frame_rate: 1/5
[Parsed_showinfo_0 @ 0000019e4ef73140] config out time_base: 0/0, frame_rate: 0/0
[Parsed_showinfo_0 @ 0000019e4ef73140] n:   0 pts:      0 pts_time:0       pos:       44 fmt:yuv420p sar:1/1 s:640x720 i:P iskey:1 type:I checksum:850631B2 plane_checksum:[6C2678F8 6C5D6575 C2075336] mean:[191 121 133 ] stdev:[67.7 11.8 8.5 ]
[Parsed_showinfo_0 @ 0000019e4ef73140]   side data - unknown side data type 17 (1845 bytes)
[Parsed_showinfo_0 @ 0000019e4ef73140]   side data - unknown side data type 16 (8 bytes)
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.17.101
    Stream #0:0(und): Video: wrapped_avframe, yuv420p, 640x720 [SAR 1:1 DAR 8:9], q=2-31, 200 kb/s, 0.20 fps, 0.20 tbn, 0.20 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.20.104 wrapped_avframe
[Parsed_showinfo_0 @ 0000019e4ef73140] n:   1 pts:  81920 pts_time:5       pos:    37980 fmt:yuv420p sar:1/1 s:640x720 i:P iskey:0 type:P checksum:D4B0BD28 plane_checksum:[E0310E7B DC71FA0B 97BCB493] mean:[31 127 132 ] stdev:[25.6 28.9 27.1 ]
[Parsed_showinfo_0 @ 0000019e4ef73140]   side data - unknown side data type 17 (1845 bytes)
[Parsed_showinfo_0 @ 0000019e4ef73140]   side data - unknown side data type 16 (8 bytes)
frame=    2 fps=0.0 q=-0.0 size=N/A time=00:00:10.00 bitrate=N/A speed=11.1x    
[Parsed_showinfo_0 @ 0000019e4ef73140] n:   2 pts: 163840 pts_time:10      pos:    67732 fmt:yuv420p sar:1/1 s:640x720 i:P iskey:0 type:P checksum:9FC30D4F plane_checksum:[1F10F7EB 45F39329 BED7821D] mean:[60 123 125 ] stdev:[61.8 11.0 5.5 ]
[Parsed_showinfo_0 @ 0000019e4ef73140]   side data - unknown side data type 17 (1845 bytes)
[Parsed_showinfo_0 @ 0000019e4ef73140]   side data - unknown side data type 16 (8 bytes)
[Parsed_showinfo_0 @ 0000019e4ef73140] n:   3 pts: 245760 pts_time:15      pos:   133778 fmt:yuv420p sar:1/1 s:640x720 i:P iskey:0 type:P checksum:9F501A92 plane_checksum:[D1B4E4A7 C4CD0DFA EB7E27E2] mean:[162 129 139 ] stdev:[71.7 27.3 37.2 ]
[Parsed_showinfo_0 @ 0000019e4ef73140]   side data - unknown side data type 17 (1845 bytes)
[Parsed_showinfo_0 @ 0000019e4ef73140]   side data - unknown side data type 16 (8 bytes)
frame=    4 fps=0.0 q=-0.0 Lsize=N/A time=00:00:20.00 bitrate=N/A speed=21.7x    
video:2kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

0 个答案:

没有答案