【问题标题】:ffmpeg rtsp error: Nonmatching transport in server replyffmpeg rtsp 错误:服务器回复中的传输不匹配
【发布时间】:2017-08-07 19:44:26
【问题描述】:

我正在使用 ffmpeg 读取 rtsp 相机。我收到一个错误:ffmpeg rtsp 错误:C++ 中的服务器回复中的传输不匹配”和“处理输入时发现无效数据”。相机设置了“RTP ES”。这是代码。

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;
}

【问题讨论】:

  • 我可以使用上面显示的rtsp地址播放这个VLC。我正在使用 RedHat 6.9。
  • 也许this 可以帮助你

标签: ffmpeg rtsp


【解决方案1】:

希望对您有所帮助:

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);

【讨论】:

  • 请提供更多信息,例如它的作用以及它如何解决 OPs 问题
  • 谢谢 - 我已经尝试过了,但仍然无法正常工作,但出现了不同的错误。 “找不到流 0 的编解码器参数(视频:h264,无):未指定大小:考虑增加‘analyzeduration’和‘probesize’选项的值”当我发出命令 codec_ctx = avcodec_alloc_context3(codec); avcodec_get_context_defaults3(codec_ctx, codec); avcodec_parameters_to_context(codec_ctx, format_ctx->streams[video_stream_index]->codecpar);流的宽度和高度为 0 我使用的是 VITEC MGW NANO 解码器
猜你喜欢
  • 2018-07-15
  • 1970-01-01
  • 2020-06-05
  • 2010-12-09
  • 2022-01-08
  • 2019-04-11
  • 2019-08-25
  • 1970-01-01
  • 2016-03-14
相关资源
最近更新 更多