那麼,如何減少探測時間內? 可以通過設置AVFotmatContext的probesize和max_analyze_duration屬性進行調節:
解決 ffmpeg 在avformat_find_stream_info執行時間太長
用ffmpeg做demux,網上很多參考文章。對於網絡流,avformt_find_stream_info()函數默認需要花費較長的時間進行流格式探測,
那麼,如何減少探測時間內? 可以通過設置AVFotmatContext的probesize和max_analyze_duration屬性進行調節:
那麼,如何減少探測時間內? 可以通過設置AVFotmatContext的probesize和max_analyze_duration屬性進行調節:
.............
if (avformat_open_input(&(handle->pFormatContext), "", handle->pInputFormat, NULL) < 0) {
av_free(handle->inputBuffer);
*errorCode = -4;
return FALSE;
}
(handle->fpState)(handle, 51);
AVDictionary* pOptions = NULL;
handle->pFormatContext->probesize = 100 *1024;
handle->pFormatContext->max_analyze_duration = 5 * AV_TIME_BASE;
if (avformat_find_stream_info(handle->pFormatContext, &pOptions) < 0) {
.........
return FALSE;
}
...............
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.