Android : Create mpeg4 movie file using jcodec for Android

on Monday, October 27, 2014


I tried write mpeg4 movie file using jcodec 0.1.7 / Android 4.4.2 from PNG files.


But, the written file is broken (Can not open using Android, VLC Player etc.)


How to method to write mpeg4 correctly?



File destFile = new File(destPath);
try {
SequenceEncoder sequenceEncoder = new SequenceEncoder(destFile);

String baseDir = cacheDirectoryPath();
File dirF = new File(imgDir);
File files[] = dirF.listFiles();

for (int i = 0; i < 200; i++) {
Log.d("File: ", files[i].getAbsolutePath());
Bitmap bmp1 = BitmapFactory.decodeFile(files[i].getAbsolutePath());
Picture pic = BitmapUtil.fromBitmap(bmp1);
sequenceEncoder.encodeNativeFrame(pic);
}

sequenceEncoder.finish();

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

0 comments:

Post a Comment