VLC - 如何播放MJPEG流

问题描述 投票:1回答:1

我有一台服务器使用GStream通过以下gst-launch命令广播USB网络摄像头生成的视频:

 gst-launch-1.0 v4l2src ! video/x-raw,width=352,height=288 ! jpegenc! rtpjpegpay ! udpsink host=239.255.12.52 port=5004

现在我需要一个客户端用VLC播放该广播。我试过播放以下内容:

rtsp://239.255.12.52:5004

但我只得到以下错误:

SDP required:
A description in SDP format is required to receive the RTP stream. Note that rtp:// URIs cannot work with dynamic RTP payload format (96).

然后我搜索试图找到一个可以帮助我播放流的sdp文件。我试过这个:

v=0 
c=IN IP4 239.255.12.52 
t=0 
m=video 5004 RTP/AVP 96 
a=rtpmap:96 JPEG/90000 

但它没有用。 vlc日志只是说:

es error: cannot peek
es error: cannot peek
...

我知道流正在工作,因为我可以使用gstreamer使用以下命令播放它:

gst-launch-1.0 udpsrc uri="udp://239.255.12.52:5004" ! application/x-rtp,encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec ! autovideosink

但我需要它与vlc玩而不是gstreamer。有任何想法吗?谢谢!!

streaming gstreamer vlc rtp mjpeg
1个回答
0
投票

这种方法怎么样:

服务器(gstreamer):

gst-launch-1.0 v4l2src ! image/jpeg,width=1280,height=720 ! tcpserversink host=###.###.###.###

客户(vlc):

tcp://###.###.###.###:4953

此外,在vlc gui中,将缓存设置为0 ms。 (:网络缓存= 0)

在这种方法中,服务器端没有额外的编码(不需要jpegenc),因为摄像机本身可以生成.jpg图像(这在网络摄像机中很常见)。也不需要多路复用。

在客户端,延迟是最小的。

这不是多播,但也许这对你没问题?

© www.soinside.com 2019 - 2024. All rights reserved.