deepch / RTSPtoWebRTC

RTSP to WebRTC use Pion WebRTC
MIT License
1.57k stars 417 forks source link

RTSP Stream authentication? #111

Open smartypantsuk opened 3 years ago

smartypantsuk commented 3 years ago

Hello,

Is basic authentication not supported for rtsp streams? As in, rtsp://user:pass@?

I have tried but fails in unauthorised user 401.

deepch commented 3 years ago

Can you organize access to your stream?

smartypantsuk commented 3 years ago

Can you organize access to your stream?

rtsp://84.92.37.1:554/Streaming/channels/302

rtsp://guest:guest12345@84.92.37.1:554/Streaming/channels/302

smartypantsuk commented 3 years ago

and it doesn't seem to work with RTSPtoWeb either:

time="2021-07-19T08:51:35+01:00" level=error msg="Stream error restart stream EOF" call=Restart
time="2021-07-19T08:51:37+01:00" level=info msg="Run stream" call=Run channel=0 func=StreamServerRunStreamDo module=core stream=demo
2021/07/19 08:51:37 [OPTIONS rtsp://84.92.37.1:554/Streaming/channels/302 RTSP/1.0
CSeq: 1
User-Agent: Lavf58.20.100

but it does work with VLC.

smartypantsuk commented 3 years ago

Can you organize access to your stream?

Do you have any idea? Is perhaps authentication mechanism not implemented in rtsptowebrtc?

otis-red commented 3 years ago

Same issue trying to access a REOLINK camera RTSP feed. It requires basic authentication to be sent on the URL.

Main Stream: rtsp://admin:password@ip_address:554/h264Preview_01_main

Sub Stream: rtsp://admin:password@ip_address:554/h264Preview_01_sub

Any chance this can be added ?

smartypantsuk commented 3 years ago

I actually got mine working with no additional requirements in regard to rtsptowebrtc. The problem in my case was the way I had my hikvision nvr configured.

I had onvif protocol enabled with a seperate user configured for onvif access. As soon as I disable onvif then I could access the stream through rtsp with the authentication in the url as described in your post. I setup a seperate user with no permission other than live view in the nvr users section.

That's all I did and it works