Gstreamer Cannot Play Raw PCM Buffer

141 Views Asked by At

I was following the guide here How to play a PCM data array with GStreamer step by step (Florian Zwoch's solution). However, there is no sound output from gstreamer.

I am using windows and installed gstreamer through msys2 along with various gstreamer plugins. I can compile and run gstreamer's basic tutorial (https://gstreamer.freedesktop.org/documentation/tutorials/basic/hello-world.html?gi-language=c) so I believe this is not a Gstreamer installation problem.

What should I do to solve the problem?

Update1: using Sudhir Kesti's suggestion gst-launch-1.0.exe filesrc location=D:\Work\command-post\mix_1.pcm ! rawaudioparse num-channels=1 sample-rate=8000 pcm-format=GST_AUDIO_FORMAT_S16LE ! audioconvert ! audioresample ! autoaudiosink --gst-debug=2,I am able to play. However, I am still unable to query the duration of the pipeline or use gst_element_seek_simple. How to query the duration or seek the position of the pipeline?

1

There are 1 best solutions below

2
On

You need rawaudioparse to bundle audiosamples into frames. Add audioconvert and audioresample to convert pcm to the desired format. Set channel, format, and rate as per the pcm data.

gst-launch-1.0.exe filesrc location=D:\Work\command-post\mix_1.pcm ! rawaudioparse num-channels=1 sample-rate=8000 pcm-format=GST_AUDIO_FORMAT_S16LE ! audioconvert ! audioresample ! autoaudiosink --gst-debug=2

Use gst_parse_launch() for sample application.