简体   繁体   English

使用Gstreamer将多个音频流混合成一个回放声音

[英]Mix multiple audio streams into one playback-sound using Gstreamer

I want to use Gstreamer to receive audio streams from multiple points on the same port. 我想使用Gstreamer从同一端口上的多个点接收音频流。 Indeed I want to stream audio from different nodes on the network to one device that listen to incoming audio streams, and it should mix multiple audios before playback. 确实,我想将音频从网络上的不同节点传输到一台设备,以侦听传入的音频流,并且它应该在播放之前混合多种音频。 I know that I should use audiomixer or liveadder to do such a task. 我知道我应该使用audiomixerliveadder来完成这样的任务。 But I can't do it, and the mixer doesn't act correctly and when two audio streams came, the output sound would be so noisy and corrupted. 但是我做不到,而且混音器无法正常工作,当有两个音频流出现时,输出的声音会变得如此嘈杂和损坏。

I used the following command : 我使用以下命令:

gst-launch-1.0.exe -v udpsrc port=5001 caps="application/x-rtp" ! gst-launch-1.0.exe -v udpsrc port = 5001 caps =“ application / x-rtp”! queue ! 排队! rtppcmudepay ! rtppcmudepay! mulawdec ! mulawdec! audiomixer name=mix mix. 音频混音器名称=混合混音。 ! audioconvert ! 音频转换! audioresample ! audioresample! autoaudiosink autoaudiosink

but it doesn't work. 但这不起作用。

Then, about your mixing problem, you mention that the output sound is "noisy and corrupted", which makes me think of problem with audio levels. 然后,关于您的混音问题,您提到输出声音“嘈杂且损坏”,这让我想到了音频电平的问题。

i have the same problem with Gstreamer Audiomixer, but it's not related to audio level. 我对Gstreamer Audiomixer有相同的问题,但与音频级别无关。 both audio levels are normal, not so loud. 两种音频电平都是正常的,不是很大。 please share a sample pipeline to receive multiple audio streams on a same port, for eg:5001, and then mix them to playback. 请共享一个示例管道,以在同一端口上接收多个音频流,例如:5001,然后将它们混合播放。

Packets on a same port couldn't demux from each other as normal way you wrote in your command, to receive multiple audio streams from same port you should use SSRC and rtpssrcdemux demux. 同一个端口上的数据包不能demux正常的方式,你在你的命令中写道,取长补短,以接收来自同一个端口,你应该使用多个音频流SSRCrtpssrcdemux解复用。 However to receive multiple audio streams on multiple ports and mix them, you could use liveadder element. 但是,要在多个端口上接收多个音频流并进行混合,可以使用liveadder元素。 An example to receive two audio streams from two ports and mix them is as follows: 从两个端口接收两个音频流并将其混合的示例如下:

gst-launch-1.0 -v udpsrc name=src5001 caps="application/x-rtp" port=5001 ! gst-launch-1.0 -v udpsrc name = src5001 caps =“ application / x-rtp” port = 5001! rtppcmudepay ! rtppcmudepay! mulawdec ! mulawdec! audioresample ! audioresample! liveadder name=m_adder ! liveadder名称= m_adder! alsasink device=hw:0,0 udpsrc name=src5002 caps="application/x-rtp" port=5002 ! alsasink设备=硬件:0,0 udpsrc名称= src5002 caps =“ application / x-rtp”端口= 5002! rtppcmudepay ! rtppcmudepay! mulawdec ! mulawdec! audioresample ! audioresample! m_adder. m_adder。

First, you probably want to use audiomixer over liveadder as the first guarantees synchronization of the different audio streams. 首先,你可能想使用audiomixerliveadder为不同的音频流的第一保证同步。

Then, about your mixing problem, you mention that the output sound is "noisy and corrupted", which makes me think of problem with audio levels. 然后,关于您的混音问题,您提到输出声音“嘈杂且损坏”,这让我想到了音频电平的问题。 Though audiomixer clips the output audio to the maximum allowed amplitude range, it can result in audio artefacts if your sources are too loud. 尽管audiomixer器将输出音频剪辑到最大允许幅度范围,但如果您的信号源太大,则可能会导致音频失真。 Thus, you might want to play with the volume property on both sources. 因此,您可能要在两个源上都使用volume属性。 See here and there for more information. 这里那里获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM