revmischa / rtsp-server

Lightweight RTSP/RTP streaming media server
https://metacpan.org/release/RTSP-Server
427 stars 112 forks source link

Failed to find client RTP start port in SETUP request #20

Open Tinywan opened 7 years ago

Tinywan commented 7 years ago

root@iZ239kcyg8rZ:/home/www/rtsp-server/rtsp-server# perl ./rtsp-server.pl Starting RTSP server, log level = 2 Failed to find client RTP start port in SETUP request Failed to find client RTP start port in SETUP request Failed to find client RTP start port in SETUP request

revmischa commented 7 years ago

what client?

Tinywan commented 7 years ago

@revmischa Hi!,This is a VLC player

revmischa commented 7 years ago

i can't really help you without more logging. the SDP SETUP info would be helpful. how are you invoking the streaming source client?

ghost commented 7 years ago

I also experience this. But it's not consistent. After retrying a couple times it works. Maybe it's a connection problem? I also used VLC

revmischa commented 7 years ago

I'd need more logs and SDP info if you want me to help debug

ghost commented 7 years ago

Sorry for the very late reply... I changed the log_level to 5.


These are the logs when i started the rtsp server:

Source server started
Client server started

These are the logs when i started streaming to the server with ffmpeg -re -i /myvideo.mp4 -f rtsp -muxdelay 0.1 rtsp://localhost:5545/abc:

Source connection from 127.0.0.1:36362
Source listener: >> OPTIONS rtsp://localhost:5545/abc RTSP/1.0
Got method OPTIONS
Source listener: >> CSeq: 1
Source listener: >> User-Agent: Lavf57.63.100
Source listener: >> 
End of headers
<< RTSP/1.0 200 OK
<< Public: OPTIONS, DESCRIBE, TEARDOWN, SETUP, ANNOUNCE, RECORD
<< CSeq: 1
<< Session: 1
Source listener: >> ANNOUNCE rtsp://localhost:5545/abc RTSP/1.0
Got method ANNOUNCE
Source listener: >> Content-Type: application/sdp
Source listener: >> CSeq: 2
Source listener: >> User-Agent: Lavf57.63.100
Source listener: >> Session: 1
Source listener: >> Content-Length: 511
Source listener: >> 
End of headers
Finished reading body, length=511
Got source announcement for rtsp://localhost:5545/abc
Mounted /abc
<< RTSP/1.0 200 OK
<< CSeq: 2
<< Session: 1
Source listener: >> SETUP rtsp://localhost:5545/abc/streamid=0 RTSP/1.0
Got method SETUP
Source listener: >> Transport: RTP/AVP/UDP;unicast;client_port=13142-13143;mode=record
Source listener: >> CSeq: 3
Source listener: >> User-Agent: Lavf57.63.100
Source listener: >> Session: 1
Source listener: >> 
End of headers
Got SETUP request for stream 0
Creating new stream 0
<< RTSP/1.0 200 OK
<< Transport: RTP/AVP/UDP;unicast;client_port=13142-13143;mode=record;server_port=20000-20001
<< CSeq: 3
<< Session: 1
Source listener: >> SETUP rtsp://localhost:5545/abc/streamid=1 RTSP/1.0
Got method SETUP
Source listener: >> Transport: RTP/AVP/UDP;unicast;client_port=13144-13145;mode=record
Source listener: >> CSeq: 4
Source listener: >> User-Agent: Lavf57.63.100
Source listener: >> Session: 1
Source listener: >> 
End of headers
Got SETUP request for stream 1
Creating new stream 1
<< RTSP/1.0 200 OK
<< Transport: RTP/AVP/UDP;unicast;client_port=13144-13145;mode=record;server_port=20002-20003
<< CSeq: 4
<< Session: 1
Source listener: >> RECORD rtsp://localhost:5545/abc RTSP/1.0
Got method RECORD
Source listener: >> Range: npt=0.000-
Source listener: >> CSeq: 5
Source listener: >> User-Agent: Lavf57.63.100
Source listener: >> Session: 1
Source listener: >> 
End of headers
Got record for mountpoint /abc
Starting RTP listeners
|-- stream 0
|---- port 20000
|---- port 20001
|-- stream 1
|---- port 20002
|---- port 20003
<< RTSP/1.0 200 OK
<< CSeq: 5
<< Session: 1

