问题描述
我正在尝试让gst-launch用户通过TCP流式传输mp3音频,这就是我正在尝试的方法:
I am trying to user gst-launch to stream mp3 audio over tcp, this is what I am trying :
$ gst-launch-0.10 filesrc location="/path/to/file.mp3" ! tcpserversink host=0.0.0.0 port=3000
但它不起作用,输出如下:
but it doesn't work the output is as follow :
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstTCPServerSink:tcpserversink0: Internal GStreamer error: negotiation problem. Please file a bug at http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer.
Additional debug info:
gstmultifdsink.c(2700): gst_multi_fd_sink_render (): /GstPipeline:pipeline0/GstTCPServerSink:tcpserversink0:
Received first buffer without caps set
Execution ended after 94657 ns.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ..
我要去哪里出了什么问题?
Whats the problem where I am going wrong?
我在Internet上进行了大量搜索,但是没有找到正确使用gst-launch的正确文档.如果有人可以请我指向正确的文档或告诉我如何使用它,那将是很好的.
I did lots of search on internet but didn't found the right document how to use gst-launch properly. if anyone can please point me to right doc or tell me how to use it it will great.
推荐答案
tcpserversink
抱怨其水槽垫缺少盖:
tcpserversink
complains about missing caps on its sink pad:
Received first buffer without caps set
这是因为tcpserversink想要知道其发送的内容.
告诉它的一种方法是手动解码和重新编码流:
This is because tcpserversink wants to know what it sends.
One way to tell it would be to manually decode and re-encode the stream:
gst-launch-0.10 filesrc location="/path/to/file.mp3" ! mad ! audioconvert ! lame ! tcpserversink host=0.0.0.0 port=3000
但这只是浪费CPU能力.
有一个名为mpegaudioparse
的元素(除了一些其他东西)找出mpeg流的详细信息,并相应地设置其输出上限.通过简单地将其放置在filesrc
和tcpserversink
之间,您将获得一个有效的管道:
But that's just waste of CPU power.
There's an element called mpegaudioparse
that (apart from some other stuff) figures out the details of the mpeg stream and sets its output caps accordingly. By simply putting it between your filesrc
and the tcpserversink
you'll end up with a working pipeline:
$ gst-launch-0.10 filesrc location="/path/to/file.mp3" ! mpegaudioparse ! tcpserversink host=0.0.0.0 port=3000
这篇关于使用tcpserversink的GST启动无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!