使用 Gstreamer 播放 PCM 文件

Play PCM-File with Gstreamer

我用这个 android 应用程序创建了一个 pcm 文件:https://github.com/roman10/roman10-android-tutorial/tree/master/AndroidPCMRecorder

现在我想用gstreamer播放创建的文件。我在这里找到了代码:https://delog.wordpress.com/2011/10/04/read-and-write-raw-pcm-using-gstreamer/

这是我在 Gstreamer 1.0 中使用的控制台命令:

gst-launch-1.0 filesrc location=testpcm.pcm ! 
audio/x-raw, rate=44100, channels=1, endianness=4321, width=16, depth=16, signed=true !
pulsesink

当我执行此命令时出现此错误

ERROR OF ELEMENT: /GstPipeline:pipeline0/GstCapsFilter:capsfilter0: Filter caps do not completely specify the output format

ADDITIONALDEBUGINFO:
gstcapsfilter.c(356): gst_capsfilter_prepare_buf ():   
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0:
Output caps are unfixed: audio/x-raw, rate=(int)44100, channels=(int)1, endianness=(int)4321, width=(int)16, depth=(int)16, signed=(boolean)true, format=(string){ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, S24LE, S24BE, S24_32LE, S24_32BE, U8 }, layout=(string)interleaved

您正在使用 GStreamer-0.1,但只需将其更新为 GStreamer-1.0。该命令如下所示:

gst-launch-1.0 filesrc location=testpcm.pcm ! 
audio/x-raw, format=S16LE, channels=1, layout=interleaved, rate=44100 ! pulsesink