Having great difficulty with gst-launch-1.0

Some time ago I made a project to play music via a “list of playlists” on a headless Raspberry Pi 4 running Debian 10.8 with GStreamer 1.14.4. I compiled and installed gstd, and my program constructed pipeline commands to send via TCP. Everything worked great!

Now, when trying to re-do this on the same hardware using Debian 12.9 with GStreamer 1.22.0, I can’t get past some of the basics. One difference I should mention is that the new project includes output to Bluetooth headphones.

Using…
$ aplay /home/pi/Ring01.wav
… outputs on HDMI

Using…
$ aplay -D bluealsa /home/pi/Ring01.wav
… outputs on headphones

I believe this means that the hardware is capable of audio output to either device.
I then make the Bluetooth headphones the default audio by creating ~/.asoundrc.

Now using…
$ aplay /home/pi/Ring01.wav
… outputs on headphones
$ aplay -D hdmi:CARD=vc4hdmi0,DEV=0 /home/pi/Ring01.wav
Playing WAVE ‘/home/pi/Ring01.wav’ : Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
Warning: rate is not accurate (requested = 22050Hz, got = 32000Hz)
please, try the plug plugin
… outputs on HDMI with a warning

Moving on to GStreamer…

Trying this fails outright…
$ gst-launch-1.0 filesrc location=/home/pi/Kryptonite.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! autoaudiosink
Setting pipeline to PAUSED …
Pipeline is PREROLLING …
AL lib: (EE) ALCplaybackAlsa_reset: snd_pcm_hw_params(self->pcmHandle, hp) failed: File descriptor in bad state
ERROR: from element /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0/GstOpenALSink:autoaudiosink0-actual-sink-openal: Unable to prepare device.
Additional debug info:
…/ext/openal/gstopenalsink.c(861): gst_openal_sink_prepare (): /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0/GstOpenALSink:autoaudiosink0-actual-sink-openal:
ALC error: Invalid Device
ERROR: pipeline doesn’t want to preroll.
Setting pipeline to NULL …
Freeing pipeline …

Trying this looks like it starts, then immediately fails…
$ gst-launch-1.0 playbin3 uri=file:///home/pi/Kryptonite.mp3
Setting pipeline to PAUSED …
Pipeline is PREROLLING …
D: bluealsa-pcm.c:1309: Getting BlueALSA PCM: PLAYBACK 00:16:94:0C:4A:81 a2dp
D: bluealsa-pcm.c:1062: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Setting constraints
D: bluealsa-pcm.c:443: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Closing
D: bluealsa-pcm.c:1309: Getting BlueALSA PCM: PLAYBACK 00:16:94:0C:4A:81 a2dp
D: bluealsa-pcm.c:1062: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Setting constraints
D: bluealsa-pcm.c:532: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Initializing HW
D: bluealsa-pcm.c:567: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: FIFO buffer size: 1024 frames
D: bluealsa-pcm.c:581: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Selected HW buffer: 3 periods x 4456 bytes <= 13376 bytes
D: bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Initializing SW
D: bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Initializing SW
D: bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Initializing SW
D: bluealsa-pcm.c:639: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Prepared
D: bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Initializing SW
D: bluealsa-pcm.c:639: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Prepared
D: bluealsa-pcm.c:356: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Starting
D: bluealsa-pcm.c:226: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Starting IO loop: 12
D: bluealsa-pcm.c:592: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Freeing HW
D: bluealsa-pcm.c:532: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Initializing HW
ALSA lib bluealsa-pcm.c:323:(io_thread) PCM FIFO write error: Bad file descriptor
D: bluealsa-pcm.c:161: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: IO thread cleanup
D: bluealsa-pcm.c:567: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: FIFO buffer size: 1024 frames
D: bluealsa-pcm.c:581: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Selected HW buffer: 3 periods x 4452 bytes <= 13360 bytes
D: bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Initializing SW
D: bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Initializing SW
D: bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Initializing SW
D: bluealsa-pcm.c:639: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Prepared
D: bluealsa-pcm.c:600: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Initializing SW
AL lib: (EE) UpdateDeviceParams: Failed to set 44100hz, got 48000hz instead
D: bluealsa-pcm.c:639: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Prepared
D: bluealsa-pcm.c:356: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Starting
D: bluealsa-pcm.c:226: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Starting IO loop: 12
AL lib: (EE) ALCplaybackAlsa_mixerProc: Invalid state detected: No such device
Redistribute latency…
Pipeline is PREROLLED …
Setting pipeline to PLAYING …
Redistribute latency…
New clock: GstAudioSinkClock
D: bluealsa-pcm.c:231: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Pausing IO thread
Got EOS from element “playbin3-0”.
Execution ended after 0:00:01.283004348
Setting pipeline to NULL …
D: bluealsa-pcm.c:592: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Freeing HW
D: bluealsa-pcm.c:443: /org/bluealsa/hci0/dev_00_16_94_0C_4A_81/a2dpsrc/sink: Closing
Freeing pipeline …

This also fails…
$ gst-launch-1.0 playbin3 uri=file:///home/pi/Kryptonite.mp3 audio-sink=bluealsa
ERROR: pipeline could not be constructed: could not set property “audio-sink” in element “playbin3” to “bluealsa”.

Can anybody tell me what I’m doing wrong? If I can’t get the GStreamer command line tools to work, I don’t want to try gstd yet.

Thank for any insight

Hi Please check first you have pair bluetooth headset and you are able to detect same source in pulseaudio.

You can check sinks by using command: “pactl list sinks”. If not sinks found related to bluetooth then first resolve that and then run gstreamer

Thank you for your response; sorry for late reply, I was not working on computer this past week.

This is what is confusing to me. I installed using BlueAlsa, so I don’t think there’s PulseAudio. The headphones are definitely paired, and I was able to use aplay to listen to a .wav file.

In any case, I got frustrated, and started all over using Bullseye distribution, with PulseAudio. I pulled GSTreamer 1.18.4 and gstd 0.14.0; it works 100%, no issue whatsoever. Some day, I may find that I need to do this again when there’s no more Bullseye. :frowning_face: