//各参数含义:查看 https://github.com/bilibili/ijkplayer/blob/cced91e3ae3730f5c63f3605b00d25eafcf5b97b/ijkmedia/ijkplayer/ff_ffplay_options.h
IJKFFOptions *options = [IJKFFOptions optionsByDefault];
[options setPlayerOptionIntValue:maxBuffSize * 1000 forKey:@"max_cached_duration"];
[options setPlayerOptionIntValue:minBuffSize * 1000 forKey:@"max-buffer-size"]; // max buffer size should be pre-read
[options setPlayerOptionIntValue:1 forKey:@"fast"];
[options setPlayerOptionIntValue:0 forKey:@"packet-buffering"]; // 是否开启缓冲
[options setPlayerOptionIntValue:1 forKey:@"framedrop"]; // drop frames when cpu is too slow
[options setPlayerOptionIntValue:1 forKey:@"start-on-prepared"]; //automatically start playing on prepared
[options setPlayerOptionIntValue:1 forKey:@"videotoolbox"]; // VideoToolbox: enable
[options setPlayerOptionIntValue:1 forKey:@"infbuf"];
[options setPlayerOptionIntValue:1 forKey:@"mediacodec"];
[options setPlayerOptionIntValue:0 forKey:@"mediacodec-auto-rotate"];//关闭自动旋转屏
[options setPlayerOptionIntValue:0 forKey:@"mediacodec-handle-resolution-change"];// 处理分辨率变化
[options setPlayerOptionIntValue:2 forKey:@"min-frames"];// 默认最小帧数
////各参数含义:https://github.com/bilibili/ijkplayer/blob/cced91e3ae3730f5c63f3605b00d25eafcf5b97b/ijkmedia/ijkplayer/ijkavformat/ijklivehook.c
[options setFormatOptionIntValue:100 forKey:@"analyzeduration"];
[options setFormatOptionValue:@"tcp" forKey:@"rtsp_transport"];
[options setFormatOptionValue:@"nobuffer" forKey:@"fflags"];
[options setFormatOptionIntValue:200 forKey:@"probesize"]; // 探测size
[options setFormatOptionIntValue:1 forKey:@"flush_packets"];
// when video is high_fps,below works
[options setCodecOptionIntValue:IJK_AVDISCARD_ALL forKey:@"skip_loop_filter"];
[options setCodecOptionIntValue:IJK_AVDISCARD_ALL forKey:@"skip_frame"];
self.player = [[IJKFFMoviePlayerController alloc] initWithContentURL:self.url withOptions:options];
网友评论