ffmpeg接收媒體流時的設置--轉

原文鏈接:https://www.cnblogs.com/betterwgo/p/7642331.html
AVDictionary* options = NULL;
av_dict_set(&options, "buffer_size", "1024000", 0); //增大“buffer_size”參數來提高畫質,減少花屏現象
av_dict_set(&options, "max_delay", "500000", 0);    //TCP最大延時
av_dict_set(&options, "stimeout", "20000000", 0);  //設置超時斷開連接時間,20S,可避免rtsp連接不上卡死問題
av_dict_set(&options, "rtsp_transport", "tcp", 0);  //以udp方式打開,如果以tcp方式打開將udp替換爲tcp  


if(avformat_open_input(&pFormatCtx,url.c_str(),NULL,&options)!=0)
{
    printf("Couldn't open input stream.\n");
    return false;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章