/////播放前的探測Size,默認(rèn)是1M, 改小一點會出畫面更快
[_options setFormatOptionIntValue:1024 * 16*0.5 forKey:@"probsize"];
//播放前的探測時間
[_options setFormatOptionIntValue:50000 forKey:@"analyzeduration"];
//軟解耿焊,更穩(wěn)定件炉,硬件解碼CPU消耗低阔挠,
[_options setPlayerOptionIntValue:0 forKey:@"videotoolbox"];
//解碼參數(shù),畫面更清晰
[_options setCodecOptionIntValue:IJK_AVDISCARD_DEFAULT forKey:@"skip_loop_filter"];
[_options setCodecOptionIntValue:IJK_AVDISCARD_DEFAULT forKey:@"skip_frame"];
/// 最多緩存
[_options setCodecOptionIntValue:3000 forKey:@"max_cached_duration"];
/// 無限讀
[_options setPlayerOptionIntValue:1 forKey:@"infbuf"];
/// 關(guān)閉播放緩沖
[_options setPlayerOptionIntValue:0 forKey:@"packet-buffering"];
/// framedrop 是在視頻幀處理不過來的時候丟棄一些幀達(dá)到同步的效果
[_options setPlayerOptionIntValue:5 forKey:@"framedrop"];
//最大fps
[_options setPlayerOptionIntValue:30 forKey:@"max-fps"];
/// 幀速率(fps)
[_options setPlayerOptionIntValue:29.97 forKey:@"r"];
遇到的問題
1達(dá)不到秒開,首屏顯示慢柒桑,后來把播放前探測時間改為1,
2音畫不同步窑邦,有同事發(fā)現(xiàn)在模擬器的情況下音畫不同步擅威,剛開始理解以為是CPU處理畫面處理不過來,所以加了framedrop參數(shù) 做了丟幀處理冈钦,后來才明白是因為模擬器處理效率低郊丛,不需要做丟幀處理,
目前我使用的參數(shù)是
//? ? //播放前的探測時間
[_options setFormatOptionIntValue:1 forKey:@"analyzeduration"];
//解瞧筛,更穩(wěn)定
[_options setPlayerOptionIntValue:1 forKey:@"videotoolbox"];