Search code examples
audiogstreameralsagst-launch

gst-launch won't play to alsasink device=hw:2


Using the following works fine

gst-launch-0.10 filesrc location=temp.wav ! wavparse ! audioconvert ! alsasink device=hw:0

as does

gst-launch-1.0 filesrc location=temp.wav ! wavparse ! audioconvert ! alsasink device=hw:0

When I use hw:2, I get a device is busy error if a player is using it and an Internal data flow error otherwise.

If I enable debugging

GST_DEBUG=2

I get the following

         alsa pcm_hw.c:1693:_snd_pcm_hw_open: alsalib error: Invalid value for card
basetransform gstbasetransform.c:1414:gst_base_transform_setcaps:<audioconvert0> transform could not transform audio/x-raw, format=(string)S16LE, layout=(string)interleaved, channels=(int)2, channel-mask=(bitmask)0x0000000000000003, rate=(int)44100 in anything we support
basetransform gstbasetransform.c:1414:gst_base_transform_setcaps:<audioconvert0> transform could not transform audio/x-raw, format=(string)S16LE, layout=(string)interleaved, channels=(int)2, channel-mask=(bitmask)0x0000000000000003, rate=(int)44100 in anything we support
basetransform gstbasetransform.c:1414:gst_base_transform_setcaps:<audioconvert0> transform could not transform audio/x-raw, format=(string)S16LE, layout=(string)interleaved, channels=(int)2, channel-mask=(bitmask)0x0000000000000003, rate=(int)44100 in anything we support
basetransform gstbasetransform.c:1414:gst_base_transform_setcaps:<audioconvert0> transform could not transform audio/x-raw, format=(string)S16LE, layout=(string)interleaved, channels=(int)2, channel-mask=(bitmask)0x0000000000000003, rate=(int)44100 in anything we support
     wavparse gstwavparse.c:2249:gst_wavparse_loop:<wavparse0> error: Internal data flow error.
     wavparse gstwavparse.c:2249:gst_wavparse_loop:<wavparse0> error: streaming task paused, reason not-negotiated (-4)
basetransform gstbasetransform.c:1414:gst_base_transform_setcaps:<audioconvert0> transform could not transform audio/x-raw, format=(string)S16LE, layout=(string)interleaved, channels=(int)2, channel-mask=(bitmask)0x0000000000000003, rate=(int)44100 in anything we support
ERROR: from element /GstPipeline:pipeline0/GstWavParse:wavparse0: Internal data flow error.

I do get sound from both of the following

gst123 -a alsa=hw:2 temp.wav
aplay -D hw:2 temp.wav

Am I missing some additional arguments to gst-launch?

Any help would be much appreciated!


Solution

  • While writing up the question I found the answer, but I figured I'd go ahead and post the question in case anyone else ever encounters the same. There was indeed a missing argument... audioresample.

    gst-launch-1.0 filesrc location=temp.wav ! wavparse ! audioconvert ! audioresample ! alsasink device=hw:2