tanersener / mobile-ffmpeg

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.
https://tanersener.github.io/mobile-ffmpeg
GNU General Public License v3.0
3.87k stars 791 forks source link

android drawtext with padding to overcome wrapping text issue #545

Closed pratikbutani closed 3 years ago

pratikbutani commented 4 years ago

Description I am running the following command to write text on video. Its writing text on video successfully but If I use 2-3 lines, it's wrapping out the video.

String command = "-i '" + videoPath + "' -vf \"drawtext=fontsize=20:fontcolor=White:fontfile=" + fontFile.getAbsolutePath() + ":text='" + myTwoThreeLines + "':x=(w-text_w)/2:y=(h-10-text_h)\" -b:v 5M -codec:a copy '" + mDestinationPath +"'";

Expected behavior I want to give some padding left and right side so the text does not wrap and display properly with some space both sides. It must become in the next line If text is bigger then the video's width.

Current behavior It's wrapping out the text outsides the video.

Screenshots image

Environment

shaheercs commented 4 years ago

can you please tell me how did you take font file in android?

pratikbutani commented 4 years ago

can you please tell me how did you take the font file in android?

You need to save the font file into a folder before loading and give the absolute path of that file.

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.