-4

I have a requirement to create a movie with audio by using images.
But I don't understand how to make that.

Please suggest any android library or something.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Bharat Chauhan
  • 3,204
  • 5
  • 39
  • 52
  • 2
    https://stackoverflow.com/questions/40315349/how-to-create-a-video-from-an-array-of-images-in-android see this link – Tara Dec 15 '17 at 07:04
  • 1
    chek this : https://github.com/WritingMinds/ffmpeg-android – Maddy Dec 15 '17 at 07:30
  • Possible duplicate of [How to create a video from an array of images in Android?](https://stackoverflow.com/questions/40315349/how-to-create-a-video-from-an-array-of-images-in-android) – naXa stands with Ukraine Dec 15 '17 at 08:55

2 Answers2

2

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

Refer http://jcodec.org/ for sample code & downloads

 compile 'org.jcodec:jcodec:0.2.2'
 compile 'org.jcodec:jcodec-android:0.2.2'

Now

Making a video with a set of images from memory:

SeekableByteChannel out = null;
try {
    out = NIOUtils.writableFileChannel("/tmp/output.mp4");
    // for Android use: AndroidSequenceEncoder
    AWTSequenceEncoder encoder = new AWTSequenceEncoder(out, Rational.R(25, 1));
    for (...) {
        // Generate the image, for Android use Bitmap
        BufferedImage image = ...;
        // Encode the image
        encoder.encodeImage(image);
    }
    // Finalize the encoding, i.e. clear the buffers, write the header, etc.
    encoder.finish();
} finally {
    NIOUtils.closeQuietly(out);
}
Muhammad Saad
  • 713
  • 1
  • 9
  • 31
Tara
  • 692
  • 5
  • 23
0

Best way to create video from images with music is FFMPEG You can use ffmpeg to reate video using ffmpeg command

complexCommand= new String[]{"-i", "image%03d", "-framerate", " 15",  "-s", "720x1280", "-vcodec", "libx264", "-b", "800k","-preset","ultrafast", "/sdcard/video.mp4"};

here image%03d is your images with same name formate like image001, image002.... if you use image%02d image name must be image01,image02.....

and to executee ffmpeg command in nadroid use ffmpeg by writingmind

  compile 'com.writingminds:FFmpegAndroid:0.3.2'

image path sould be look like this /storage/emulated/0/Pictures/image%03d.jpg

let me know if any query

Vinesh Chauhan
  • 1,288
  • 11
  • 27