在FFmpeg / LibAV中设置RTSP / UDP缓冲区大小 [英] Set RTSP/UDP buffer size in FFmpeg/LibAV

查看:1848
本文介绍了在FFmpeg / LibAV中设置RTSP / UDP缓冲区大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意:我知道ffmpeg和libav是不同的库的。这是一个常见的问题。

Note: I'm aware ffmpeg and libav are different libraries. This is a problem common to both.

免责声明:重复的SO问题被标记为已回答,但实际上没有给出正确的解决方案。

Disclaimer: Duplicate of SO question marked as answered but actually didn't give a proper solution.

UDP缓冲区大小不足导致多个高分辨率视频流导致不良流。在LibAV / FFMPEG中,可以通过附加一些 options(buffer_size)

Insufficient UDP buffer size causes broken streams for several high resolution video streams. In LibAV/FFMPEG it's possible to set the udp buffer size for udp urls (udp://...) by appending some options (buffer_size) to it.

但是,对于RTSP网址,这是不支持

However, for RTSP urls this is not supported.

这些是我唯一的解决方案发现:

These are the only solutions I've found:


  • 重建ffmpeg / libav更改 udp.c 源文件。

  • 使用讨厌的黑客通过转换一些私有结构来查找和修改所需的值。

  • 使用不同的解码库(提出的解决方案到上述相关SO 问题)。

  • Rebuilding ffmpeg/libav changing the UDP_MAX_PKT_SIZE in the udp.c source file.
  • Using a nasty hack to find and modify the required value, by casting some private structs.
  • Using a different decoding library (proposed solution to aforementioned related SO question).

一个办法。从我发现,应该可以使用API​​的 AVOptions 来查找并设置此值。否则, AVDictionary

None of these is actually a solution. From what I found it should be possible to use the API's AVOptions to find and set this value. Or else, the AVDictionary.

很难找到如何在libav或ffmpeg的整个文档中设置这些。

It's very difficult to find how to set these throughout the documentation of either libav or ffmpeg.

更新:

由于Libav开发人员

  • @lu_zero ,以下修补程序已被提交到Libav处理此主题:

    The following patches have been submited to Libav tackling this topic, thanks to Libav developer @lu_zero :

    哪些应该提供一个提示如何实现这些,但仍然没有通过官方稳定的API可用。

    Which should offer a hint on how to implement those, still these are not yet available through the official stable API.

    推荐答案

    由于这个提交它足以通过 buffer_size 作为选项,它被转发到 udp 协议通过 rtp 协议。

    Since this commit it is enough to pass buffer_size as option and it gets forwarded to the udp protocol through the rtp protocol.

    我测试过,它的工作原理。

    I tested and it works as intended.

    这篇关于在FFmpeg / LibAV中设置RTSP / UDP缓冲区大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