TemaTriz
TemaTriz

Reputation: 11

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

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();
        }
}

Upvotes: 1

Views: 99

Answers (0)

Related Questions