vlc通过udp读取h264码流
在使用gstreamer过程中,遇到需要在服务端推送码流,客户端接受的情况,而有些主机并未安装gstreamer,但是可以采用vlc读取视频,方法如下:
服务端gstreamer代码:
gst-launch-1.0 v4l2src device=/dev/video0 do-timestamp=true !
video/x-raw,width=1280, height=800,framerate='(fraction)'20/1 ! videoconvert ! x264enc ! queue ! h264parse config-interval=1 ! rtph264pay pt=96 !
udpsink host=192.168.2.158 port=5400 sync=false -v
客户端接受(gstreamer):
gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,media=video,clock-rate=90000,encoding-name=H264,payload=96 ! rtph264depay ! queue ! h264parse ! avdec_h264 ! queue ! videoscale ! video/x-raw, width=1280, height=760 ! videoconvert ! fpsdisplaysink
客户端接受(VLC):
vlc jetson_udpsink_to_vlc.sdp
jetson_udpsink_to_vlc.sdp:
m=video 5400 RTP/AVP 96
c=IN IP4 10.192.13.238
a=rtpmap:96 H264/90000
s=ESP H264 STREAM
a=fmtp:96 media=video; clock-rate=90000: encoding-name=H264