2014-11-02 55 views
0

我真的用尽想法。这是我的问题:我需要通过网络按需传输mp4(H264)。我是gstreamer的新手,经过很多尝试1.0以上的版本之后,我决定使用0.10,因为它似乎迄今为止是最有希望的。下面gstreamer通过网络串流mp4 - 无法确定流的类型

命令的工作是完美的(我看窗口,我的电影)

gst-launch filesrc location=/home/zuko/sintel_trailer-368p.mp4 ! decodebin2 name=dec ! queue ! ffmpegcolorspace ! autovideosink dec. ! queue ! audioconvert ! audioresample ! autoaudiosink 

现在我试图建立使用命令TCP流(迄今为止只有本地主机):

Server side: 
gst-launch filesrc location=/home/zuko/sintel_trailer-368p.mp4 ! decodebin2 name=dec ! tcpserversink host=127.0.0.1 port=5000 

Client side: 
gst-launch tcpclientsrc host=127.0.0.1 port=5000 ! decodebin2 name=dec ! queue ! ffmpegcolorspace ! autovideosink dec. ! queue ! audioconvert ! audioresample ! autoaudiosink 

但从“客户端”命令响应如下:

Setting pipeline to PAUSED ... 
Pipeline is PREROLLING ... 
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin2:dec/GstTypeFindElement:typefind: Could not determine type of stream. 
Additional debug info: 
gsttypefindelement.c(813): gst_type_find_element_chain_do_typefinding(): /GstPipeline:pipeline0/GstDecodeBin2:dec/GstTypeFindElement:typefind 
ERROR: pipeline doesn't want to preroll. 
Setting pipeline to NULL ... 
Freeing pipeline ... 

缺什么,或者什么,我做错了什么?

我测试的:VirtualBox的4.3.12与Ubuntu 14.04,内核3.13.0-24泛型#47,Ubuntu的SMP周五5月2日23:30:00 UTC 2014 x86_64的x86_64的x86_64的GNU/Linux的

这里附:

与(3 GST_DEBUG_NO_COLOR = 1个GST_DEBUG = *):完整的错误 https://app.box.com/s/4ntyk6am2ibg0pohtg9h

回答

1

首先,用0.10绝对是一个坏主意,你应该坚持到1.0,而您将有社会各界的支持。

其次,你的问题本身,你想流的解码通过网络(“decodebin2!tcpserversink”),并把它的另一边再次解码(“tcpclientsrc!decodebin2”)。不仅在带宽使用方面它是非常错误的,它直接起作用也是行不通的。

我建议你看看gstreamer提供的rtp插件。

+0

按照你的建议我切换到1.0(1.4.3是具体的)。我做了功课,并将工作管道中的元素转换为新元素(如ffdec_h264到avdec_h264等)。现在我可以流式传输相机图片并在远程机器上查看(使用autovideosink),播放本地和远程内容(使用playbin),但我仍然不知道如何通过网络传输mp4文件。你能提供一个简单的例子吗? – zuko 2014-11-05 12:09:13

0

使用gstreamer的1.0服务器侧可以共享H264流与:

gst-launch-1.0 filesrc location="C:\\Videos\\videotestsrc.avi" ! decodebin ! x264enc ! mpegtsmux ! queue ! tcpserversink host=127.0.0.1 port=8080 

虽然客户端与接收:

gst-launch-1.0 tcpclientsrc host=127.0.0.1 port=8080 ! decodebin ! videoconvert ! autovideosink sync=false 

备选地,客户端可以被模拟通过VLC通过:

Media >> Open Network Stream >> tcp://127.0.0.1:8080 >> Play

+0

A E I O U:那就是你如何学习“a”和“an”之间的区别。 – 2015-07-02 12:28:05