在FFmpeg / LibAV中设置RTSP / UDP缓冲区大小 [英] Set RTSP/UDP buffer size in FFmpeg/LibAV
问题描述
注意:我知道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:
- 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开发人员
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屋!