Using jcodec SequenceEncoder

2019-02-03 18:27发布

问题:

I need to create video from images, I have seen jcodec and I think it is what I need: http://jcodec.org/

How do I add jcodec to my project? I have seen there is a version for android. Correct me if I am wrong, but I added jcodec-0.1.5.jar to my project under the libs folder. Then added SequenceEncoder.java and BitmapUtil.java from jcodec-android-0.1.7.zip to my package but when I add:

public void encodeImage(Bitmap bi) throws IOException 
{
    encodeNativeFrame(BitmapUtil.fromBitmap(bi));
}

It gives me error on package com.example.seqtest and asks me to configure build path.

So how I use it, How can I input sequence of images? Can you provide me some example?

回答1:

This is how you do it

1) Download jcodec-android-0.1.7.zip from http://jcodec.org/

2) Unzip the downloaded file and you will get JCodec folder which is an android project.

3) Import that JCodec project in your Eclipse. If you get any error, solve it by right clicking on the project Properties -> Android -> Select the Build target and press OK.

4) Now your JCodec library setup is done.

5) Create a new android application project.(your actual project)

6) Right click on the project, Properties -> Android -> Library -> Add -> Add the JCodec Library -> Apply -> OK

7) Now your project is linked to JCodec library and you can start coding.

You can download JCodec sample app from this link http://jcodec.org/downloads/jcodec-samples-android-0.1.7.zip

Again you have to carry out step 6 for sample app too.And no need to add jcodec-0.1.5.jar to libs folder.