2013-06-26 165 views
12

我是gstreamer的新手,我正在嘗試使用它。我的第一個目標是在兩個設備之間創建一個簡單的h264視頻流。我使用這兩個管道:使用gstreamer在rtp上流H.264視頻

發件人:gst-launch-1.0 -v filesrc location=c:\\tmp\\sample_h264.mov ! x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=5000

接收機: gst-launch-1.0 -v udpsrc port=5000 ! rtpmp2tdepay ! decodebin ! autovideosink

但隨着第一個(發件人)我得到了以下錯誤:

Setting pipeline to PAUSED ... 
Pipeline is PE*R*O L(LgIsNtG- l.a.u.n 
h-1.0:5788): CRITICAL **: gst_adapter_map: assertion `size > 0' failed 
ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc0: Internal data flow error. 
Additional debug info: 
gstbasesrc.c(2812): gst_base_src_loop(): /GstPipeline:pipeline0/GstFileSrc:filesrc0: 
streaming task paused, reason not-negotiated (-4) 
ERROR: pipeline doesn't want to preroll. 
Setting pipeline to NULL ... 
Freeing pipeline ... 

我試着很多其他配置,但我找不到合適的管道。

其他一些信息: 的Gstreamer版本:1.0.7 操作系統:Windows 7

任何想法/建議? Thx,

回答

8

filesrc將讀取給定文件中的數據作爲原始字節;你不能只用x264enc編碼這些原始字節,你需要視頻數據才能工作。在重新編碼流之前嘗試添加一個解複用器/解碼器)是這樣的:

發件人:

gst-launch-1.0 -v \ 
    filesrc location=/tmp/sample_h264.mov 
    ! qtdemux \ 
    ! h264parse \ 
    ! ffdec_h264 \ 
    ! ffmpegcolorspace \ 
    ! x264enc \ 
    ! rtph264pay \ 
    ! udpsink host=127.0.0.1 port=5000 

你應該做一個快速檢查這是否工作通過使用測試視頻索裏:

gst-launch-1.0 -v \ 
    videotestsrc 
    ! x264enc \ 
    ! rtph264pay \ 
    ! udpsink host=127.0.0.1 port=5000 
+0

謝謝你的提示原始/視頻數據,但我認爲這隻能解決一個問題。我用videotestsrc試過了經典的管道,但沒有任何東西會進入到另一側。即使有以下管道,我也不能在另一端收到任何東西: 'gst-launch-1.0 -v videotestsrc! udpsink主機= 192.128.52.128端口= 9001' 我有這樣的感覺,udpsink不發送任何東西! PS:不是防火牆的問題,我將其全部禁用 – abir

+0

嘗試: 'ffmpeg -i C:\ tmp \ sample_h264.mov -f mpegts udp://192.168.52.128:9001' ...和流在另一邊收到。但我想用gstreamer – abir

+0

'videotestsrc! udpsink'不是* RTP流。你必須添加一個payloader –