bytedeco/javacv

Passing FFMpeg Options into FrameGrabber Has No Effect At All

Open

#1,134 opened on Feb 1, 2019

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Java (1,583 forks)batch import
help wantedquestion

Repository metrics

Stars
 (6,985 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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!!

Contributor guide