Gstreamer:同时显示和记录H264流

时间:2018-02-12 10:25:30

标签: gstreamer h.264

使用gst-launch-1.0我能够将H.264流记录到文件中:

gst-launch-1.0 -e v4l2src device=/dev/video3 do-timestamp=true \
! video/x-h264, width=$WIDTH, height=$HEIGHT, framerate=$FRAMERATE/1 \ 
! h264parse ! mp4mux ! queue ! filesink location=video.mp4

我能够用:

显示流
gst-launch-1.0 -e v4l2src device=/dev/video3 \
! video/x-h264, width=$WIDTH,height=$HEIGHT,framerate=$FRAMERATE/1 ! tee name=t \
t. ! queue ! h264parse ! decodebin ! xvimagesink sync=false 

但是,同时做这两件事都失败了。然后什么都没发生命令:

gst-launch-1.0 -e v4l2src device=/dev/video3 \
! video/x-h264,width=$WIDTH,height=$HEIGHT,framerate=$FRAMERATE/1 ! tee name=t \
t. ! queue ! h264parse ! decodebin ! xvimagesink sync=false \
t. ! queue ! h264parse ! mp4mux ! filesink location=video.mp4

输出:(无错误 - 但没有显示,文件大小= 0kB)

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstTee:t.GstTeePad:src_0: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstTee:t.GstTeePad:src_1: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstH264Parse:h264parse1.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstQueue:queue1.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstTee:t.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstH264Parse:h264parse2.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstOMXH264Dec-omxh264dec:omxh264dec-omxh264dec0.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstCapsFilter:capsfilter1.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstH264Parse:h264parse2.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink.GstProxyPad:proxypad0: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstH264Parse:h264parse2.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0.GstGhostPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstH264Parse:h264parse2.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstCapsFilter:capsfilter1.GstPad:src: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstOMXH264Dec-omxh264dec:omxh264dec-omxh264dec0.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstCapsFilter:capsfilter1.GstPad:sink: caps = video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)15/1, stream-format=(string)byte-stream, alignment=(string)au, pixel-aspect-ratio=(fraction)1/1, colorimetry=(string)2:4:7:1, parsed=(boolean)true, profile=(string)main, level=(string)4.1

0 个答案:

没有答案