ffmpeg rtsp error: Nonmatching transport in server reply

牧云@^-^@ 提交于 2019-12-12 18:36:17

问题


I'm using ffmpeg to read an rtsp camera. I'm getting an error: ffmpeg rtsp error: Nonmatching transport in server reply" in c++ and "Invalid data found when processing input". The camera has setting "RTP ES". Here's the code.

source_name = "rtsp://192.168.1.108/WESCAM";

// Open the initial context variables that are needed
format_ctx = avformat_alloc_context();    
codec_ctx = NULL;

// Register everything
av_register_all();
avformat_network_init();

//open RTSP camera or h264 file
if (avformat_open_input(&format_ctx, source_name, NULL, NULL) != 0) 
{
    return EXIT_FAILURE;
}

回答1:


may this helpful:

AVDictionary *opts = nullptr;
av_dict_set(&opts, "rtsp_transport", "udp", 0); // here "udp" can replaced by "tcp"
avformat_open_input(&pFormatCtx, rtsp_addr, nullptr, &opts);
...
av_dict_free(&opts);


来源:https://stackoverflow.com/questions/45554594/ffmpeg-rtsp-error-nonmatching-transport-in-server-reply

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!