These are the logs when i tried to stream from the server in VLC:

Client connection from myip:19324
Client listener: >> OPTIONS rtsp://myserver/abc RTSP/1.0
Got method OPTIONS
Client listener: >> CSeq: 2
Client listener: >> User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)
Client listener: >> 
End of headers
<< RTSP/1.0 200 OK
<< Public: OPTIONS, DESCRIBE, TEARDOWN, SETUP, PLAY, STOP
<< CSeq: 2
<< Session: 2
Client listener: >> DESCRIBE rtsp://myserver/abc RTSP/1.0
Got method DESCRIBE
Client listener: >> CSeq: 3
Client listener: >> User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)
Client listener: >> Accept: application/sdp
Client listener: >> 
End of headers
<< RTSP/1.0 200 OK
<< Content-Type: application/sdp
<< Content-Length: 511
<< CSeq: 3
<< Session: 2
Client listener: >> SETUP rtsp://myserver/abc/streamid=0 RTSP/1.0
Got method SETUP
Client listener: >> CSeq: 4
Client listener: >> User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)
Client listener: >> Transport: RTP/AVP;unicast;client_port=6982-6983
Client listener: >> 
End of headers
SETUP stream id 0
<< RTSP/1.0 200 OK
<< Transport: RTP/AVP;unicast;client_port=6982-6983;server_port=20004-20005
<< CSeq: 4
<< Session: 2
Client listener: >> SETUP rtsp://myserver/abc/streamid=1 RTSP/1.0
Got method SETUP
Client listener: >> CSeq: 5
Client listener: >> User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)
Client listener: >> Transport: RTP/AVP;unicast;client_port=6984-6985
Client listener: >> Session: 2
Client listener: >> 
End of headers
SETUP stream id 1
<< RTSP/1.0 200 OK
<< Transport: RTP/AVP;unicast;client_port=6984-6985;server_port=20006-20007
<< CSeq: 5
<< Session: 2
Client listener: >> PLAY rtsp://myserver/abc RTSP/1.0
Got method PLAY
Client listener: >> CSeq: 6
Client listener: >> User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)
Client listener: >> Session: 2
Client listener: >> Range: npt=0.000-
Client listener: >> 
End of headers
<< RTSP/1.0 200 OK
<< Range: npt=0.000-
<< CSeq: 6
<< Session: 2
Client listener: >> TEARDOWN rtsp://myserver/abc RTSP/1.0
Got method TEARDOWN
Client listener: >> CSeq: 7
Client listener: >> User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)
Client listener: >> Session: 2
Client listener: >> 
End of headers
Got EOF on listener
Client connection from myip:19450
Client listener: >> OPTIONS rtsp://myserver/abc RTSP/1.0
Got method OPTIONS
Client listener: >> CSeq: 2
Client listener: >> User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)
Client listener: >> 
End of headers
<< RTSP/1.0 200 OK
<< Public: OPTIONS, DESCRIBE, TEARDOWN, SETUP, PLAY, STOP
<< CSeq: 2
<< Session: 3
Client listener: >> DESCRIBE rtsp://myserver/abc RTSP/1.0
Got method DESCRIBE
Client listener: >> CSeq: 3
Client listener: >> User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)
Client listener: >> Accept: application/sdp
Client listener: >> 
End of headers
<< RTSP/1.0 200 OK
<< Content-Type: application/sdp
<< Content-Length: 511
<< CSeq: 3
<< Session: 3
Client listener: >> SETUP rtsp://myserver/abc/streamid=0 RTSP/1.0
Got method SETUP
Client listener: >> CSeq: 4
Client listener: >> User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)
Client listener: >> Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Client listener: >> 
End of headers
SETUP stream id 0
Failed to find client RTP start port in SETUP request
<< RTSP/1.0 400 Bad Request
<< CSeq: 4
<< Session: 3
Returning error 400: Bad Request
Client listener: >> SETUP rtsp://myserver/abc/streamid=1 RTSP/1.0
Got method SETUP
Client listener: >> CSeq: 5
Client listener: >> User-Agent: LibVLC/2.2.4 (LIVE555 Streaming Media v2016.02.22)
Client listener: >> Transport: RTP/AVP/TCP;unicast;interleaved=2-3
Client listener: >> 
End of headers
SETUP stream id 1
Failed to find client RTP start port in SETUP request
<< RTSP/1.0 400 Bad Request
<< CSeq: 5
<< Session: 3
Returning error 400: Bad Request
Got EOF on listener
ghost commented 7 years ago

sorry but i do not know how to get sdp info

Mcfloy commented 7 years ago

"Client listener: >> SETUP rtsp://myserverabc/streamid=0 RTSP/1.0" Shouldn't it be "Client listener: >> SETUP rtsp://myserver/abc/streamid=0 RTSP/1.0" ?

Got the same problem tho, will see solutions after.

ghost commented 7 years ago

@Mcfloy I changed the ip address manually so the typo was mine, not the logger's

micaelsilva commented 7 years ago

I made some captures between VLC (that doesn't work) and ffplay (that works) to see the differences. I think i' got it: ffplay always add the port on the command, like rtsp://localhost:554/test. VLC doesn't, even when you put it on the URL. On the VLC case that result in the SETUP command being reply like "RTP/AVP;unicast;(...)" instead of "RTP/AVP/UDP;unicast;(...)" as it should be.

revmischa commented 7 years ago

patches welcome

maikelkat commented 6 years ago

@revmischa @micaelsilva @vjlomocso @Tinywan @Mcfloy , Did you have a patch for the 'Failed to find client RTP start port in SETUP request' issue?

Tinywan commented 6 years ago

@maikelkat No

maikelkat commented 6 years ago

@Tinywan Thanks for your reply, Do you know a simple alternative RTSP server available which works with VLC?

Tinywan commented 6 years ago

@maikelkat You can this http://www.easydarwin.org/

maikelkat commented 6 years ago

Thanks very much!, @Tinywan I tried and it does work, but the video is realy lagy and not showing a smooth video. I use a VPN with ubuntu and I would like to send a RTSP or RTMP stream over the internet to the easydarwin server or any other RTSP/RTMP server, make that stream available as RTSP and then catch it with a terradek live:action app as a RTSP stream....from there I can manage all inputs in one console and stream it again to my NGINX RTMP server(which does not do RTSP), until now there is nothing that realy works well ....any sugestions?......maybe wowza can do a good job but that costs..

Tinywan commented 6 years ago

@maikelkat Maybe ffmpeg can help you copy rtsp

ffmpeg -i "rtsp://192.168.18.240:554/onvif/live/1" -vcodec copy -acodec copy  \
-rtsp_transport tcp -f rtsp "rtsp://192.168.18.73/test.sdp"

rtsp to rtmp

ffmpeg -i "rtsp://192.168.18.240:554/onvif/live/1" -vcodec copy -acodec copy  \
-f flv "rtsp://192.168.18.73/test.sdp"

or

ffmpeg -rtsp_transport tcp -i rtsp://admin:12345@192.168.18.252:554/h264/ch1/main/av_stream \
-c:a copy -c:v libx264 -f flv rtmp://192.168.18.73/live/tinywan123
careyer commented 5 years ago

Is there any solution how to use this with VLC? I noticed that the Linux version of VLC does indeed work... the Windows version however does not send the port for some reason even when it is specified in the URL. @revmischa : Maybe you can add a fix / workaround for that? Would be much appreciated