【问题标题】:How to set Fontfile From assets folder in ffmpeg (android studio)如何在ffmpeg(android studio)中从资产文件夹设置字体文件
【发布时间】:2016-04-26 07:20:52
【问题描述】:

我想从 android 的 assets 文件夹中设置 ffmpegn 中的字体文件。有人可以建议我该怎么做。以下是我的 drawtext 命令:- drawtext=fontsize=60:fontfile=/system/fonts/DroidSans.ttf:fontcolor=green:text=Post:x=150:y=150

【问题讨论】:

标签: android ffmpeg


【解决方案1】:

通过将资产数据加载为字节来写入文件

final filename = 'font.ttf';
var bytes = await rootBundle
    .load("packages/flutter_video_editor/assets/font/aller.ttf");

String dir = (await getApplicationDocumentsDirectory()).path;
final path = '$dir/$filename';

final buffer = bytes.buffer;
await File(path).writeAsBytes(
    buffer.asUint8List(bytes.offsetInBytes, bytes.lengthInBytes));

File file = File('$dir/$filename');

print('Loaded file ${file.path}');
_flutterFFmpegConfig.setFontDirectory(file.path, null);

return file.path;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-21
    • 1970-01-01
    • 2014-12-28
    • 2013-10-14
    • 2014-05-09
    • 1970-01-01
    • 2014-12-29
    • 2020-04-08
    相关资源
    最近更新 更多