我有一个设置,我在 ubuntu 服务器上使用 cvlc 将 rtsp 流多路复用到 mjpeg 流中。这工作得很好,但是一旦我尝试切换 vlc 以使用我的 Let'sEncrypt 证书(以防止浏览器抱怨混合内容),客户端不再接收流(ERR_EMPTY_RESPONSE),但 TLS 握手似乎工作(用wireshark看到)。
这是我的 cvlc 命令行:
cvlc -vvv --http-cert="/var/www/mydomain.com/html/scripts/vlc_certs/cert.pem" --http-key="/var/www/mydomain.com/html/scripts/vlc_certs/privkey.pem" "rtsp://myrtspstream.com" --no-audio --sout '#transcode{vcodec=MJPG,venc=ffmpeg{strict=1}}:standard{access=https{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=:8443}'
如果我将访问参数更改为http一切都会立即正常工作。
VLC版本是:VLC media player 3.0.4 Vetinari (revision 3.0.4-0-gf615db6332)
VLC 输出中唯一可疑的是以下几行:
[00007f77e40038d0] gnutls tls server debug: TLS handshake: An unexpected TLS packet was received.
[00007f77e40038d0] gnutls tls server error: TLS handshake error: An unexpected TLS packet was received.
但无论如何它继续缓冲和转码它似乎:
Sending request: TEARDOWN rtsp://******:554/ RTSP/1.0
CSeq: 6
User-Agent: LibVLC/3.0.4 (LIVE555 Streaming Media v2018.02.18)
Session: mMPpZwWZuox
[00007fbcb44fd050] main decoder debug: killing decoder fourcc `h264'
[00007fbcb44fd050] main decoder debug: removing module "h264"
[00007fbcbc000c40] main input debug: Program doesn't contain anymore ES
Created new TCP socket 10 for connection
Connecting to **********, port 554 on socket 10...
...remote connection opened
Sending request: OPTIONS rtsp://*********:554/12 RTSP/1.0
CSeq: 2
User-Agent: LibVLC/3.0.4 (LIVE555 Streaming Media v2018.02.18)
Received 134 new bytes of response data.
Received a complete OPTIONS response:
RTSP/1.0 200 OK
CSeq: 2
Server: Hipcam RealServer/V1.0
Public: OPTIONS,DESCRIBE,SETUP,TEARDOWN,PLAY,SET_PARAMETER,GET_PARAMETER
Sending request: DESCRIBE rtsp://********:554/12 RTSP/1.0
CSeq: 3
User-Agent: LibVLC/3.0.4 (LIVE555 Streaming Media v2018.02.18)
Accept: application/sdp
Received 493 new bytes of response data.
Received a complete DESCRIBE response:
RTSP/1.0 200 OK
CSeq: 3
Server: Hipcam RealServer/V1.0
Content-Type: application/sdp
Cache-Control: must-revalidate
Content-length: 304
Content-Base: rtsp://*********:554/12/
v=0
o=StreamingServer 3331435948 1116907222000 IN IP4 *********
s=11
c=IN IP4 0.0.0.0
t=0 0
a=control:*
m=video 0 RTP/AVP 96
a=control:trackID=0
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=4D002A;sprop-parameter-sets=Z00AHpWoKAtk,aO48gA==
a=framesize:96 640-352
[00007fbcb402a150] live555 demux debug: RTP subsession 'video/H264'
Sending request: SETUP rtsp://***********:554/12/trackID=0 RTSP/1.0
CSeq: 4
User-Agent: LibVLC/3.0.4 (LIVE555 Streaming Media v2018.02.18)
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Received 130 new bytes of response data.
Received a complete SETUP response:
RTSP/1.0 200 OK
CSeq: 4
Server: Hipcam RealServer/V1.0
Session: NnoUvumuumG
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
[00007fbcb44fd050] main decoder debug: looking for packetizer module matching "any": 24 candidates
[00007fbcb44fd050] h264 decoder debug: found NAL_SPS (sps_id=0)
[00007fbcb44fd050] h264 decoder debug: found NAL_PPS (pps_id=0 sps_id=0)
[00007fbcb44fd050] main decoder debug: using packetizer module "h264"
[00007fbcb402a150] live555 demux debug: setup start: 0.000000 stop:0.000000
Sending request: PLAY rtsp://*********:554/12/ RTSP/1.0
CSeq: 5
User-Agent: LibVLC/3.0.4 (LIVE555 Streaming Media v2018.02.18)
Session: NnoUvumuumG
Range: npt=0.000-
Received a complete PLAY response:
RTSP/1.0 200 OK
CSeq: 5
Server: Hipcam RealServer/V1.0
Session: NnoUvumuumG
RTP-Info:url=**********/trackID=0;seq=1;rtptime=10000,url=**********/trackID=1;seq=1;rtptime=10000
经过一些额外的搜索,我发现这实际上是 VLC 的 tls 服务器代码中的一个错误。 https://trac.videolan.org/vlc/ticket/7528
这已在当前最新版本中修复
3.0.11
目前,您需要将非官方的 vlc ppa 添加到您的系统中以应用修复程序。
https://tipsonubuntu.com/2020/06/23/install-latest-vlc-3-0-11-ppa-ubuntu-20-04/