使用ogg容器封装从RTP数据包中提取的opus payload的实现
Implementation of encapsulating extracted opus payload from RTP packet with ogg container
我们有捕获的 pcap 文件,其中包含每个 rfc6716 的 RTP opus 有效载荷,现在我们可以切断 RTP header 并提取 opus 有效载荷,我们想根据规范将有效载荷封装到 ogg opus https://datatracker.ietf.org/doc/html/draft-ietf-codec-oggopus-07 (Ogg Encapsulation for the Opus Audio Codec) 并发送出去,这样VLC就可以播放捕获的opus,我们不想保存到ogg文件然后让VLC播放,我们将把ogg opus发送到一包封装后直接VLC,谁有封装的参考实现,或者3rd party library可以参考一下吗?
如果你想从 pcap 保存文件中读取数据包,可以使用 libpcap library and then encapsulated in Ogg using the libogg library. There is an example program called opusrtp
in the opus-tools package that can sniff for Opus RTP packets on the loopback interface using libpcap and write them to Ogg. You would want to do something similar, but change the pcap_open_live()
to something like pcap_open_offline()
读取数据包,并将 Ogg 页面从 libogg 写入套接字而不是文件。同时将 OPUS_PAYLOAD_TYPE
定义为您要查找的 RTP 负载类型。
我有类似的需求,并根据建议 我写了一个 opusrtp
的集成,它可以接收 pcap 文件作为输入,然后从中生成 .opus。
要点实际上是使用 pcap_open_offline()
而不是 pcap_open_live()
,设置正确的负载类型,以及一些其他细节以适应输入文件格式。
I have the modified opusrtp in a fork on github.
您可以将它与类似的东西一起使用
./opusrtp --extract PCAPFILE
它生成 rtpdump.opus
,然后您可以根据需要对其进行转换。
我们有捕获的 pcap 文件,其中包含每个 rfc6716 的 RTP opus 有效载荷,现在我们可以切断 RTP header 并提取 opus 有效载荷,我们想根据规范将有效载荷封装到 ogg opus https://datatracker.ietf.org/doc/html/draft-ietf-codec-oggopus-07 (Ogg Encapsulation for the Opus Audio Codec) 并发送出去,这样VLC就可以播放捕获的opus,我们不想保存到ogg文件然后让VLC播放,我们将把ogg opus发送到一包封装后直接VLC,谁有封装的参考实现,或者3rd party library可以参考一下吗?
如果你想从 pcap 保存文件中读取数据包,可以使用 libpcap library and then encapsulated in Ogg using the libogg library. There is an example program called opusrtp
in the opus-tools package that can sniff for Opus RTP packets on the loopback interface using libpcap and write them to Ogg. You would want to do something similar, but change the pcap_open_live()
to something like pcap_open_offline()
读取数据包,并将 Ogg 页面从 libogg 写入套接字而不是文件。同时将 OPUS_PAYLOAD_TYPE
定义为您要查找的 RTP 负载类型。
我有类似的需求,并根据建议 opusrtp
的集成,它可以接收 pcap 文件作为输入,然后从中生成 .opus。
要点实际上是使用 pcap_open_offline()
而不是 pcap_open_live()
,设置正确的负载类型,以及一些其他细节以适应输入文件格式。
I have the modified opusrtp in a fork on github.
您可以将它与类似的东西一起使用
./opusrtp --extract PCAPFILE
它生成 rtpdump.opus
,然后您可以根据需要对其进行转换。