Zha*_*Fei 4 rtp gstreamer gst-launch
我使用这些命令来发送和接收 rtp 数据:
发送 rtp 数据到 UDP 端口 5000
gst-launch-1.0 -v filesrc location = haizeiwang.mp4 ! decodebin ! x264enc ! rtph264pay ! udpsink host=192.168.1.101 port=5000
Run Code Online (Sandbox Code Playgroud)
从udp端口5000接收rtp数据并播放。
gst-launch-1.0 -v udpsrc port=5000 caps="application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, payload=96, ssrc=3394826012, timestamp-offset=2215812541, seqnum-offset=46353" ! rtph264depay ! decodebin ! videoconvert ! autovideosink sync=false
Run Code Online (Sandbox Code Playgroud)
但我只能得到视频(不是很清楚),而且没有声音。我可以同时获得视频和音频吗?我应该使用哪些元素?命令应该是什么?
谢谢你。
发件人(音频+视频):
gst-launch-1.0 -v uridecodebin name=uridec uri=file:///C:\\video.mp4 ! videoconvert ! x264enc noise-reduction=10000 tune=zerolatency byte-stream=true threads=4 key-int-max=15 intra-refresh=true ! mpegtsmux alignment=7 name=mux ! rtpmp2tpay ! queue ! udpsink host=127.0.0.1 port=5000 sync=true uridec. ! audioconvert ! voaacenc ! audio/mpeg ! queue ! mux.
Run Code Online (Sandbox Code Playgroud)
接收器(音频+视频,短版):
gst-launch-1.0 -v playbin uri=udp://127.0.0.1:5000
Run Code Online (Sandbox Code Playgroud)
接收器(音频+视频,长版):
gst-launch-1.0 -v udpsrc port=5000 ! tsparse ! decodebin name=dec ! videoconvert ! autovideosink sync=true dec. ! queue ! audioconvert ! audioresample ! autoaudiosink sync=true
Run Code Online (Sandbox Code Playgroud)
如果您可以通过 cmd-line访问VLC,则可以使用以下命令播放流:
vlc rtp://@:5000
Run Code Online (Sandbox Code Playgroud)
或者直接进入 VLC 图形界面打开网络流(CTRL+N) 并使用我上面分享的地址。