检测 RTP 流中使用的编解码器(对于动态 PT)

发布于 2024-10-07 03:02:56 字数 166 浏览 16 评论 0原文

是否可以通过单独分析 RTP 流来检测 RTP 流中使用的编解码器?我了解 RTP 标头中的有效负载类型 (PT) 字段,该字段可用于识别具有静态分配 PT 编号的编解码器。其他使用动态 PT 编号范围的编解码器又如何呢?是否有任何启发式方法来检测有效负载的类型?我对各种解决方案感兴趣,即使检测仅适用于一种编解码器。

Is it possible to detect the codec used in an RTP stream by analyzing the RTP stream alone? I know about the payload type (PT) field in the RTP header -- that can be used to identify codecs that have statically assigned PT numbers. What about the other codecs that use the dynamic PT number range? Are there any heuristics to detect the type of the payload? I'm interested in all kinds of solutions, even if the detection works for one codec only.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

紫竹語嫣☆ 2024-10-14 03:02:56

是的,这是可能的。 此 C/C++ 源代码具有启发式开发多年来,它对于 LTE 编解码器(EVS、AMR-NB、AMR-WB)和 H.265 来说都是可靠的。查找 detector_codec_type_and_bitrate()。基本上它从唯一的值和序列开始,然后过渡到一系列有效负载大小开关语句;其中它会进行更多的价值检查。它处理 EVS 主模式和 AMR-WB IO 兼容模式之间的冲突情况。它还填充了一些进度和调试变量,这对于像这样的代码在遇到新案例时查看哪里出了问题非常重要

免责声明:我写了其中的一部分,并且自 2018 年以来一直在更新和维护它

yes it is possible. This C/C++ source code has a heuristic developed over several years that is reliable for LTE codecs (EVS, AMR-NB, AMR-WB) and also H.265. Look for detect_codec_type_and_bitrate(). Basically it starts off with unique values and sequences and then transitions to a series of payload size switch statements; within those it does more value checking. It handles collision cases between EVS primary and AMR-WB IO compatibility modes. It also fills in some progress and debug vars, which is important for code like this to see where it went wrong when it encounters a new case

Disclaimer: I wrote part of this, and have been updating and maintaining it since 2018

锦上情书 2024-10-14 03:02:56

当然,您可以嗅探数据包,看看它是否是 RFC XXX 或 YYY 等。长度检查(对于固定长度编解码器,但要注意每个数据包有多个帧);时间戳速率(告诉您窄/宽/超宽带音频或视频);然后您可以查看前 N 个字节是否与可能匹配之一的有效模式匹配。

除非您只对其中一个子集感兴趣,否则这不是一个小工作量。

Sure, you can sniff around the packet to see if it appears to be RFC XXX, or YYY, etc. Length checks (for fixed-length codecs, though watch out for multiple frames per packet); timestamp rate (tells you narrow/wide/ultra-wide band audio or video); and then you can see if the first N bytes matches the valid pattern for one of the possible matches.

Not a small amount of work unless you're only interested in a subset.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文