我想在gstreamer管道中添加一些opencv进程,然后通过udpsink发送它.
我可以像这样从gstreamer读取帧:
// may add some plugins to the pipeline later
cv::VideoCapture cap("v4l2src ! video/x-raw, framerate=30/1, width=640, height=480, format=RGB ! videoconvert ! appsink");
cv::Mat frame;
while(ture){
cap >> frame;
// do some processing to the frame
}
Run Code Online (Sandbox Code Playgroud)
但无法弄清楚的是如何将已处理的帧传递给以下管道: appsrc ! x264enc ! mpegtsmux ! udpsink host=localhost port=5000
我试过了
cv::VideoWriter writer = cv::VideoWriter("appsrc ! x264enc ! mpegtsmux ! udpsink host=localhost port=5000", 0, (double)30, cv::Size(640, 480), true);
writer << processedFrame;
Run Code Online (Sandbox Code Playgroud)
但是,接收方没有收到任何信息.(我使用管道$gst-launch-1.0 udpsrc port=5000 ! tsparse ! tsdemux ! h264parse ! avdec_h264 …
我是gstreamer的新手,我想用mpeg2-ts通过网络流式传输网络摄像头视频.我能够使用以下管道流式传输视频,但我不知道如何使用mpeg2-ts流式传输视频mpegmux.任何帮助都会很棒!谢谢.
我的工作管道(没有mpegmux):
// Sender
gst-launch-1.0 -ve v4l2src \
! video/x-raw, framerate=30/1 \
! videoconvert \
! x264enc noise-reduction=10000 speed-preset=fast tune=zerolatency byte-stream=true threads=4 key-int-max=15 intra-refresh=true \
! rtph264pay pt=96 \
! udpsink host=localhost port=5000
// Receiver
gst-launch-1.0 -ve udpsrc port=5000 \
! application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, payload=96 \
! rtph264depay \
! h264parse \
! avdec_h264 \
! videoconvert \
! ximagesink sync=false
Run Code Online (Sandbox Code Playgroud)
我尝试了一些像下面这样的方法,但仍然无法让它工作.发件人给出错误"无法将mux与rtph264pay链接",接收器给出"无法将mux与udpsrc链接".
// Sender
gst-launch-1.0 -ve v4l2src \
! video/x-raw, framerate=30/1 \
! videoconvert \ …Run Code Online (Sandbox Code Playgroud)