flutter 没有这样的过滤器:“drawtext”错误

iqjalb3h  于 2023-08-07  发布在  Flutter
关注(0)|答案(1)|浏览(283)

我正在使用ffmpeg_kit_flutter并在视频上应用drawtext过滤器,但我收到错误No such filter: 'drawtext'
输入视频链路为input.mp4
这个命令有效吗

ffmpeg -y -i input.mp4 -filter_complex '[0]scale=540:-1[s];[s]drawtext=text='your_text_here':fontsize=24:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2' output.mp4

字符串
代码示例如下

/// Create Video With Text
Future<void> createVideoWithText() async {
  final file = File('${(await getTemporaryDirectory()).path}/output.mp4');
  String outPut = file.path;

  String command = "-y -i $inputFilePath -filter_complex '[0]scale=540:-1[s];[s]drawtext=text='MY_TEXT':fontsize=24:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2' $outPut";

  FFmpegKit.executeAsync(
    command,
    (session) async {
      final returnCode = await session.getReturnCode();

      if (ReturnCode.isSuccess(returnCode)) {
print('Success full add text on video');
      }else{print('Error to adding text on video');}
    },
  );
}

z0qdvdin

z0qdvdin1#

我用the full version解决了这个问题

dependencies:
  ffmpeg_kit_flutter_full: ^5.1.0

字符串
而不是ffmpeg_kit_flutter
另外,我认为你不需要引用你的文字:

drawtext=text='your_text_here'


=>

drawtext=text=your_text_here

相关问题