GStreamer shmsrc和x264enc无法一起使用

时间:2014-04-03 18:26:26

标签: gstreamer

我正在尝试使用shmsink / shmsrc在两个GStreamer管道之间转发视频,并使接收方对视频进行编码。

以下是发送方的命令行:

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。任何帮助都将非常感激。

1 个答案:

答案 0 :(得分:0)

从shmsrc输出的缓冲区大小未与视频帧边界大小对齐,这是video/x-raw上限所需的任何内容。

使用GStreamer 1.0,添加了rawvideoparse元素以允许收集完整的视频帧以推送到下游。我不相信GStreamer 0.10有这个元素可用。