這個是從 AD 直接複製來的,修改 package name 或 class name 都會導致 native link 失敗。
Example
val w = 320
val h = 240
val speed = 6
val imageCount = 120
val file = File(Environment.getExternalStorageDirectory(), "qq.mp4")
val encoder = FFMPEGEncode()
encoder.start(w, h, speed, imageCount, file)
val bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_4444)
val canvas = Canvas(bitmap)
val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
strokeWidth = 10f
color = Color.WHITE
}
for (i in 0..imageCount) {
canvas.drawColor(Color.BLUE)
canvas.drawText(i.toString(), 30f, 30f, paint)
encoder.addImage(bitmap)
}
encoder.end()