mix two audio streams

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

mix two audio streams

Farzan Shojaee

Hi all,

 

I want to receive two audio streams from two different ports (5001 and 5002), then mix them and playback. I used the following command in windows, and it worked correctly :

 

gst-launch-1.0.exe -v audiomixer name=mix mix. ! audioconvert ! audioresample ! autoaudiosink udpsrc port=5001 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! mix. udpsrc port=5002 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! mix.

 

But when I want to test it on a linux based system running angstrom yocto, it doesn't work. No sound heard while there are incoming audio streams. the following command is used :

 

gst-launch-1.0 -v audiomixer name=mix mix. ! audioconvert ! audioresample ! alsasink device=hw:0,0  udpsrc port=5001 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! mix. udpsrc port=5002 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! mix.

 

Has anybody and idea to solve it.

 

Thanks.


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mix two audio streams

Vivia Nikolaidou
Hi,

First you can try writing into a file instead of alsasink. Does that
work? If so, there's your problem.

Can you play an audiotestsrc ! alsasink ?

If that still doesn't work, even when you try writing into a file, try
removing the audiomixer and playing back the two streams one by one.
If that works, something goes wrong with the mixing. Then you can try
two audiotestsources that go into an audiomixer, or an audiomixer with
only one input, etc.

Anyway, you can try debugging it bit by bit like this, trying out
small parts of the pipeline and figuring out what the problem is.

Let us know how it goes.

Best regards,

Vivia

On 9 August 2017 at 15:54, Farzan Shojaee <[hidden email]> wrote:

> Hi all,
>
>
>
> I want to receive two audio streams from two different ports (5001 and
> 5002), then mix them and playback. I used the following command in windows,
> and it worked correctly :
>
>
>
> gst-launch-1.0.exe -v audiomixer name=mix mix. ! audioconvert !
> audioresample ! autoaudiosink udpsrc port=5001 caps="application/x-rtp" !
> queue ! rtppcmudepay ! mulawdec ! mix. udpsrc port=5002
> caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! mix.
>
>
>
> But when I want to test it on a linux based system running angstrom yocto,
> it doesn't work. No sound heard while there are incoming audio streams. the
> following command is used :
>
>
>
> gst-launch-1.0 -v audiomixer name=mix mix. ! audioconvert ! audioresample !
> alsasink device=hw:0,0  udpsrc port=5001 caps="application/x-rtp" ! queue !
> rtppcmudepay ! mulawdec ! mix. udpsrc port=5002 caps="application/x-rtp" !
> queue ! rtppcmudepay ! mulawdec ! mix.
>
>
>
> Has anybody and idea to solve it.
>
>
>
> Thanks.
>
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mix two audio streams

Baby Octopus
Can you enable verbose mode (-v) and see what caps are negotiated?
Also, check which device you are writing into when you use alsasink.
Add 'level' element right before alsasink to see if the audio is actually silent or has valid samples(You need enable -m to see the message posted by level)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: mix two audio streams

Farzan Shojaee
Hi
Yea, I have enabled the verbose mode and the negotiated caps seems to be ok, but nothing heard, these are the negotiated caps :

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
/GstPipeline:pipeline0/GstUDPSrc:udpsrc0.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
/GstPipeline:pipeline0/GstRtpPcmuDepay:rtppcmudepay0.GstPad:src: caps = "audio/x-mulaw\,\ channels\=\(int\)1\,\ rate\=\(int\)8000"
/GstPipeline:pipeline0/GstMuLawDec:mulawdec0.GstPad:sink: caps = "audio/x-mulaw\,\ channels\=\(int\)1\,\ rate\=\(int\)8000"
/GstPipeline:pipeline0/GstRtpPcmuDepay:rtppcmudepay0.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
/GstPipeline:pipeline0/GstUDPSrc:udpsrc1.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
Setting pipeline to PLAYING ...
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
New clock: GstSystemClock
/GstPipeline:pipeline0/GstMuLawDec:mulawdec0.GstPad:src: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)8000\,\ channels\=\(int\)1"
/GstPipeline:pipeline0/GstAudioMixer:mix.GstAudioMixerPad:sink_0: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)8000\,\ channels\=\(int\)1"

I have checked the audiomixer as alone, by the following format :
gst-launch-1.0 audiotestsrc freq=100 ! audiomixer name=mix ! audioconvert ! alsasink audiotestsrc freq=500 ! mix.

Its ok and two mixed audio heard from headphone.

And when try to receive one audio stream by using the following format, everything is ok so :
gst-launch-1.0 -v udpsrc port=5001 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! audioconvert ! alsasink device=hw:0,0

I really don't know how can I debug the issue and why it's not working, even I changed the command format to the following but still no audio heard :

gst-launch-1.0 -v udpsrc port=5001 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! audiomixer name=mix ! alsasink device=hw:0,0 udpsrc port=5002 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! mix.

Thanks for your response.

-----Original Message-----
From: gstreamer-devel [mailto:[hidden email]] On Behalf Of Baby Octopus
Sent: Thursday, August 10, 2017 4:57 PM
To: [hidden email]
Subject: Re: mix two audio streams

