Android using jcodec to convert a series of images takes very long time -
i using jcodec library converting series of images video, along transitions / animation fade / flip , on...
while conversion process, use below function of sequenceencoder class each of image.
public void encodenativeframe(picture pic) throws ioexception { if (toencode == null) { toencode = picture.create(pic.getwidth(), pic.getheight(), encoder.getsupportedcolorspaces()[0]); } // perform conversion transform.transform(pic, toencode); // encode image h.264 frame, result stored in '_out' buffer _out.clear(); bytebuffer result = encoder.encodeframe(toencode, _out); // based on frame above form correct mp4 packet spslist.clear(); ppslist.clear(); h264utils.wipeps(result, spslist, ppslist); h264utils.encodemovpacket(result); // add packet video track outtrack.addframe(new mp4packet(result, frameno * 1, (int)fps, 1, frameno, true, null, frameno * 1, 0)); frameno++; result = null; }
each of frame, takes long time in process (about minute)
especially, following statement takes long time -
bytebuffer result = encoder.encodeframe(toencode, _out);
converting series of 4 images video transition / animation takes @ least 7 minutes.
need suggestions quicken this.
for more optimal encoding of static images (when transitions / animation ended) can create 1 long frame each image. can set fps=1 , duration 1 1 second frame 1 image.
outtrack.addframe(new mp4packet(result, frameno, 1, 1, frameno, true, null, frameno, 0));
also should create track different timescale
muxer.addtrack(tracktype.video, 1);
Comments
Post a Comment