Android: Jcodec: encoding image files to .mp4 video
Asked Answered
M

0

6

I am using JCODEC to create a video of my screen activities. I don’t want to use android NDK as I want to do it in JAVA. I am running a for loop to encode images using SequenceEncoder. The problem is the loop is taking too long to run and log cat gives messages of GC_FOR_ALLOC freed. For even 5 iterations the loop takes many seconds. So I am unable to take proper video of my activities. I tried to make changes in the code but its not helping. Please help me with this. Suggest other options if available. Thanks in advance.

File file = new File(Environment.getExternalStorageDirectory()+"/a.mp4");
SequenceEncoder encoder = new SequenceEncoder(file);
mview.setDrawingCacheEnabled(true);
// only 5 frames in total
for (int i = 1; i <= 5; i++) {
// getting bitmap from drawable path
mview.postInvalidate();
encoder.encodeNativeFrame(this.fromBitmap(mview.getDrawingCache()));
}
encoder.finish();
Mckenziemckeon answered 20/5, 2014 at 15:58 Comment(3)
Did you solve this issue ?Yokoyama
No, I am unable. Try using ffmpeg using ndk. I was not able figure out how to do that. Please tell me if you do so.Mckenziemckeon
i am using FFMpeg and Tried it works but its very complicated tooYokoyama

© 2022 - 2024 — McMap. All rights reserved.