SSffmpegVideoOperation
SSffmpegVideoOperation copied to clipboard
Add Text to Image
Describe the bug
I changed AddTextOnVideo
feature to add text on Image.
Here are queries. but when I run this command, I can see error ffmpeg error initializing filter 'drawtext' with args
Please help me
This is my sample code.
private fun addTextProcess(imagePath: String) {
val outputPath = Common.getFilePath(this, Common.IMAGE)
val dateString = Date().dateToString("yyyy-MM-dd HH:mm:ss.SSS")
val fontPath = Common.getFileFromAssets(this, "roboto_regular.ttf").absolutePath
val query = ffmpegQueryExtension.addTextOnVideo(imagePath, dateString,
0.0f,
0.0f,
fontPath = fontPath,
isTextBackgroundDisplay = false,
fontSize = 30,
fontcolor = "red",
output = outputPath
)
CallBackOfQuery().callQuery(query, object : FFmpegCallBack {
override fun process(logMessage: LogMessage) {
Log.d("Dalibor", logMessage.text)
}
override fun success() {
Log.d("Dalibor", "Sucess")
}
override fun cancel() {
addTimeStampToPhotos()
}
override fun failed() {
addTimeStampToPhotos()
}
})
}
@daliborristic883 Issue is here, "drawtext=............:x=0.0:y=0.0:..........." Please give value of X and Y for the calculation of X and Y value, get height and width of Image and convert into percentage form ex. Image have height = 100% and width = 100% and I want to display text in center then give value X=50.0% and Y=50.0%