By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm using FFMpegFrameGrabber on android to consume an rtmp live stream, that streams at 30fps , i tried to set the grabber frame rate using setFrameRate(4) and setOption("framerate","4") , in order to resolve the lag, but neither worked. I also passed a set of options into the grabber such as ("fflags","nobuffer") that seems to be working for others, but non has an effect too.

    grabber = FFmpegFrameGrabber.createDefault(this.listener.getVideoUrlOrPath());
    grabber.setTimeout(Math.abs((int) GlobalHandler.configMnger.getConnectionTimeout() / 1000));
    grabber.setOption("fflags", "nobuffer");
    grabber.setOption("nobuffer", "1");
    grabber.setOption("max_delay", "0");
    grabber.setOption("hwaccel", "auto");
    grabber.setOption("vsync", "0");
    grabber.setOption("r", "4");
    grabber.setOption("preset", "ultrafast");
    grabber.setOption("tune", "zerolatency");
    grabber.setOption("analyzeduration", "0");
    grabber.setOption("fflags", "flush_packets");
    grabber.setOption("fflags", "nofillin");
    grabber.setOption("fflags", "noparse");
    grabber.setOption("flags", "low_delay");
    grabber.setOption("framedrop", "1");
    grabber.setOption("fflags", "discardcorrupt");
    grabber.setOption("framerate", "4");
    grabber.setFrameRate(4);
    grabber.setVideoCodec(avcodec.AV_CODEC_ID_H264);
    grabber.start();
    Frame image;
    while((image=grabber.grabImage())!=null){

Please Note that remove all options gives identical results, where the only working option i have here is timout that is set using the setTimeout function above.

Any help please?. Thanks!!

The options we can use should all be documented on these pages:
https://ffmpeg.org/ffmpeg-protocols.html
https://ffmpeg.org/ffmpeg-formats.html
https://ffmpeg.org/ffmpeg-codecs.html