我有一个 Auvidea 视频编码器/解码器,它允许我通过 RTSP 传输视频。我想将视频流从它重定向到另一台服务器。作为服务器,我使用 MediaMtx 软件(以前称为 rtsp-simple-server),该软件安装并运行在具有公共 IP 的台式计算机上,为了重定向视频流,我使用 ffmpeg。
不幸的是,在测试期间,我注意到 ffmpeg 无法连接到 MediaMTX 服务器。有人能建议需要更改/检查哪些内容才能解决此错误吗?我尝试自己寻找解决方案,但完全陷入困境。
FFmpeg 日志:
$ ffmpeg -re -i rtsp://xxx.xxx.xxx.xxx:554/stream -c:v copy -f rtsp -rtsp_transport tcp rtsp://xxx.xxx.xxx.xxx:8554/stream2.stream
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, rtsp, from 'rtsp://xxx.xxx.xxx.xxx:554/stream':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp
Stream #0:1: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[tcp @ 0x5594b6c0aa80] Connection to tcp://xxx.xxx.xxx.xxx:8554?timeout=0 failed: Connection timed out
Could not write header for output file #0 (incorrect codec parameters ?): Connection timed out
Error initializing output stream 0:1 --
[aac @ 0x5594b6c33fc0] Qavg: nan
Conversion failed!
MediaMTX 日志:
$ ./mediamtx
2023/06/18 13:38:57 INF MediaMTX v0.23.5
2023/06/18 13:38:57 INF [RTSP] listener opened on :8554 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP)
2023/06/18 13:38:57 INF [RTMP] listener opened on :1935
2023/06/18 13:38:57 INF [HLS] listener opened on :8888
2023/06/18 13:38:57 INF [WebRTC] listener opened on :8889 (HTTP)