Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Text to Image #38

Open
daliborristic883 opened this issue Apr 19, 2022 · 1 comment
Open

Add Text to Image #38

daliborristic883 opened this issue Apr 19, 2022 · 1 comment

Comments

@daliborristic883
Copy link

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
Screenshot 2022-04-19 at 12 45 24 PM

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()
            }
        })
    }
@AshvinVavaliya
Copy link
Collaborator

@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%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants