#1395·javacv

FrameGrabber with inputstream

Author: xiaosCreated Apr 1, 2020Updated Feb 11, 2026
Labelshelp wantedquestion

Now in Android 10, we cannot use file path, instead URI only. so to create a frame grabber, i have to do this:

    inputStream = context.getContentResolver().openInputStream(uri);
    frameGrabber = new FFmpegFrameGrabber(inputStream);
    frameGrabber.start();

I found two issues:

  1. sometimes the start() will stuck there.
  2. Saw some exceptions: Non-fatal Exception: org.bytedeco.javacv.FrameGrabber$Exception avformat_open_input() error -2: Could not open input "java.io.BufferedInputStream@db63d24". (Has setFormat() been called?)