使用UDp socket@命令行实现GStreamer管道



我想使用Gstreamer管道将.mp4文件从一个终端传输到另一个终端。首先,我使用videotestsrc进行测试

@server side gst-launch-1.0 -v videotestsrc  pattern=ball ! video/x-raw,width=1280,height=720 ! jpegenc ! rtpjpegpay ! udpsink name=sink host=localhost port=34400 sync=false async=false 
@client gst-launch-1.0 udpsrc port=34400 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)26" ! rtpjpegdepay ! jpegdec ! filesink location=a.mp4

但我想从本地目录中读取.mp4文件,所以我使用了以下命令

Server: $gst-launch-1.0 -v filesrc location =<file_path/>video_test.mp4 ! qtdemux ! video/x-h264 ! rtph264pay ! udpsink host=127.0.0.1 port=9001
@client: $gst-launch-1.0 -v udpsrc port=9001 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert ! filesink location=a.mp4 

但是我无法捕获@client-side,因为.mp4文件包含0个字节。

@server:gst-launch-1.0-v filesrc location=//video_test.mp4!qtdemux name=demux-demux!h264解析配置间隔=10!队列mux。mpegtsmux名称=mux!rtpmp2tpay!udpsink主机=127.0.0.1端口=5002多路复用器!哎呀!队列mux。

@客户端:gst-launch-1.0-vudpsrc端口=5002个caps=";application/x-rtp"!rtpmp2tdepay!tsparse!文件链接位置=x.mp4

它对我来说很好。

最新更新