Open szhansen opened 6 years ago
This works good for me:
player.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "start-on-prepared", 1);
player.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "fflags", "nobuffer");
player.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "flush_packets", 1);
player.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "max_delay", 0);
Reference: https://ffmpeg.org/ffmpeg-formats.html#Format-Options https://ffmpeg.org/ffmpeg-codecs.html#Codec-Options
@Yair0007 still not work. thank you.
It's very strange,the video delay increasing bigger and bigger, the value of "v-cache" is always increasing biger and bigger, here is the config:
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 60); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "max-fps", 60); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "fps", 25); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC, "skip_loop_filter", 48); //ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", IjkMediaPlayer.SDL_FCC_YV12); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "packet-buffering", 0); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "fflags", "nobuffer"); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "max-buffer-size", 1024); //ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "min-frames", 5); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "start-on-prepared", 1); ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "probsize", "4096");
Here is the runtime log:
I/J4A: API-Level: 23 I/IJKMEDIA: av_version_info: ff3.3--ijk0.8.0--20170829--001 I/IJKMEDIA: ijk_version_info: k0.8.4 W/IJKMEDIA: remove 'timeout' option for rtmp. I/IJKMEDIA: ===== versions ===== I/IJKMEDIA: ijkplayer : k0.8.4 I/IJKMEDIA: FFmpeg : ff3.3--ijk0.8.0--20170829--001 I/IJKMEDIA: libavutil : 55.58.100 I/IJKMEDIA: libavcodec : 57.89.100 I/IJKMEDIA: libavformat : 57.71.100 I/IJKMEDIA: libswscale : 4.6.100 I/IJKMEDIA: libswresample: 2.7.100 I/IJKMEDIA: ===== options ===== I/IJKMEDIA: player-opts : mediacodec = 1 I/IJKMEDIA: player-opts : mediacodec-auto-rotate = 0 I/IJKMEDIA: player-opts : mediacodec-handle-resolution-change = 0 I/IJKMEDIA: player-opts : opensles = 0 I/IJKMEDIA: player-opts : overlay-format = 842225234 I/IJKMEDIA: player-opts : packet-buffering = 0 I/IJKMEDIA: player-opts : framedrop = 60 I/IJKMEDIA: player-opts : max-fps = 60 I/IJKMEDIA: player-opts : fps = 25 I/IJKMEDIA: player-opts : start-on-prepared = 1 I/IJKMEDIA: format-opts : ijkapplication = -384736864 I/IJKMEDIA: format-opts : ijkiomanager = -196034688 I/IJKMEDIA: format-opts : http-detect-range-support = 0 I/IJKMEDIA: format-opts : fflags = nobuffer I/IJKMEDIA: format-opts : max-buffer-size = 1024 I/IJKMEDIA: format-opts : probsize = 4096 I/IJKMEDIA: codec-opts : skip_loop_filter = 48 I/IJKMEDIA: ===================
Here is the video infor:
I/IJKMEDIA: Reinit context to 1280x720, pix_fmt: yuvj420p I/IJKMEDIA: max_analyze_duration 5000000 reached at 5000000 microseconds st:0 I/IJKMEDIA: max_frame_duration: 10.000 I/IJKMEDIA: Input #0, flv, from 'rtmp://192.168.8.1:1935/rtmp': I/IJKMEDIA: Duration: I/IJKMEDIA: N/A I/IJKMEDIA: , start: I/IJKMEDIA: 327.680000 I/IJKMEDIA: , bitrate: I/IJKMEDIA: N/A I/IJKMEDIA: Stream #0:0 I/IJKMEDIA: : Video: h264, 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1280x720, 0/1 I/IJKMEDIA: , I/IJKMEDIA: 25 fps, I/IJKMEDIA: 25 tbr, I/IJKMEDIA: 1k tbn I/IJKMEDIA: API-Level: 23 I/IJKMEDIA: ffpipenode_create_video_decoder_from_android_mediacodec: MediaCodec: H264_BASELINE: enabled I/IJKMEDIA: AMediaFormat: video/avc, 1280x720