问题描述
我正在开发一个应用程序,在该应用程序中,我将从管道一端的位置使用 wave文件 ,并使用 udpsink 在另一端.
I am developing an application where I am using a wave file from a location at one end of a pipeline and udpsink at the other end of it.
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
上述波文件的采样率= 44100 Hz,具有单通道(单声道)
The Above wave file is having sampling rate = 44100 Hz and single-channel(mono)
在同一台PC上,我正在使用c++
程序应用程序捕获这些数据包,并 depayload 到无标题音频文件(例如Tornado.raw)
On the same PC I am using a c++
program application to catch these packets and depayload to a headerless audio file (say Tornado.raw)
我为此创建的管道基本上是
The pipeline I am creating for this is basically
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播放它时,它发挥得很好!
Now This works fine. I get the headerless data and when I play it using the Audacity It plays great!
我正在尝试从44100 Hz到8000 Hz的管道中重新采样此音频文件
I am trying to resample this audio file while it is in pipeline from 44100 Hz to 8000 Hz
仅将clock-rate=(int)44100
更改为clock-rate=(int)8000
并没有帮助(逻辑上也是荒谬的)我正在寻找如何以8000 Hz采样在流水线输出处获取无标题文件.
Simply changing the clock-rate=(int)44100
to clock-rate=(int)8000
is not helping (also absurd logically)I am looking for how to get the headerless file at the pipeline output with 8000 Hz sampling.
我现在要获取的数据是Big-endian,但我希望Little-endian作为输出.如何在管道中进行设置?
Also the data that I am getting now is Big-endian, but I want Little-endian as output. how do I set that in the pipeline?
您可能将此问题与我之前的问题之一.
推荐答案
首先,您的管道中有一些怪异的上限-宽度和高度用于此处的视频.他们可能会被忽略..但仍然..也不确定在其他人身上,但是..
First, you have some weird caps in your pipeline - width and height are for video here. They probably will be just ignored.. but still.. not sure on others there as well but meh..
对于实际问题.只需使用Gstreamer的audioresample
和audioconvert
元素以所需的格式进行传输即可.
For the actual question. Just use audioresample
and audioconvert
elements of Gstreamer to transfer in your desired format.
例如
[..] ! rtpL16depay ! audioresample ! audioconvert ! \
audio/x-raw, rate=8000, format=S16LE ! filesink location=Tornado.raw
这篇关于使用gstreamer对音频rtp进行重采样和取消负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!