c - 如何在基本原始格式中播放端口音频

标签 c gstreamer

我如何进行原始发送和原始接收?这不起作用,我无法播放我发送的内容:

Send: $ gst-launch -v autoaudiosrc ! udpsink host=127.0.0.1 auto-multicast=true port=4444

Recv/play:
[root@example ~]# gst-launch udpsrc multicast-group=127.0.0.1 port=4444 ! autoaudiosink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0/GstPulseSink:autoaudiosink0-actual-sink-pulse: The stream is in the wrong format.
Additional debug info:
gstbaseaudiosink.c(866): gst_base_audio_sink_preroll (): /GstPipeline:pipeline0/GstAutoAudioSink:autoaudiosink0/GstPulseSink:autoaudiosink0-actual-sink-pulse:
sink not negotiated.
Execution ended after 16110169 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
[root@example ~]# 

最佳答案

您需要为源指定功能。这实际上是 ERROR: from element/GstPipeline:pipeline0/GstAudioConvert:audioconvert0: not negotiated 的意思。 (在 gst-launch 上使用 -v 标志以查看有关错误的更多详细信息)。

所以,解决方案是:

$ gst-launch -v udpsrc multicast-group=127.0.0.1 port=4444 \
    ! audio/x-raw-int, endianness=1234, signed=true, width=16, depth=16, rate=44100, channels=2 \
    ! autoaudiosink

实际上,我只是从发送 gst-launch 的详细输出中复制了功能。

关于c - 如何在基本原始格式中播放端口音频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4410516/

相关文章:

c - 一个 scanf 中的多个输入显示出各种行为

CUDA:是否保证合并对全局内存的连续字节的半扭曲访问?

c - VALGRIND MALLOC 和寻找邪恶段错误的探索

c - g_object_set/strchr 的段错误

ffmpeg - 使用 gstreamer 或 ffmpeg 仅使用终端命令创建 hsync 和 vsync 视频效果

c - memset 不起作用 (C)

c - 将值设置为用户定义大小的二维数组的元素

Gstreamer 用三个流合成图像

gstreamer - yocto:重建项目的一部分

c - 如何使用gstreamer保存当前文件?