Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.MasayukiSuda:ImageToVideoAndroid:v0.1.0'
}
imageToVideo = ImageToVideoConverter(
outputPath = outputVideoPath,
inputImagePath = inputImagePath,
size = Size(720, 720),
duration = TimeUnit.SECONDS.toMicros(4),
listener = object : EncodeListener {
override fun onProgress(progress: Float) {
Log.d("progress", "progress = $progress")
runOnUiThread {
progressBar.progress = (progress * 100).toInt()
}
}
override fun onCompleted() {
runOnUiThread {
progressBar.progress = 100
}
}
override fun onFailed(exception: Exception) {
}
}
)
imageToVideo?.start()