esp32cam-rtsp
esp32cam-rtsp copied to clipboard
Can't view stream with VLC and RTSPtoWeb
Hello. Firstly after flashing and setup I tried to open stream in VLC, but have only black screen with VLC logo in player. Logs says "error sending udp packet":
14:10:35.038 > Creating TSP streamer
14:10:35.038 > Created streamer width=1280, height=720
14:10:35.046 > Creating RTSP session
14:10:36.040 > RTSP received OPTIONS
14:10:37.145 > RTSP received DESCRIBE
14:10:38.250 > RTSP received SETUP
14:10:39.355 > RTSP received PLAY
14:10:52.104 > [169517][E][WiFiClient.cpp:422] write(): fail on fd 52, errno: 104, "Connection reset by peer"
14:10:52.113 > client has closed the socket
14:10:52.113 > client closed socket, exiting
14:10:52.115 > closing TCP socket
14:10:52.118 > closing UDP socket
14:10:52.123 > closing UDP socket
14:11:08.807 > Creating TSP streamer
14:11:08.807 > Created streamer width=1280, height=720
14:11:08.815 > Creating RTSP session
14:11:09.809 > RTSP received SETUP
14:11:10.916 > RTSP received PLAY
14:11:14.380 > [191793][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.386 > error sending udp packet
14:11:14.386 > [191794][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.394 > error sending udp packet
14:11:14.394 > [191799][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.400 > error sending udp packet
14:11:14.707 > [192120][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.712 > error sending udp packet
14:11:14.712 > [192121][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.721 > error sending udp packet
14:11:14.721 > [192125][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.726 > error sending udp packet
14:11:14.729 > [192134][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.735 > error sending udp packet
14:11:14.737 > [192142][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.743 > error sending udp packet
14:11:14.746 > [192154][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.751 > error sending udp packet
14:11:14.754 > [192158][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.760 > error sending udp packet
14:11:14.762 > [192166][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.768 > error sending udp packet
14:11:14.771 > [192174][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.776 > error sending udp packet
14:11:14.779 > [192182][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.785 > error sending udp packet
14:11:14.787 > [192190][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.793 > error sending udp packet
14:11:14.793 > [192198][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.801 > error sending udp packet
14:11:14.801 > [192206][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.807 > error sending udp packet
14:11:14.810 > [192214][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.815 > error sending udp packet
14:11:14.818 > [192222][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:14.823 > error sending udp packet
14:11:15.350 > [192763][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.355 > error sending udp packet
14:11:15.355 > [192763][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.363 > error sending udp packet
14:11:15.363 > [192768][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.369 > error sending udp packet
14:11:15.372 > [192777][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.377 > error sending udp packet
14:11:15.380 > [192785][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.386 > error sending udp packet
14:11:15.388 > [192794][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.394 > error sending udp packet
14:11:15.397 > [192802][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.402 > error sending udp packet
14:11:15.405 > [192810][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.411 > error sending udp packet
14:11:15.413 > [192817][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.419 > error sending udp packet
14:11:15.422 > [192827][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.427 > error sending udp packet
14:11:15.430 > [192840][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.436 > error sending udp packet
14:11:15.436 > [192841][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.444 > error sending udp packet
14:11:15.444 > [192851][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.450 > error sending udp packet
14:11:15.452 > [192858][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.458 > error sending udp packet
14:11:15.461 > [192867][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.466 > error sending udp packet
14:11:15.469 > [192875][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.475 > error sending udp packet
14:11:15.477 > [192882][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.483 > error sending udp packet
14:11:15.486 > [192890][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.491 > error sending udp packet
14:11:15.494 > [192898][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.500 > error sending udp packet
14:11:15.502 > [192906][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.508 > error sending udp packet
14:11:15.511 > [192915][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.516 > error sending udp packet
14:11:15.519 > [192922][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.525 > error sending udp packet
14:11:15.525 > [192930][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.533 > error sending udp packet
14:11:15.533 > [192941][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.538 > error sending udp packet
14:11:15.541 > [192946][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.547 > error sending udp packet
14:11:15.550 > [192955][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.555 > error sending udp packet
14:11:15.558 > [192962][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.563 > error sending udp packet
14:11:15.915 > [193328][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.921 > error sending udp packet
14:11:15.921 > [193329][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.929 > error sending udp packet
14:11:15.929 > [193334][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.934 > error sending udp packet
14:11:15.937 > [193347][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.943 > error sending udp packet
14:11:15.946 > [193350][E][WiFiUdp.cpp:185] endPacket(): could not send data: 12
14:11:15.951 > error sending udp packet
14:12:07.073 > RTSP received OPTIONS
14:13:03.184 > RTSP received OPTIONS
14:13:59.338 > RTSP received OPTIONS
14:14:55.433 > RTSP received OPTIONS
14:15:51.592 > RTSP received OPTIONS
14:16:47.692 > RTSP received OPTIONS
14:17:43.760 > RTSP received OPTIONS
14:18:39.870 > RTSP received OPTIONS
14:19:36.023 > RTSP received OPTIONS
# Here I closed VLC
14:20:11.916 > RTSP received TEARDOWN
14:20:11.916 > closing TCP socket
14:20:11.918 > closing UDP socket
14:20:11.922 > closing UDP socket
Then I tried to use RTSPtoWeb to re-stream video to the web browser and again, videos not loading and logs printing some another type of error:
14:20:44.321 > Creating TSP streamer
14:20:44.321 > Created streamer width=1280, height=720
14:20:44.329 > Creating RTSP session
14:20:45.323 > RTSP received OPTIONS
14:20:46.428 > RTSP received DESCRIBE
14:20:47.533 > RTSP received SETUP
14:20:48.638 > RTSP received PLAY
14:21:04.265 > [781692][E][WiFiClient.cpp:422] write(): fail on fd 52, errno: 104, "Connection reset by peer"
14:21:04.274 > client has closed the socket
14:21:04.274 > client closed socket, exiting
14:21:04.276 > closing TCP socket
14:21:04.279 > closing UDP socket
14:21:04.284 > closing UDP socket
14:21:06.269 > Creating TSP streamer
14:21:06.269 > Created streamer width=1280, height=720
14:21:06.276 > Creating RTSP session
14:21:07.271 > RTSP received OPTIONS
14:21:08.375 > RTSP received DESCRIBE
14:21:09.480 > RTSP received SETUP
14:21:10.585 > RTSP received PLAY
14:21:26.177 > [803604][E][WiFiClient.cpp:422] write(): fail on fd 52, errno: 104, "Connection reset by peer"
14:21:26.185 > client has closed the socket
14:21:26.186 > client closed socket, exiting
14:21:26.189 > closing TCP socket
14:21:26.191 > closing UDP socket
14:21:26.196 > closing UDP socket
...
And so on
RTSPtoWeb log:
]
2023/03/22 11:30:30 [RTSP/1.0 200 OK
CSeq: 1
Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE
]
2023/03/22 11:30:30 [DESCRIBE rtsp://192.168.13.89:554/mjpeg/1 RTSP/1.0
CSeq: 2
Accept: application/sdp
User-Agent: Lavf58.76.100
]
2023/03/22 11:30:31 [RTSP/1.0 200 OK
CSeq: 2
Date: Thu, Jan 01 1970 00:22:29 GMT
Content-Base: rtsp://192.168.13.89:554/mjpeg/1/
Content-Type: application/sdp
Content-Length: 94
v=0
o=- 147699711 1 IN IP4 192.168.13.89
s=
t=0 0
m=video 0 RTP/AVP 26
c=IN IP4 0.0.0.0
]
2023/03/22 11:30:31 [SETUP rtsp://192.168.13.89:554/mjpeg/1/ RTSP/1.0
CSeq: 3
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
User-Agent: Lavf58.76.100
]
2023/03/22 11:30:32 [RTSP/1.0 200 OK
CSeq: 3
Date: Thu, Jan 01 1970 00:22:30 GMT
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Session: -2147458888
]
2023/03/22 11:30:32 [SDP Video Codec Type Not Supported ]
2023/03/22 11:30:32 [PLAY rtsp://192.168.13.89:554/mjpeg/1/ RTSP/1.0
CSeq: 4
User-Agent: Lavf58.76.100
Session: -2147458888
]
2023/03/22 11:30:33 [RTSP/1.0 200 OK
CSeq: 4
Date: Thu, Jan 01 1970 00:22:31 GMT
Range: npt=0.000-
Session: -2147458888
RTP-Info: url=rtsp://127.0.0.1:8554/mjpeg/1/track1
]
time="2023-03-22T11:30:33Z" level=info msg="Success connection RTSP" call=Start channel=0 func=StreamServerRunStream module=core stream=2ff849bc-0244-4477-8cee-bf2020f56f78
2023/03/22 11:30:49 [TEARDOWN rtsp://192.168.13.89:554/mjpeg/1/ RTSP/1.0
CSeq: 5
User-Agent: Lavf58.76.100
Session: -2147458888
]
2023/03/22 11:30:49 [RTSP Client RTP ReadFull <nil>]
2023/03/22 11:30:49 [RTSP Client Close <nil>]
time="2023-03-22T11:30:49Z" level=error msg="Stream error restart stream stream no video" call=Restart
time="2023-03-22T11:30:51Z" level=info msg="Run stream" call=Run channel=0 func=StreamServerRunStreamDo module=core stream=2ff849bc-0244-4477-8cee-bf2020f56f78
time="2023-03-22T11:30:51Z" level=info msg="Stop stream no client" call=ClientHas channel=0 func=StreamServerRunStreamDo module=core stream=2ff849bc-0244-4477-8cee-bf2020f56f78
Idk if I'm doing something wrong, or this is some protocols mismatch or something like this. Snapshots working fine, also I have success on recording some stream through ffmpeg. I used VLC 3.0.18 on Arch Linux and latest docker image of RTSPtoWeb.
Hi Thomas,
I added the option to stream directly from the esp32-cam module. See the latest release. I think this is much easier!
Kind regards,
Rene
Hi Rene, JPEG stream works like a charm, thank you! But still cannot play RTSP from VLC unfortunately :( Also some things changed:
- No more errors in log, only RTSP OPTIONS requests:
21:32:48.557 > RTSP received OPTIONS
21:33:44.604 > RTSP received OPTIONS
21:34:40.652 > RTSP received OPTIONS
21:35:36.699 > RTSP received OPTIONS
- Controls in VLC become clickable.
--------------------------------------------------------
Flashed latest code from develop
branch.
Same problem here. RTSP does not work.
Hi Thomas/Lars,
I retested RTSP and it does work. However, if the bandwidth is too low this causes stability issues. I scaled down the initial settings to limit the data sent by the ESP32 cam See #76. Maybe this helps.
I suggest to use a low resolution and low frame rate and crank this up slowly.
Hope this works!
You are right. Just tried an RTSP player on my phone. It connects fine to the ESP32 Cam, but somehow VLC wont load the stream.