1

I need to save a frame from the video using jcodec(i use Libgdx), but the frame is not saved on the android

    public void save(){
        int framenum = 3;
        File file = new File(Gdx.files.internal("vid.mp4").toString());

        try (FileOutputStream out = new FileOutputStream(Gdx.files.internal("frame-3.png").toString())) {
            Picture pic = AndroidFrameGrab.getFrameFromFile(file, framenum);
            Bitmap bitmap = AndroidUtil.toBitmap(pic);
            bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (JCodecException e) {
            e.printStackTrace();
        }
}
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
TemaTriz
  • 11
  • 1

0 Answers0