select channel to record from input device

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

select channel to record from input device

kyle111
Hello all,

I've been using gstreamer plug-ins for recording and speech recognition
purposes and it's working fine.
Normally, I'd use "aslasrc" and set "device" property to "hw:1" , "hw:2" ,
etc for my multiple input mics.

Now, I have ONE input device with multiple input channels and I want to
record only from specific channel (i.e. let's say , out of 8 input channels,
record Right chn or chn-id = 2).
However, I've look into the  documentation
<https://gstreamer.freedesktop.org/documentation/alsa/alsasrc.html?gi-language=c>  
but can't find anything related to selecting channel ID.  

Is that possible to do with gstreamer ?

Thank you guys



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: select channel to record from input device

Nicolas Dufresne-5
Le jeudi 20 juin 2019 à 22:24 -0500, kyle111 a écrit :

> Hello all,
>
> I've been using gstreamer plug-ins for recording and speech recognition
> purposes and it's working fine.
> Normally, I'd use "aslasrc" and set "device" property to "hw:1" , "hw:2" ,
> etc for my multiple input mics.
>
> Now, I have ONE input device with multiple input channels and I want to
> record only from specific channel (i.e. let's say , out of 8 input channels,
> record Right chn or chn-id = 2).
> However, I've look into the  documentation
> <https://gstreamer.freedesktop.org/documentation/alsa/alsasrc.html?gi-language=c>  
> but can't find anything related to selecting channel ID.  
alsasrc cannot do channel selection. But you can achieve this using
deinterleave element.

>
> Is that possible to do with gstreamer ?
>
> Thank you guys
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.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

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: select channel to record from input device

kyle111
Thanks Nicolas, I also managed to find 'deinterleave' element and it seems to
be working now.
You suggestion further reassure me.
I am now able to record 2 channels separately:

gst-launch-1.0 alsasrc device=default ! decodebin ! audioconvert !
"audio/x-raw,channels=2" ! deinterleave name=d d.src_0 ! queue !
audioconvert ! vorbisenc ! oggmux ! filesink location=channel1.ogg d.src_1 !
queue ! audioconvert ! vorbisenc ! oggmux ! filesink location=channel2.ogg

I am trying to implement this in Python GST. I am not sure how to implement
this line:
deinterleave name=d d.src_0

I know element = 'deinterleave', property,value='name','d'
but what is d.src_0 in Gstreamer terminology? is it another src pad ?

# current code
deinterleave = Gst.ElementFactory.make("deinterleave", "deinterleave")
deinterleave.set_property("name", 'd')
## how to declare d.src_0 and d.src_1

I am aware this is not gstreamer python forum. Stuck on this code so I'm
just trying my luck.
Thanks :)  








--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: select channel to record from input device

Nicolas Dufresne-5


Le dim. 30 juin 2019 08 h 10, kyle111 <[hidden email]> a écrit :
Thanks Nicolas, I also managed to find 'deinterleave' element and it seems to
be working now.
You suggestion further reassure me.
I am now able to record 2 channels separately:

gst-launch-1.0 alsasrc device=default ! decodebin ! audioconvert !
"audio/x-raw,channels=2" ! deinterleave name=d d.src_0 ! queue !
audioconvert ! vorbisenc ! oggmux ! filesink location=channel1.ogg d.src_1 !
queue ! audioconvert ! vorbisenc ! oggmux ! filesink location=channel2.ogg

I am trying to implement this in Python GST. I am not sure how to implement
this line:
deinterleave name=d d.src_0

I know element = 'deinterleave', property,value='name','d'
but what is d.src_0 in Gstreamer terminology? is it another src pad ?

# current code
deinterleave = Gst.ElementFactory.make("deinterleave", "deinterleave")
deinterleave.set_property("name", 'd')
## how to declare d.src_0 and d.src_1

I am aware this is not gstreamer python forum. Stuck on this code so I'm
just trying my luck.
Thanks :) 

Doing this manually requires connecting to the deinterleave pad-added signal. That's how "sometimes pad" are handled. I'm replying from my phone, so it is hard for me to provide an example, my apology. An alternative, which is what I usually do, is to use Gst.parse_lauch() which is basically the same thing gst-lau ch uses. It's such a time saver for simple cases that works in gst-launch. Of you give elements a name, you can always access these elements using pipeline.get_by_name().









--
Sent from: http://gstreamer-devel.966125.n4.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
|

Re: select channel to record from input device

kyle111
Nicolas Dufresne-5 wrote
> Le dim. 30 juin 2019 08 h 10, kyle111 &lt;

> purehavoc77@

> &gt; a écrit :
>
>
>
> Doing this manually requires connecting to the deinterleave pad-added
> signal. That's how "sometimes pad" are handled. I'm replying from my
> phone,
> so it is hard for me to provide an example, my apology. An alternative,
> which is what I usually do, is to use Gst.parse_lauch() which is basically
> the same thing gst-lau ch uses. It's such a time saver for simple cases
> that works in gst-launch. Of you give elements a name, you can always
> access these elements using pipeline.get_by_name().
> _____________________________

Might be late reply but better late than never. I make it wok by using
Gst_parse() as you suggested on my python code. Many thanks to you !




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel