mediamtx
mediamtx copied to clipboard
RTSP PROXY ISSUE
Which version are you using?
v0.20.0
Which operating system are you using?
- [X] Linux amd64 standard
- [ ] Linux amd64 Docker
- [ ] Linux arm64 standard
- [ ] Linux arm64 Docker
- [ ] Linux arm7 standard
- [ ] Linux arm7 Docker
- [ ] Linux arm6 standard
- [ ] Linux arm6 Docker
- [X] Windows amd64 standard
- [ ] Windows amd64 Docker (WSL backend)
- [ ] macOS amd64 standard
- [ ] macOS amd64 Docker
- [ ] Other (please describe)
Describe the issue
I have camera which is sending some type of additional data and its cause the issue, idea is if im using FFMPEG to play it , it will give the below error
[rtsp @ 000001c44d179e80] Nonmatching transport in server reply rtsp://admin:[email protected]:22101/1_88_1: Invalid data found when processing input
then i try to use Proxy with the help of RTSP server and it give me the error attached in server debug log
Config.yml
FFMPEG option
van:
runOnDemand: ffmpeg -thread_queue_size 512 -i rtsp://admin:[email protected]:22101/1_88_1 -vcodec libx264 -preset veryfast -r 24 -g 2 -s 1280x720 -b:v 3000k -max_muxing_queue_size 4096 -f rtsp rtsp://127.0.0.1:$RTSP_PORT/$RTSP_PATH
runOnDemandRestart: yes
sourceAnyPortEnable: yes
Proxy option
Vanp:
source: rtsp://admin:[email protected]:22101/1_88_1
sourceOnDemand: yes
Describe how to replicate the issue
- start server
- update config.yml
- request rtsp feed
- error appear
Did you attach the server logs?
yes / no
YES server.log
Did you attach a network dump?
yes / no NO
Hello, please provide a network dump, that can be generated in this way:
- Download wireshark (https://www.wireshark.org/)
- Start capturing on the interface used for exchanging RTSP (if the server and the target software are both installed on your pc, the interface is probably "loopback", otherwise it's the one of your network card)
- Start the server and replicate the issue
- Stop capturing, save the result in .pcap format
- Attach
PS: when generating the network dump, use this configuration:
Vanp:
source: rtsp://admin:[email protected]:22101/1_88_1
sourceOnDemand: no
Start the server, wait 30seconds, stop the server, stop recording the dump and attach the dump.
Attached as requested per instructions Vanp dump.zip server ip is localhost , interface ip from windows machine is 10.10.101.109
loopback dump Vanp dump 2 loopback.zip
ps: after like 3 or 4 attempt the feed worked but after trying again it kept failing as before
Hello @Tabarane, thanks for providing the dumps, i finally found the issue. The server wants to pull the video stream from the camera with the UDP transport protocol:
[path Vanp] [rtsp source] c->s SETUP rtsp://172.17.172.145:22101/1_88_1/trackID=0 RTSP/1.0
Authorization: Digest username="admin", realm="Server", nonce="852167", uri="rtsp://172.17.172.145:22101/1_88_1/trackID=0", response="4ad478cdf926557eae6b82f0d4dbe90e"
CSeq: 4
Transport: RTP/AVP;unicast;client_port=65360-65361;mode=play
User-Agent: gortsplib
The camera accepts the request, but it replies with a response fit for the TCP transport protocol:
RTSP/1.0 200 OK
CSeq: 4
Session: WsDeuODg
Transport: RTP/AVP/TCP;unicast;source=172.17.172.145;server_port=22101;interleaved=0-1;ssrc=2A3B4C5D
X-Dynamic-Rate: 1
And subsequently starts sending the stream with the TCP transport protocol, causing this error:
[rtsp source] ERR: expected 'RTSP/1.0', got [36 0 0 27 128 96 0 0 0 0 17 148 42 59 76 93 103 66 0 41 141 141 64 90 30 208 15 8 132 83 128 36 0 0 16 128 96 0 1 0 0 17 148 42 59 76 93 104 202 67 200 36 0 5 120 128 96 0 2 0 0 17 148 42 59 76 93 124 133 136 128 0]
and this error in ffmpeg:
[rtsp @ 000001c44d179e80] Nonmatching transport in server reply rtsp://admin:[email protected]:22101/1_88_1: Invalid data found when processing input
rtsp-simple-server and gortsplib need to be improved in order to detect TCP responses to UDP requests and switch protocol from UDP to TCP.
@aler9 Thanks man, i hope im helping the project to improve , im using it since 2020 and its has been AMAZING, some challenges related to proxy type but not that BUG level yet )))
@Tabarane if you still have the camera, please test this nightly release and let me know if it works. Remember to remove the parameter sourceProtocol
from the configuration file, if present.
rtsp-simple-server_v0.21.1-5-gfb06f6d_windows_amd64.zip rtsp-simple-server_v0.21.1-5-gfb06f6d_linux_armv7.tar.gz rtsp-simple-server_v0.21.1-5-gfb06f6d_linux_armv6.tar.gz rtsp-simple-server_v0.21.1-5-gfb06f6d_linux_arm64v8.tar.gz rtsp-simple-server_v0.21.1-5-gfb06f6d_linux_amd64.tar.gz rtsp-simple-server_v0.21.1-5-gfb06f6d_darwin_amd64.tar.gz
@aler9 Working like a charm in proxy mode , amazing man, still FFMPEG has raised error with non matching transport, but Proxy mode is like wow :))) i have such type of issue when proxy with GARMIN VIRB 360 , if you interested i can gather logs for you , i always use very strange type of cameras and drones for my work and SRTSP is an Vital for me
If you have other problematic devices, feel free to open additional issues. Meanwhile, this is fixed.
added in v0.21.2
This issue is being locked automatically because it has been closed for more than 6 months. Please open a new issue in case you encounter a similar problem.