2014-04-03 115 views
3

我想通過使用shmsink/shmsrc在兩個GStreamer管道之間轉發視頻,並使接收端對視頻進行編碼。GStreamer shmsrc和x264enc不能一起工作

以下是用於在發送側的命令行:

gst-launch-0.10 -v videotestsrc \ 
    ! 'video/x-raw-yuv, format=(fourcc)"I420", framerate=30/1, width=1280, height=720' \ 
    ! shmsink socket-path=/tmp/xxx shm-size=10000000 wait-for-connection=0 sync=false 

下面是接收側的命令行:

gst-launch-0.10 -v shmsrc socket-path=/tmp/xxx \ 
    ! 'video/x-raw-yuv, format=(fourcc)"I420", framerate=30/1, width=1280, height=720' \ 
    ! x264enc 
    ! filesink location=/tmp/yyy 

一個問題是,沒有被記錄。看起來管道沒有滾動。下面示出了輸出消息:

Setting pipeline to PAUSED ... 
Pipeline is PREROLLING ... 
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, width=(int)1280, height=(int)720 
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:src: caps = video/x-h264, width=(int)1280, height=(int)720, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, codec_data=(buffer)014d401fffe10018674d401feca02802dd8088000003000bb9aca00078c18cb001000468ebecb2, stream-format=(string)avc, alignment=(string)au, level=(string)3.1, profile=(string)main 
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, width=(int)1280, height=(int)720 

當我如下除去x264enc,管道被軋製和輸出文件,/ TMP/YYY正在增加。

gst-launch-0.10 -v shmsrc socket-path=/tmp/xxx \ 
    ! 'video/x-raw-yuv, format=(fourcc)"I420", framerate=30/1, width=1280, height=720' \ 
    ! filesink location=/tmp/yyy 

有趣的是,下面的輸出消息顯示了之前未顯示的「新時鐘:GstSytemclock」。

Setting pipeline to PAUSED ... 
Pipeline is PREROLLING ... 
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, width=(int)1280, height=(int)720 
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/x-raw-yuv, format=(fourcc)I420, framerate=(fraction)30/1, width=(int)1280, height=(int)720 
Pipeline is PREROLLED ... 
Setting pipeline to PLAYING ... 
New clock: GstSystemClock 

我不知道爲什麼管道不能用x264enc。任何幫助將非常感激。

回答

0

從shmsrc輸出的緩衝區的大小沒有按照任何採取video/x-raw大小寫的要求與視頻幀邊界大小對齊。

隨着GStreamer 1.0,rawvideoparse元素已被添加到允許收集完整的視頻幀推向下游。我不相信GStreamer 0.10有這個元素可用。