How to record multiple audio streams from the same audio source?

Hi,

My question is that is there a way we can record the same audio stream to multiple destinations with different gstreamer pipeline?

We have ODM project with TX2 platform with using Audio ADC Solution (PCM1864).
Customer request to record multiple audio streams from the same audio source.
Thanks.

Test Environment:
-Jetson TX2
-Jetpack 4.4 L4T 32.4.3
-gst-launch-1.0

-Test Command:

gst-launch-1.0 -v alsasrc device=hw:tegrasndt186ref,1 ! audio/x-raw,format=S16LE,rate=48000,channels=4 ! wavenc ! filesink location=audio.wav

-Test Step:

  1. Open a terminal and execute record command (filesik location=audio-1.wav)
  2. Open another terminal and execute record commnad (filesik location=audio-2.wav)

-Issue:
Error message at step2

Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: Could not open audio device for recording. Device is being used by another application.
Additional debug info:
gstalsasrc.c(743): gst_alsasrc_open (): /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0:
Device 'hw:tegrasndt186ref,1' is busy
Setting pipeline to NULL ...
Freeing pipeline ...

Hello @frank_cheng ,

I hope you are doing well.

There is GStreamer Interpipes, one of our open source projects that might be useful for your use case. Check this link for an example:

Now, in the example shown you would be creating an interpipe for the camera source. Another interpipe to preview the video feed. And a different interpipe to record the video. This might be useful for you, since in your case, instead of a camera source you would then have an interpipe for your audio source. And you would be able to dynamically create and destroy interpipes to interact with the same audio source interpipe. Which means that you would be able to have multiple recording pipelines for the same audio source.

In the sample code, for the dynamic management of interpipes we use GStreamer Daemon, another opensource project of ours. It provides a simple interface to interact with pipelines, as well as different APIs for you to use in your custom application. For more information, please check:

Now, if you don’t require to dynamically create pipelines. You could simply use the tee element. For more information please check:

https://gstreamer.freedesktop.org/documentation/coreelements/tee.html

I hope this information is useful for you. If you have any questions don’t hesitate to contact us.

best regards,
Andres Campos
Embedded Software Engineer

Hello Andres,

Thanks for your suggestion.

But our customer request is that using two or more app ( gst-launch-1.0 ) to open the same audio source to recording at different time.

Best Regards.