mendy
mendy

Reputation: 127

JCodec bitmap to mp4 - distortion in result video

When I'm trying to convert a single bitmap to a 10 secs long video using JCodec - sometimes I get a weird result, usually it's a color distortion - or a black diagonal line drawn on the result video. here is the code I using (I debugged it and the problem occurs there):

SequenceEncoder enc = new SequenceEncoder(f);
for (int x = 0; x < 250; x++) {
     Log.d("frame", "" + x);
     enc.encodeImage(bitmap);
     publishProgress(pb, 1);
}
enc.finish();

Here is an example for the both problems (marked in red arrows):

Original picture: enter image description here

After render: enter image description here

Upvotes: 1

Views: 778

Answers (1)

Atul Vasudev A
Atul Vasudev A

Reputation: 463

Mystery solved after a long period.

If the height or width of the bitmap is not an even number the distortion comes. JCodec for android is not triggering any error while using a bitmap like this, where as the normal Jcodec will fire an illegal argument exception.

Solution : Just resize bitmap to sizes divisible by 2 just before encoding.

Upvotes: 2

Related Questions