It works only on low bitrate video
ravisorathiya opened this issue · 0 comments
when I try to add a watermark on video download from pixels it throws an error as below
2021-11-24 10:43:12.879 5748-5959/com.example.fastsaveapp E/Mp4Composer: This device cannot codec with that setting. Check width, height, bitrate, and video format.
android.media.MediaCodec$CodecException: Error 0xfffffc0e
at android.media.MediaCodec.native_configure(Native Method)
at android.media.MediaCodec.configure(MediaCodec.java:1882)
at com.example.fastsaveapp.mp4compose.composer.VideoComposer.setUp(VideoComposer.java:78)
at com.example.fastsaveapp.mp4compose.composer.Mp4ComposerEngine.compose(Mp4ComposerEngine.java:198)
at com.example.fastsaveapp.mp4compose.composer.Mp4Composer$2.run(Mp4Composer.java:319)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
but video downloaded from youtube or from any Instagram video works like charm,
what can be done to add a watermark or encode video with such a high bitrate video like download from Pexels or so..
Mp4Composer(videoPath!!, getDestinationPath())
.filter(GlWatermarkFilter(bitmap, getRepostWatermarkPosition()))
.listener(object : Mp4Composer.Listener {
override fun onProgress(progress: Double) {
mainScoopLauncher {
loadStateEnable(true)
val progressValue = (progress * 100).toString()
val isUnder10Percentage = progressValue.take(2).contains(".")
val under10PercentageValue = "${progress * 100}".take(1) + "%"
val upto10PercentageValue = progressValue.take(2) + "%"
val loadValue =
if (isUnder10Percentage) under10PercentageValue else upto10PercentageValue
binding.txtPercentage.text = loadValue
}
}
override fun onCurrentWrittenVideoTime(timeUs: Long) {
mainScoopLauncher { loadStateEnable(true) }
}
override fun onCompleted() {
mainScoopLauncher {
loadStateEnable(false)
toast("Repost Video Complate")
}
}
override fun onCanceled() {
logger("cancelled")
mainScoopLauncher {
loadStateEnable(false)
toast("Repost Process Cancel..")
}
}
override fun onFailed(exception: Exception?) {
mainScoopLauncher {
loadStateEnable(false)
toast("Repost Process Failed..")
}
}
}).start()