Can you enable verbose mode (-v) and see what caps are negotiated?
Also, check which device you are writing into when you use alsasink.
Add 'level' element right before alsasink to see if the audio is actually silent or has valid samples(You need enable -m to see the message posted by
level)



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/mix-two-audio-streams-tp4684132p4684144.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mix two audio streams

Vivia Nikolaidou
Hi,

Try with audiomixer start-time-selection=1 and see if that fixes your issue.

Otherwise, see if there are any buffers going into your sink:

gst-launch-1.0 -v udpsrc port=5001 ! [more stuff here] ! audiomixer
name=mix start-time-selection=1 ! fakesink silent=false

Compare with the timestamps of the buffers from the working pipeline.

On 14 August 2017 at 10:16, Farzan Shojaee <[hidden email]> wrote:

> Hi
> Yea, I have enabled the verbose mode and the negotiated caps seems to be ok, but nothing heard, these are the negotiated caps :
>
> Setting pipeline to PAUSED ...
> Pipeline is live and does not need PREROLL ...
> /GstPipeline:pipeline0/GstUDPSrc:udpsrc0.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
> /GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
> /GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
> /GstPipeline:pipeline0/GstRtpPcmuDepay:rtppcmudepay0.GstPad:src: caps = "audio/x-mulaw\,\ channels\=\(int\)1\,\ rate\=\(int\)8000"
> /GstPipeline:pipeline0/GstMuLawDec:mulawdec0.GstPad:sink: caps = "audio/x-mulaw\,\ channels\=\(int\)1\,\ rate\=\(int\)8000"
> /GstPipeline:pipeline0/GstRtpPcmuDepay:rtppcmudepay0.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
> /GstPipeline:pipeline0/GstUDPSrc:udpsrc1.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
> Setting pipeline to PLAYING ...
> /GstPipeline:pipeline0/GstQueue:queue1.GstPad:src: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
> /GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
> /GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = "application/x-rtp\,\ media\=\(string\)audio\,\ payload\=\(int\)0\,\ clock-rate\=\(int\)8000"
> New clock: GstSystemClock
> /GstPipeline:pipeline0/GstMuLawDec:mulawdec0.GstPad:src: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)8000\,\ channels\=\(int\)1"
> /GstPipeline:pipeline0/GstAudioMixer:mix.GstAudioMixerPad:sink_0: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)8000\,\ channels\=\(int\)1"
>
> I have checked the audiomixer as alone, by the following format :
> gst-launch-1.0 audiotestsrc freq=100 ! audiomixer name=mix ! audioconvert ! alsasink audiotestsrc freq=500 ! mix.
>
> Its ok and two mixed audio heard from headphone.
>
> And when try to receive one audio stream by using the following format, everything is ok so :
> gst-launch-1.0 -v udpsrc port=5001 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! audioconvert ! alsasink device=hw:0,0
>
> I really don't know how can I debug the issue and why it's not working, even I changed the command format to the following but still no audio heard :
>
> gst-launch-1.0 -v udpsrc port=5001 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! audiomixer name=mix ! alsasink device=hw:0,0 udpsrc port=5002 caps="application/x-rtp" ! queue ! rtppcmudepay ! mulawdec ! mix.
>
> Thanks for your response.
>
> -----Original Message-----
> From: gstreamer-devel [mailto:[hidden email]] On Behalf Of Baby Octopus
> Sent: Thursday, August 10, 2017 4:57 PM
> To: [hidden email]
> Subject: Re: mix two audio streams
>
> Can you enable verbose mode (-v) and see what caps are negotiated?
> Also, check which device you are writing into when you use alsasink.
> Add 'level' element right before alsasink to see if the audio is actually silent or has valid samples(You need enable -m to see the message posted by
> level)
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/mix-two-audio-streams-tp4684132p4684144.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: mix two audio streams

Farzan Shojaee
Hi,

> Try with audiomixer start-time-selection=1 and see if that fixes your issue.

It has no effect. It doesn't work yet!!

I found that when I config to receive two audio streams, no sound heard when one of these two audio sources is inactive, but when both of them are streaming the audio, then something that is a cutted-sound heard from headphone, and incoming streams are so corrupted. I have used the following command :

gst-launch-1.0 -v udpsrc name='src1' caps="application/x-rtp" port=5002 ! rtppcmudepay ! mulawdec ! audioconvert ! audioresample ! mix. udpsrc name='src2' caps="application/x-rtp" port=5001 ! rtppcmudepay ! mulawdec ! audioconvert ! audioresample ! mix. audiomixer name=mix start-time-selection=1 ! alsasink device=hw:0,0

as I understand from the debugging messages (verbose), the audio mixer source port won't connect to Alsa, when one of the audio streams be inactive. It would be connect when both of audio sources are streaming. The following message appear when both audio streams become available :

/GstPipeline:pipeline0/GstAudioMixer:mix.GstPad:src: caps = "audio/x-raw\,\ format\=\(string\)S16LE\,\ layout\=\(string\)interleaved\,\ rate\=\(int\)8000\,\ channels\=\(int\)1"

The surprising note is that it works perfectly on windows with the same command format. But it doesn't work on my linux device.


gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Loading...