1

我正在使用 JCodec 库将位图图像列表转换为 mp4 文件。一切正常,但生成的 mp4 文件正确播放第一张图像,其余图像无法正确渲染。

这是我的编码器代码

  private class Encoder extends AsyncTask<File, Integer, Integer> {
    private static final String TAG = "ENCODER";
    protected Integer doInBackground(File... params) {
        SequenceEncoder se = null;

        Bitmap[] arrayOfBitmap = {bmp, bmpdef};


        try {
            se = new SequenceEncoder(new File(params[0].getParentFile(),
                    "jcodec_enc.mp4"));

                for (int i = 0; i < arrayBitmap.length; i++) {




                        se.encodeImage(arrayBitmap[i]);


                }

            se.finish();

                        } catch (IOException e) {
            Log.e(TAG, "IO", e);
        }

        return 0;
    }

    @Override
    protected void onProgressUpdate(Integer... values) {
        progress.setText(String.valueOf(values[0]));
    }
}

请帮助我在哪里犯了错误

4

0 回答 0