How to create a video from an array of images in Android?

后端 未结 9 888
时光说笑
时光说笑 2020-12-04 10:32

I want to call a function and build a video out of list of images, and then save it locally on the device:

public void CreateAndSaveVideoFile(List

        
9条回答
  •  -上瘾入骨i
    2020-12-04 11:33

    You can use Bitmp4 to convert sequence of images to MP4 file.

    Sample code :

    ...

    val encoder = MP4Encoder()
         encoder.setFrameDelay(50)
         encoder.setOutputFilePath(exportedFile.path)
         encoder.setOutputSize(width, width)
    
     startExport()
    
     stopExport()
    
     addFrame(bitmap) //called intervally
    

    It's a java library so it's easy to import it into Android project, you don't have to use NDK unlike ffmpeg.

    Refer https://github.com/dbof10/Bitmp4 for sample code & downloads.

提交回复
热议问题