我正在使用 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)