使用gstreamer重新采样和降低音频rtp

问题描述 投票:1回答:1

我正在开发一个应用程序,我正在使用来自管道一端的位置的wave文件和另一端的udpsink。

gst-launch-1.0 filesrc location=/path/to/wave/file/Tornado.wav ! wavparse ! audioconvert ! audio/x-raw,channels=1,depth=16,width=16,rate=44100 ! rtpL16pay  ! udpsink host=xxx.xxx.xxx.xxx port=5000

Above wave文件的采样率= 44100 Hz,单通道(单声道)

在同一台PC上我使用c++程序应用程序来捕获这些数据包并将depayload转移到无头音频文件(比如Tornado.raw)

我为此创建的管道基本上就是这样

gst-launch-1.0 udpsrc port=5000 ! "application/x-rtp,media=(string)audio, clock-rate=(int)44100, width=16, height=16, encoding-name=(string)L16, encoding-params=(string)1, channels=(int)1, channel-positions=(int)1, payload=(int)96" ! rtpL16depay ! filesink location=Tornado.raw

现在这很好用。我得到了无头数据,当我使用Audacity播放它时播放效果非常好!

我正在尝试重新采样此音频文件,当它处于从44100 Hz到8000 Hz的管道中时

简单地将clock-rate=(int)44100更改为clock-rate=(int)8000并没有帮助(逻辑上也荒谬)我正在寻找如何在8000 Hz采样的管道输出中获取无头文件。

我现在得到的数据也是Big-endian,但我想要Little-endian作为输出。我该如何在管道中设置?

你可能会把它与my earlier question之一联系起来。

c++ audio gstreamer pipeline resampling
1个回答
2
投票

首先,你的管道中有一些奇怪的帽子 - 宽度和高度都是视频。他们可能会被忽略..但仍然......不确定其他人那里,但是......

对于实际问题。只需使用Gstreamer的audioresampleaudioconvert元素以您想要的格式进行传输。

EG

[..] ! rtpL16depay ! audioresample ! audioconvert ! \
audio/x-raw, rate=8000, format=S16LE ! filesink location=Tornado.raw
© www.soinside.com 2019 - 2024. All rights reserved.