Как сделать прокрутку текста в одной строке на видео с помощью FFmpeg без использования дополнительной строки? ⇐ Android
-
Anonymous
Как сделать прокрутку текста в одной строке на видео с помощью FFmpeg без использования дополнительной строки?
How do I make text scroll in a single line on a video using FFmpeg without using an additional line?
make text scroll in a single line on a video using FFmpeg on Android, but text shows other lines
My code
downloadProgressDialog.show() outputPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path + "/$fileName.mp4" var videoPath = videoPath!! var text = bottomTextScroll!! var fontPath = fontPath!! val query = ffmpegQueryExtension.addScrollingTextToVideo( videoPath, text, fontPath, outputPath!! ) CallBackOfQuery().callQuery(query, object : FFmpegCallBack { override fun success() { downloadProgressDialog.clearProgress() downloadProgressDialog.dismiss() Toast.makeText( this@MainActivity, "Video Download Success", Toast.LENGTH_SHORT ) .show() var notificationText = "Your video has been successfully downloaded." showNotification(notificationText) var i = Intent(this@MainActivity, VideoShareActivity::class.java) i.putExtra("outputPath", outputPath) startActivity(i) finish() } override fun cancel() { downloadProgressDialog.dismiss() Toast.makeText( this@MainActivity, "Video Download Cancel", Toast.LENGTH_SHORT ) .show() } override fun failed() { downloadProgressDialog.dismiss() Toast.makeText( this@MainActivity, "Video Download Fail", Toast.LENGTH_SHORT ).show() var notificationText = "Your video download Fail." showNotification(notificationText) } //get video download progress override fun updateProgress(progress: Int) { val duration = getVideoDuration(videoPath!!) // get video duration downloadProgressDialog.updateProgress(progress, duration) } }) fun addScrollingTextToVideo( videoPath: String, text: String, fontPath: String, outputPath: String ): Array { val inputs: ArrayList = ArrayList() val scrollSpeed = 5 val textSize = 40 inputs.apply { add("-i") add(videoPath) add("-vf") add("drawtext=fontfile=$fontPath:text='$text':fontsize=$textSize:fontcolor=white:x=w-(mod($scrollSpeed*n\\,w+tw)):y=h-text_h-105") add("-c:a") add("copy") add(outputPath) } return inputs.toArray(arrayOfNulls(inputs.size)) } make long text scroll in a single line on a video using FFmpeg on Android, but text shows other lines in
please give me the solution
Источник: https://stackoverflow.com/questions/780 ... hout-using
How do I make text scroll in a single line on a video using FFmpeg without using an additional line?
make text scroll in a single line on a video using FFmpeg on Android, but text shows other lines
My code
downloadProgressDialog.show() outputPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).path + "/$fileName.mp4" var videoPath = videoPath!! var text = bottomTextScroll!! var fontPath = fontPath!! val query = ffmpegQueryExtension.addScrollingTextToVideo( videoPath, text, fontPath, outputPath!! ) CallBackOfQuery().callQuery(query, object : FFmpegCallBack { override fun success() { downloadProgressDialog.clearProgress() downloadProgressDialog.dismiss() Toast.makeText( this@MainActivity, "Video Download Success", Toast.LENGTH_SHORT ) .show() var notificationText = "Your video has been successfully downloaded." showNotification(notificationText) var i = Intent(this@MainActivity, VideoShareActivity::class.java) i.putExtra("outputPath", outputPath) startActivity(i) finish() } override fun cancel() { downloadProgressDialog.dismiss() Toast.makeText( this@MainActivity, "Video Download Cancel", Toast.LENGTH_SHORT ) .show() } override fun failed() { downloadProgressDialog.dismiss() Toast.makeText( this@MainActivity, "Video Download Fail", Toast.LENGTH_SHORT ).show() var notificationText = "Your video download Fail." showNotification(notificationText) } //get video download progress override fun updateProgress(progress: Int) { val duration = getVideoDuration(videoPath!!) // get video duration downloadProgressDialog.updateProgress(progress, duration) } }) fun addScrollingTextToVideo( videoPath: String, text: String, fontPath: String, outputPath: String ): Array { val inputs: ArrayList = ArrayList() val scrollSpeed = 5 val textSize = 40 inputs.apply { add("-i") add(videoPath) add("-vf") add("drawtext=fontfile=$fontPath:text='$text':fontsize=$textSize:fontcolor=white:x=w-(mod($scrollSpeed*n\\,w+tw)):y=h-text_h-105") add("-c:a") add("copy") add(outputPath) } return inputs.toArray(arrayOfNulls(inputs.size)) } make long text scroll in a single line on a video using FFmpeg on Android, but text shows other lines in
please give me the solution
Источник: https://stackoverflow.com/questions/780 ... hout-using
Мобильная версия