![如何在连接到 RTSP 输入流时在 FFmpeg 中强制建立新会话?我不断收到“方法 PLAY 失败:454 未找到会话”错误](https://linux22.com/image/1562973/%E5%A6%82%E4%BD%95%E5%9C%A8%E8%BF%9E%E6%8E%A5%E5%88%B0%20RTSP%20%E8%BE%93%E5%85%A5%E6%B5%81%E6%97%B6%E5%9C%A8%20FFmpeg%20%E4%B8%AD%E5%BC%BA%E5%88%B6%E5%BB%BA%E7%AB%8B%E6%96%B0%E4%BC%9A%E8%AF%9D%EF%BC%9F%E6%88%91%E4%B8%8D%E6%96%AD%E6%94%B6%E5%88%B0%E2%80%9C%E6%96%B9%E6%B3%95%20PLAY%20%E5%A4%B1%E8%B4%A5%EF%BC%9A454%20%E6%9C%AA%E6%89%BE%E5%88%B0%E4%BC%9A%E8%AF%9D%E2%80%9D%E9%94%99%E8%AF%AF.png)
连接到 RTSP 输入流时,如何在 FFmpeg 中强制建立新会话?我没有看到传递标头信息的方法。以下是问题的命令和输出。
命令:
$ ffmpeg -y -hide_banner -loglevel debug -stimeout 10000000 -rtsp_transport tcp \
-i rtsp://username:[email protected]:554/live/477799A3-88A9-45AA-95EC-4CBE3CA1FBA7 \
-vframes 1 -f null /dev/null
输出:
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-hide_banner' ... matched as option 'hide_banner' (do not show program banner) with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-stimeout' ... matched as AVOption 'stimeout' with argument '10000000'.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-i' ... matched as input url with argument 'rtsp://username:[email protected]:554/live/477799A3-88A9-45AA-95EC-4CBE3CA1FBA7'.
Reading option '-vframes' ... matched as option 'vframes' (set the number of video frames to output) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'null'.
Reading option '/dev/null' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option hide_banner (do not show program banner) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://username:[email protected]:554/live/477799A3-88A9-45AA-95EC-4CBE3CA1FBA7.
Successfully parsed a group of options.
Opening an input file: rtsp://username:[email protected]:554/live/477799A3-88A9-45AA-95EC-4CBE3CA1FBA7.
[tcp @ 0x55cd6cca1100] No default whitelist set
[rtsp @ 0x55cd6cc9efa0] SDP:
v=0
o=- 1528388529036236 1 IN IP4 192.168.50.1
s=libttrtspserver
c=IN IP4 0.0.0.0
t=0 0
a=tool:libttrtspserver 1.0.0
a=range:npt=now-
m=video 0 RTP/AVP 96
a=framerate:1.000000
a=rtpmap:96 H264/90000
a=control:streamid=0
a=fmtp:96 packetization-mode=1;
[rtsp @ 0x55cd6cc9efa0] video codec set to: h264
[rtsp @ 0x55cd6cc9efa0] RTP Packetization Mode: 1
[rtsp @ 0x55cd6cc9efa0] setting jitter buffer size to 0
[rtsp @ 0x55cd6cc9efa0] hello state=0
[rtsp @ 0x55cd6cc9efa0] method PLAY failed: 454 Session Not Found
[rtsp @ 0x55cd6cc9efa0] CSeq: 5
Date: Thu, Jun 07 2018 16:22:25 GMT
FFmpeg 版本信息:
$ ffmpeg -v
ffmpeg version 3.4.2-1~16.04.york0.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609