-2

I want to make an application where users can select 3 gallery images. After click next button a video will be created with these 3 photos and user can save this video to sd card.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • use ffmpeg library .. you can create a video and add audio to that video ,you can watermark that video as well.. – Adeel Turk Apr 24 '18 at 16:13

2 Answers2

1

Try using animation set in android that can help you achieve what you are after it is called FrameAnimation, here is an example on how to use it:

FrameAnimation Example

or checkout below code snippet if it helps :

` final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
    public void run() {
        int randomNum = random.nextInt(6);
        dice.setImageResource(images[randomNum]);
        handler.postDelayed(this, 500);
    }
}, 500);`
Sahil
  • 952
  • 1
  • 7
  • 14
0

You can use jcodec SequenceEncoder to convert sequence of images to MP4 file.

Sample code :

import org.jcodec.api.awt.SequenceEncoder;
...
SequenceEncoder enc = new SequenceEncoder(new File("filename"));
// GOP size will be supported in 0.2
// enc.getEncoder().setKeyInterval(25);
for(...) {
    BufferedImage image = ... // Obtain an image to encode
    enc.encodeImage(image);
}
enc.finish();

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 http://jcodec.org/ for sample code & downloads.

According to Abhishek V

Look here to see more

Nirel
  • 1,855
  • 1
  • 15
  • 26