-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,352
  • 21
  • 80
  • 110
Bharat Chauhan
  • 3,006
  • 5
  • 34
  • 50

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
  • 695
  • 1
  • 9
  • 30
Tara
  • 687
  • 5
  • 21
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,213
  • 8
  • 26