Let me explain my problem, I am trying to access different channels in a DVR system. I have successfully gotten access to a single camera (channel 1) by using opencv as such:
public_link = 'rtsp://test:[email protected]/cam/realmonitor'
cap = cv2.VideoCapture(public_link, cv2.CAP_FFMPEG)
The problem is I can't access the other channels with these parameters:
public_link = 'rtsp://test:[email protected]/cam/realmonitor?channel=3&subtype=0'
cap = cv2.VideoCapture(public_link, cv2.CAP_FFMPEG)
I've tried the following links:
I get this following error:
[rtsp @ 00000201ce582cc0] method DESCRIBE failed: 401 Unauthorized
I've noticed that even if I test with this URL (rtsp://test:[email protected]/blablabla) it works just fine! (ONLY Channel #1) but when I insert the symbol '=' into the URL string, I get the above error.
It's really frustrating, Any sort of help would be much appreciated.
PS: the user 'test' has admin privileges in the system.
I've tried to run the test with plain ffmpeg command like such:
ffmpeg -loglevel debug -i "rtsp://test:[email protected]/cam/monitor?channel=3&subtype=0" ./folder/output.m3u8
I get the following error:
PS C:\Users\cjhou> ffmpeg -loglevel debug -i "rtsp://test:[email protected]/cam/realmonitor?channel=3&subtype=0" .\folder\output.m3u8
ffmpeg version 4.4-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
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
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input url with argument 'rtsp://test:[email protected]/cam/realmonitor?channel=3&subtype=0'.
Reading option '.\folder\output.m3u8' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://test:[email protected]/cam/realmonitor?channel=3&subtype=0.
Successfully parsed a group of options.
Opening an input file: rtsp://houssem:[email protected]/cam/realmonitor?channel=3&subtype=0.
[tcp @ 000001882b592240] No default whitelist set
[tcp @ 000001882b592240] Original list of addresses:
[tcp @ 000001882b592240] Address 192.168.1.48 port 554
[tcp @ 000001882b592240] Interleaved list of addresses:
[tcp @ 000001882b592240] Address 192.168.1.48 port 554 [tcp @ 000001882b592240] Starting connection attempt to 192.168.1.48 port 554
[tcp @ 000001882b592240] Successfully connected to 192.168.1.48 port 554
[rtsp @ 000001882b58f080] method DESCRIBE failed: 401 Unauthorized
[rtsp @ 000001882b58f080] Cseq: 3 Server: Rtsp Server 960*576*30*4096
WWW-Authenticate: Digest realm="Surveillance Server", nonce="44976150"
rtsp://test:[email protected]/cam/realmonitor?channel=3&subtype=0: Server returned 401 Unauthorized (authorization failed)
With this command ffplay "rtsp://test:[email protected]/cam/realmonitor?channel=3&subtype=0", I get this output:
PS C:\Users\cjhou> ffplay "rtsp://test:[email protected]/cam/realmonitor?channel=3&subtype=0"
ffplay version 4.4-full_build-www.gyan.dev Copyright (c) 2003-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
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
[rtsp @ 000001d413d2f640] method DESCRIBE failed: 401 Unauthorized
rtsp://test:[email protected]/cam/realmonitor?channel=3&subtype=0: Server returned 401 Unauthorized (authorization failed)
nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
By the way, I am using this device:
Hope this helps!
Well, after a lot of research of the DVR model that I am using. It turns out that I am using a Longse DVR type model. I don't really know what model number exactly but at least I knew that it was a Longse DVR.
It turns out that I was using a wrong URL. The DVR/cameras URL should be in this format:
rtsp://[username]:[password]@[IP_ADDRESS]:[PORT]/[channelID][SubTypeID]
Finally, I got access to all of the cameras connected to the DVR, example (viewing channel #3 on subset 0):
rtsp://test:[email protected]:554/30
or viewing channel #6 on subset 1)
rtsp://test:[email protected]:554/61
I've got a huge help with a "ISpyConnect Agent" Software to extract all available URLs of a given Model. (I've input the model: Longse: Unlisted)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With