Getting gstreamer to produce out of raspberryPi usb-audio

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

Getting gstreamer to produce out of raspberryPi usb-audio

rikb
[i've posted this on the raspberrypiSE, together with further details and
nicer formatting]

https://raspberrypi.stackexchange.com/questions/108784/getting-gstreamer-to-produce-out-of-usb-audio

I cannot get gstreamer on raspbian (buster) to play through a usb-audio
device, despite other players (vlc, aplay) being able to do so. but i need
gstreamer because of its API access, for mpd players like gmpc.

this post is related to many others i've found (listed below), but i've
exhausted the resources mentioned there, so i and want to report on
experiments i've done, still without success.

Following [suggestions
here](https://computers.tutsplus.com/articles/using-a-usb-audio-device-with-a-raspberry-pi)
i've editted my `/usr/share/alsa/alsa.conf` to look like:

                defaults.ctl.card 1 # 0
                defaults.pcm.card 1 # 0

i've tried lots of different experiments, and also varied touchscreen
vs. HDMI display options.  i can use `vlc`  to get to usb-audio with both
touchscreen and HDMI.  `aplay` with the touchscreen is also able to send
sound to
usb-audio.  (my current guess is that aplay is missing some `mp3` codec
and barfing out noise?)

clearly there are lower-level (kernel? raspbian?) resource paths that
i don't know about.   how can i make gstreamer consume whatever
resource it is that `vlc` and `aplay` are able to use to get to usb-audio?





--
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: Getting gstreamer to produce out of raspberryPi usb-audio

Nicolas Dufresne-5
Le jeudi 27 février 2020 à 12:21 -0600, rikb a écrit :

> [i've posted this on the raspberrypiSE, together with further details and
> nicer formatting]
>
> https://raspberrypi.stackexchange.com/questions/108784/getting-gstreamer-to-produce-out-of-usb-audio
>
> I cannot get gstreamer on raspbian (buster) to play through a usb-audio
> device, despite other players (vlc, aplay) being able to do so. but i need
> gstreamer because of its API access, for mpd players like gmpc.
>
> this post is related to many others i've found (listed below), but i've
> exhausted the resources mentioned there, so i and want to report on
> experiments i've done, still without success.
>
> Following [suggestions
> here](https://computers.tutsplus.com/articles/using-a-usb-audio-device-with-a-raspberry-pi)
> i've editted my `/usr/share/alsa/alsa.conf` to look like:
>
> defaults.ctl.card 1 # 0
> defaults.pcm.card 1 # 0
>
> i've tried lots of different experiments, and also varied touchscreen
> vs. HDMI display options.  i can use `vlc`  to get to usb-audio with both
> touchscreen and HDMI.  `aplay` with the touchscreen is also able to send
> sound to
> usb-audio.  (my current guess is that aplay is missing some `mp3` codec
> and barfing out noise?)
>
> clearly there are lower-level (kernel? raspbian?) resource paths that
> i don't know about.   how can i make gstreamer consume whatever
> resource it is that `vlc` and `aplay` are able to use to get to usb-audio?

What about describing what you have tried with GStreamwer so far and
how it didn't work for you ? Maybe you could share the output of aplay
-L when the usb dongle is in ?

>
>
>
>
>
> --
> 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: Getting gstreamer to produce out of raspberryPi usb-audio

rikb
hello Nicolas,  thanks for your interest!

gst-launch-1.0 playbin uri='file:///path2.mp3'

produces sound thru HDMI, and produces no sound, but acts
as if it's playing, with the touch screen.

aplay and vlc produces sound thru usb in both cases.

pi@raspberrypi:~ $ aplay -L

null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
dmix:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample mixing device
dmix:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample mixing device
dmix:CARD=ALSA,DEV=2
    bcm2835 ALSA, bcm2835 IEC958/HDMI1
    Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample snooping device
dsnoop:CARD=ALSA,DEV=2
    bcm2835 ALSA, bcm2835 IEC958/HDMI1
    Direct sample snooping device
hw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct hardware device without any conversions
hw:CARD=ALSA,DEV=2
    bcm2835 ALSA, bcm2835 IEC958/HDMI1
    Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Hardware device with all software conversions
plughw:CARD=ALSA,DEV=2
    bcm2835 ALSA, bcm2835 IEC958/HDMI1
    Hardware device with all software conversions
default:CARD=Device
    USB PnP Sound Device, USB Audio
    Default Audio Device
sysdefault:CARD=Device
    USB PnP Sound Device, USB Audio
    Default Audio Device
front:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Front speakers
surround21:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Direct sample mixing device
dsnoop:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Direct sample snooping device
hw:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Device,DEV=0
    USB PnP Sound Device, USB Audio
    Hardware device with all software conversions




--
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: Getting gstreamer to produce out of raspberryPi usb-audio

rikb
and omxplayer acts like gst-launch:  plays thru HDMI but is silent/runs with
touchscreen.



--
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: Getting gstreamer to produce out of raspberryPi usb-audio

Nicolas Dufresne-5


Le ven. 28 févr. 2020 18 h 45, rikb <[hidden email]> a écrit :
and omxplayer acts like gst-launch:  plays thru HDMI but is silent/runs with
touchscreen.

GStreamer is likely picking your system default, check the long list of choices, and check the default, it's would be surprising if it takes usb interface.

What you need to do as an app developer is to configure the audio sink to use the device you want.

As an example:

gst-launch-1.0 playbin audio-sink="alsasink device=default:CARD=Device" ...




--
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: Getting gstreamer to produce out of raspberryPi usb-audio

rikb
 Thanks Nicolas!

     gst-launch-1.0 playbin audio-sink="alsasink device=hw:CARD=Device"
uri='file:///path2.mp3'

works!  and with your hint i can find the doc on `alsasink`.  but is there
some other documentation i've missed that would have let me figure this out?



--
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: Getting gstreamer to produce out of raspberryPi usb-audio

rikb
for example, this solves the issue when gst-launch is run from the command
line, but
how do i specify `alsasink` via the python API?




--
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: Getting gstreamer to produce out of raspberryPi usb-audio

Nicolas Dufresne-5
Le samedi 29 février 2020 à 11:55 -0600, rikb a écrit :
> for example, this solves the issue when gst-launch is run from the command
> line, but
> how do i specify `alsasink` via the python API?

In Python, you can set properties using:

  asink.props.device = "my-audio-device"

For Python documentation, visit
https://gstreamer.freedesktop.org/documentation and clock on the
"Language" drop down, select "Python" and then your search results
should be adapted.

The GLib specification documentation will be found on Gnome website
though. You may want to give a look at various tutorials in Python.

>
>
>
>
> --
> 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