0

I'm trying to use jcodec library to create video from images but sequenceEncoder.encodeImage(bitmap) is showing error.

my code for encoding is :-

class EncodeImages extends AsyncTask<File, Integer, Integer>{ @Override protected Integer doInBackground(File... params) { SequenceEncoder sequenceEncoder; try { sequenceEncoder = new SequenceEncoder(new File(params[0].getParentFile(),"Frames Video.mp4")); for (int i = 0; !flag; i++) { File imagesFile = new File(params[0].getParentFile(), String.format(params[0].getName(), i)); if(!imagesFile.exists()){ break; } Bitmap bitmap = BitmapFactory.decodeFile(imagesFile.getAbsolutePath()); sequenceEncoder.encodeImage(bitmap); publishProgress(i); } sequenceEncoder.finish(); } catch (IOException e) { e.printStackTrace(); } return null; } } 

But the line - sequenceEncoder.encodeImage(bitmap); is showing following errors :-

Multiple markers at this line - The type java.awt.image.BufferedImage cannot be resolved. It is indirectly referenced from required .class files... - The method encodeImage(BufferedImage) from the type SequenceEncoder refers to the missing type BufferedImage...

it is asking me to configure build path. I've tried like everything, but in vain. What should I do next???

1
  • java.awt classes are not present in Android. Commented Aug 25, 2014 at 12:16

1 Answer 1

2

java.awt classes are not present in Android. You should try JavaCV for Video encoding or as I see jcodec added Android version on September 14 2013. You should download android version from https://github.com/jcodec/jcodec and add that into your project.

Sign up to request clarification or add additional context in comments.

3 Comments

But as per the library jcodec, sample project for android in that is using same code and its apk is working (downloaded from same link). So i preffered to use that library.
The type java.awt.image.BufferedImage cannot be resolved. as your error shows you are trying to use BufferedImage from java.awt package which is not present in Android. java.awt is present in only desktop version of java. I think you have download .jar file from here jcodec.org/downloads.html which is old I think jcodec-0.1.5.jar 05/20/2013 they added Android version on September 14 2013.
I downloaded the same thing. but its asking me to add BufferedImage in sequenceEncoder.encodeImage(bitmap) instead of bitmap.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.