3

I want to set font file in ffmpegn from assets folder in android. Can someone suggest me how can i do that. Following is my drawtext command :- drawtext=fontsize=60:fontfile=/system/fonts/DroidSans.ttf:fontcolor=green:text=Post:x=150:y=150

4
  • 1
    Here is a similar question, please check it stackoverflow.com/questions/21925463/… Commented Sep 26, 2017 at 19:49
  • Have u got any solution Commented Mar 3, 2018 at 10:22
  • how can access from Assets FFMPEG Commented Aug 7, 2019 at 5:00
  • Were you able to figure this out? Having the same issue where the fontfile is not being used to write the font, even though the path is pointing towards the assets folder. Commented Sep 1, 2022 at 14:13

1 Answer 1

-1

Write file by loading asset data as bytes

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; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.