Gstreamer pipeline的CPU使用率和内存
我使用 gstreamer 从网络摄像头捕获视频,使用 x264 对其进行编码,并使用 gstrtpbin 对其进行流式传输。效果很好。然而,它使用了我所有四个核心的大约 50% 以及大量内存。有什么办法可以降低 CPU 和内存使用率吗?这是管道。
pipeline_description = "gstrtpbin latency=0 max-latency=100 drop-on-latency=true use-pipeline-clock=true ntp-sync=true name=rtpbin " \
"autovideosrc ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! " \
"tee name=t_vid ! queue ! fpsdisplaysink name=fpssink text-overlay=false video-sink=xvimagesink signal-fps-measurements=true t_vid. ! " \
"queue ! videorate ! ffmpegcolorspace ! x264enc pass=qual tune=zerolatency quantizer=40 ! queue ! rtph264pay ! rtpbin.send_rtp_sink_0 " \
"rtpbin.send_rtp_src_0 ! udpsink port=%d host=%s sync=false async=false rtpbin.send_rtcp_src_0 ! " \
"udpsink port=%d host=%s sync=false async=false name=vrtcpsink udpsrc port=%d ! " \
"rtpbin.recv_rtcp_sink_0 autoaudiosrc ! queue ! audioresample ! audioconvert ! alawenc ! rtppcmapay ! rtpbin.send_rtp_sink_1 " \
"rtpbin.send_rtp_src_1 ! udpsink port=%d host=%s sync=false async=false rtpbin.send_rtcp_src_1 ! " \
"udpsink port=%d host=%s sync=false async=false udpsrc port=%d ! rtpbin.recv_rtcp_sink_1" % (VRTP_SEND_PORT, DEST,
VRTCP_SEND_PORT, DEST, VRTCP_RECV_PORT, ARTP_SEND_PORT, DEST, ARTCP_SEND_PORT, DEST, ARTCP_RECV_PORT)
I'm using gstreamer to capture video from a webcam, encode it with x264 and stream it using a gstrtpbin. It works great. However, it uses about 50% of all four of my cores and a lot of memory. Is there anything I can do to lower the CPU and memory usage? Here's the pipeline.
pipeline_description = "gstrtpbin latency=0 max-latency=100 drop-on-latency=true use-pipeline-clock=true ntp-sync=true name=rtpbin " \
"autovideosrc ! video/x-raw-yuv,width=640,height=480,framerate=30/1 ! " \
"tee name=t_vid ! queue ! fpsdisplaysink name=fpssink text-overlay=false video-sink=xvimagesink signal-fps-measurements=true t_vid. ! " \
"queue ! videorate ! ffmpegcolorspace ! x264enc pass=qual tune=zerolatency quantizer=40 ! queue ! rtph264pay ! rtpbin.send_rtp_sink_0 " \
"rtpbin.send_rtp_src_0 ! udpsink port=%d host=%s sync=false async=false rtpbin.send_rtcp_src_0 ! " \
"udpsink port=%d host=%s sync=false async=false name=vrtcpsink udpsrc port=%d ! " \
"rtpbin.recv_rtcp_sink_0 autoaudiosrc ! queue ! audioresample ! audioconvert ! alawenc ! rtppcmapay ! rtpbin.send_rtp_sink_1 " \
"rtpbin.send_rtp_src_1 ! udpsink port=%d host=%s sync=false async=false rtpbin.send_rtcp_src_1 ! " \
"udpsink port=%d host=%s sync=false async=false udpsrc port=%d ! rtpbin.recv_rtcp_sink_1" % (VRTP_SEND_PORT, DEST,
VRTCP_SEND_PORT, DEST, VRTCP_RECV_PORT, ARTP_SEND_PORT, DEST, ARTCP_SEND_PORT, DEST, ARTCP_RECV_PORT)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(3)
~没有更多了~
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我也见过这个问题 - 使用sync=false 似乎会触发 100% CPU。还有另一个线程 Streaming RTP/RTSP:sync/timestamp issues 讨论这。华泰
I've seen this issue as well - using sync=false seems to trigger 100% CPU. There is another thread Streaming RTP/RTSP: sync/timestamp problems that talks about this. HTH