ffmpeg rtsp错误:服务器回复中的传输不匹配 [英] ffmpeg rtsp error: Nonmatching transport in server reply
本文介绍了ffmpeg rtsp错误:服务器回复中的传输不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用ffmpeg读取rtsp相机.我收到一个错误消息:ffmpeg rtsp错误:c ++中的服务器答复中传输不匹配"和处理输入时发现无效数据".相机已设置"RTP ES".这是代码.
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;
}
推荐答案
这可能有帮助:
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);
这篇关于ffmpeg rtsp错误:服务器回复中的传输不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文