Gstreamer 1.0奇怪的管道行为

时间:2013-09-03 15:26:10

标签: pipeline gstreamer

我有管道。它需要来自摄像机的RTSP流,每分钟保存HLS段和帧:

gst-launch-1.0 rtspsrc latency=2000 location=rtsp://192.168.1.16/live2.sdp name=src ! queue ! rtpmp4vdepay ! decodebin ! videorate ! video/x-raw,framerate=15/1,format=I420 ! videoconvert ! tee name=tv 

tv. ! queue ! videoparse width=640 height=480 framerate=15/1 ! videoscale ! video/x-raw,width=320,height=240 ! videorate ! video/x-raw,framerate=1/60,format=I420 ! jpegenc quality=20 ! multifilesink location=/tmp/%06d-low.jpg 

tv. ! queue ! videoparse width=640 height=480 framerate=15/1 ! videorate ! video/x-raw,framerate=1/60,format=I420 ! jpegenc quality=60 ! multifilesink location=/tmp/%06d-mid.jpg

tv. ! queue ! videoparse width=640 height=480 framerate=15/1 ! videoscale ! video/x-raw,width=320,height=240 ! x264enc bframes=0 bitrate=240 speed-preset=superfast ! mpegtsmux ! multifilesink location=/tmp/%06d-low.ts next-file=2 

tv. ! queue ! videoparse width=640 height=480 framerate=15/1 ! x264enc bframes=0 key-int-max=15 bitrate=460 speed-preset=superfast ! mpegtsmux ! multifilesink location=/tmp/%06d-mid.ts next-file=2 

这是有效的。但是,如果我尝试将x264enc速度预设更改为超高速,则管道不起作用(没有错误,但没有文件出现)。

如果我删除JPG部分并且只留下TS,它就会开始工作。

也许我做错了什么?如何提高视频质量?

1 个答案:

答案 0 :(得分:1)

我解决了。我添加了tee tv1用于图像和tv2用于视频。

         ---- queue leaky=1 ! tee name=tv1
        /
tee ----
        \
         ---- queue leaky=1 ! tee name=tv2


gst-launch-1.0 rtspsrc latency=2000 location=rtsp://192.168.1.16/live2.sdp name=src ! queue ! rtpmp4vdepay ! decodebin ! videorate ! video/x-raw,framerate=15/1,format=I420 ! videoconvert ! tee name=tv tv. ! queue leaky=1 ! videoparse width=640 height=480 framerate=15/1 ! tee name=tv1 tv. ! queue leaky=1 ! videoparse width=640 height=480 framerate=15/1 ! tee name=tv2

tv1. ! queue ! videoparse width=640 height=480 framerate=15/1 ! videoscale ! video/x-raw,width=320,height=240 ! videorate ! video/x-raw,framerate=1/60,format=I420 ! jpegenc quality=20 ! multifilesink location=/tmp/%06d-low.jpg 

tv1. ! queue ! videoparse width=640 height=480 framerate=15/1 ! videorate ! video/x-raw,framerate=1/60,format=I420 ! jpegenc quality=60 ! multifilesink location=/tmp/%06d-mid.jpg

tv2. ! queue ! videoparse width=640 height=480 framerate=15/1 ! videoscale ! video/x-raw,width=320,height=240 ! x264enc bframes=0 bitrate=240 speed-preset=superfast ! mpegtsmux ! multifilesink location=/tmp/%06d-low.ts next-file=2 

tv2. ! queue ! videoparse width=640 height=480 framerate=15/1 ! x264enc bframes=0 key-int-max=15 bitrate=460 speed-preset=superfast ! mpegtsmux ! multifilesink location=/tmp/%06d-mid.ts next-file=2