我用来mediamtx
启动 RTSP 服务器。我用于 ffmpeg 的命令如下:
ffmpeg -re -stream_loop -1 -i ./clouds.mp4 -f rtsp -rtsp_transport tcp rtsp://localhost:8554
我尝试了各种不同的选择,但都没有成功。我没有让 ffmpeg 来传输视频。
文件详细信息如下:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './clouds.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2023-01-12T20:44:34.000000Z
Duration: 00:00:56.34, start: 0.000000, bitrate: 2952 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 2758 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
Metadata:
creation_time : 2023-01-12T20:44:34.000000Z
handler_name : Vimeo Artax Video Handler
vendor_id : [0][0][0][0]
encoder : AVC Coding
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
creation_time : 2023-01-12T20:44:34.000000Z
handler_name : Vimeo Artax Audio Handler
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
mediamtx
终端窗口上的错误是:
2023/05/08 17:30:43 INF [RTSP] [session 298895e1] created by 127.0.0.1:38024
2023/05/08 17:30:43 INF [RTSP] [conn 127.0.0.1:38024] closed (invalid path)
答案1
将 rtsp 链接更改为rtsp://localhost:8554/mystream
或替换mystream
为适当的路径即可。