Dim
Dim

Reputation: 4837

Create video file from images in Android

I am reading found many articles and info about creating video from sequence of images. They all recommend to use ffmpeg. The thing is that this pretty complicated. There is simple way to do this without ffmpeg? I need that the result video will be readable to regular video player on the device.

Upvotes: 1

Views: 5812

Answers (3)

sajjad rezaee
sajjad rezaee

Reputation: 11

You can use JCodec library. It now supports android too. You need to download the library and add it in your project. here is an example of using the library:

SequenceEncoder se = null;

        try {
            se = new SequenceEncoder(new File(Environment.getExternalStorageDirectory(),
                    "jcodec_enc.mp4"));
            File[] files = yourDirectory.listFiles();
            for (int i = 0;i<files.length; i++) {
                if (!files[i].exists())
                    break;
                Bitmap frame = BitmapFactory.decodeFile(files[i]
                        .getAbsolutePath());
                se.encodeImage(frame);

            }
            se.finish();
        } catch (IOException e) {
            Log.e(TAG, "IO", e);
        }

Upvotes: 1

Abhishek Shukla
Abhishek Shukla

Reputation: 1242

Possibly, you want to make use of the Movie. The reference is here: http://developer.android.com/reference/android/graphics/Movie.html

And, a sample example is here:

https://code.google.com/p/animated-gifs-in-android/

Upvotes: 1

PravinCG
PravinCG

Reputation: 7708

Not sure what you mean by complicated. If you are not very comfortable with native layer then you might use javaCV. It provides java wrapper for ffmpeg among other open source library and works very well.

Upvotes: 1

Related Questions