authentication - FFmpeg RTSP 认证

标签 authentication ffmpeg rtsp digest

我目前一直在尝试使用 FFmpeg 设置从 RTSP 到 HLS 的编码过程,大多数流都成功。

但是,对于具有摘要身份验证的流/相机,FFmpeg 似乎失败并出现经典的 401 Unauthorized,如下所示:

ffmpeg -loglevel debug -i "rtsp://user:password@192.168.0.1/stream" /folder/output.m3u8

给予:
ffmpeg version N-85750-ga75ef15 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 93.100 / 57. 93.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 88.100 /  6. 88.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.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://username:password@192.168.0.1/stream'.
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://username:password@192.168.0.1/stream2.
Successfully parsed a group of options.
Opening an input file: rtsp://username:password@192.168.0.1/stream.
[tcp @ 00000000025c3900] No default whitelist set
[rtsp @ 00000000025c2560] method OPTIONS failed: 401 Unauthorized
[rtsp @ 00000000025c2560] CSeq: 2
WWW-Authenticate: Digest realm="Use 'live' as User Name", nonce="2ae726f5557769220b780deb4f562226", algorithm=MD5, qop="auth"
rtsp://user:password@192.168.0.1/stream: Server returned 401 Unauthorized (authorization failed)

我检查了相机是否可以访问并且输入 URI 在 VLC 中有效。我试图从中获取流的相机是博世相机。

我在互联网上进行了搜索和搜索,但没有找到任何具体的解决方案。

有任何想法吗?

最佳答案

可能是 rtsp 默认端口->554

ffmpeg -loglevel debug -i "rtsp://user:password@192.168.0.1/stream" /folder/output.m3u8


正确的 :

ffmpeg -loglevel debug -i "rtsp://user:password@192.168.0.1:554/stream" /folder/output.m3u8

关于authentication - FFmpeg RTSP 认证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46328369/

相关文章:

java - 如果另一个用户登录,预身份验证不起作用 - Spring 安全

javascript - 使用 AngularJS : auth cookie sent for/_session only 登录 CouchDB

使用 yocto 构建 ffmpeg

youtube-api - 如何使用 gData API 获取高质量的 RTSP 流 URL

video - 共享 IP 摄像机源 (RTSP?)

authentication - 我们如何在 google puppeteer 的 headless chrome 中传递身份验证 token ?

java - JHipster ldap 认证

c - 使用 ffmpeg 编写 DVD 解复用器

android - FFmpeg .avi 到 .mp4 视频转码 - Android

gstreamer - 如何使用gstreamer rtspsrc显示rtsp源?