Please be aware that HTTP basic authentication is passed in the URL string as in your example but digest is md5 encoded and passed as a separate element in the HTTP request.
also the http://www.live555.com/ library does support http/digest authentication, i have tested, it works.
After digging a lot with ffmpeg I found that long urls with authorization fail in ffmpeg while working good with VLC.
Url lenght with auth should be less than 140.
So 139 chars worked while 140 failed with method SETUP failed: 401 Unauthorized
What I found was that you should use single quotes ' instead of double quotes " as recommended in the solution given by @AmitSharma.
And the reason for this, is that if the password contains any special characters you might get weird errors as the shell might interpret them as it wants. I tried to escape these characters first, which seemed to solve the problem with the shell, but now for some weird reason ffmpeg didn't read the password correctly anymore... So the only way for me to get it to work was to use single quotes instead, as that tells the shell (bash in my case) to not interpret anything between the quotes.
I spent whole weekend on it (ffmpeg 07/07/2014) and can say -NO! Perhaps ffmpeg has RTSP codes for digest/auth, but they do not work there. I always got 401 error from IP camera with digest/auth and good work with basic/auth.
VLC with live555 works well with any authentication.
发布评论
评论(8)
已经有一段时间了,不知道 11 的故事是什么,但是,是的,ffmpeg 现在支持这样。
ffmpeg -i rtsp://user:[电子邮件受保护]/VideoString
有效。
It has been quite q while, not sure what's the story back in 11, but yes, ffmpeg now support so.
ffmpeg -i rtsp://user:[email protected]/VideoString
works.
ffmpeg 支持 RTSP 身份验证。我认为您可能缺少涵盖 RTSP URL 的引号。
示例
不工作:
工作:
ffmpeg supports RTSP authentication. I think you might be missing quotes covering RTSP URL.
Examples
Not working:
Working:
是的,我也有这个问题。似乎缺少摘要式身份验证。有一些关于添加它的邮件列表评论。请参阅 http://web.archiveorange.com/ archive/v/yR2T4nBtThzJs27hqDLb 但没有任何结论。
请注意,HTTP 基本身份验证是在 URL 字符串中传递的,如您的示例所示,但摘要是 md5 编码的,并作为 HTTP 请求中的单独元素传递。
另外 http://www.live555.com/ 库确实支持 http/digest 身份验证,我已经测试过,有用。
要测试连接性,请使用 live555 中的 testProgs
Yea Im having problems with this too. It seems Digest authentication is missing. there are a few mailing list comments about adding it in. see http://web.archiveorange.com/archive/v/yR2T4nBtThzJs27hqDLb but nothing conclusive.
Please be aware that HTTP basic authentication is passed in the URL string as in your example but digest is md5 encoded and passed as a separate element in the HTTP request.
also the http://www.live555.com/ library does support http/digest authentication, i have tested, it works.
to test conectivity use the testProgs in live555
在对 ffmpeg 进行了大量研究之后,我发现带有授权的长 URL 在 ffmpeg 中失败,而在 VLC 中工作得很好。
带有身份验证的 URL 长度应小于 140。
因此,139 个字符有效,而 140 个字符失败,
method SETUP failed: 401 Unauthorized
PS
深入研究源代码后,我发现 https://github.com /FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavformat/rtsp.h#L423
看起来没有密码的 url 是 128 个字符。
After digging a lot with ffmpeg I found that long urls with authorization fail in ffmpeg while working good with VLC.
Url lenght with auth should be less than 140.
So 139 chars worked while 140 failed with
method SETUP failed: 401 Unauthorized
P.S.
After digging in Source code I found https://github.com/FFmpeg/FFmpeg/blob/415f907ce8dcca87c9e7cfdc954b92df399d3d80/libavformat/rtsp.h#L423
Looks like it is 128 char for url without password.
是的,
ffmpeg
确实支持使用ffplay
命令进行 RTSP 身份验证。尝试使用 ffplay 命令:
这对我有用。
源代码(改编自用于验证 ftp 和其他使用相同语法的命令):
ffmpeg.org
Yes,
ffmpeg
does support RTSP authentication using theffplay
command.Try using the
ffplay
command instead:This works for me.
source (adapted from the commands used to authenticate ftp and others using the same syntax):
ffmpeg.org
我发现您应该按照 questions/5014973/does-ffmpeg-support-rtsp-authentication/55772260#55772260">@AmitSharma。
这样做的原因是,如果密码包含任何特殊字符,你可能会得到奇怪的错误,因为 shell 可能会出现这样的错误 。我首先尝试转义这些字符,这似乎解决了 shell 的问题,但现在由于某种奇怪的原因 ffmpeg 不再正确读取密码......所以我得到的唯一方法它的工作原理是使用单引号,因为这告诉 shell(在我的例子中是 bash)不要解释引号之间的任何内容
@AmitSharma 的解决
方案使用单引号。
What I found was that you should use single quotes
'
instead of double quotes"
as recommended in the solution given by @AmitSharma.And the reason for this, is that if the password contains any special characters you might get weird errors as the shell might interpret them as it wants. I tried to escape these characters first, which seemed to solve the problem with the shell, but now for some weird reason ffmpeg didn't read the password correctly anymore... So the only way for me to get it to work was to use single quotes instead, as that tells the shell (bash in my case) to not interpret anything between the quotes.
Solution by @AmitSharma
Solution with single quotes
FFmpeg 似乎支持摘要式身份验证,至少截至 2010 年 3 月 25 日提交:
https://github.com/FFmpeg/FFmpeg/commit/855e7732c6bcc7d52cd0863407a721c2bf00fcf1
实现逻辑摘要计算主要在这个文件中:
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat /httpauth.c
根据这个 changelog, 0.6版本发布:
FFmpeg appears to support Digest authentication, at least as of this March 25, 2010 commit:
https://github.com/FFmpeg/FFmpeg/commit/855e7732c6bcc7d52cd0863407a721c2bf00fcf1
The logic implementing the digest computation is mostly in this file:
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/httpauth.c
According to this changelog, that made it into the version 0.6 release:
我花了整个周末(ffmpeg 07/07/2014)并且可以说 - 不!也许 ffmpeg 有用于摘要/验证的 RTSP 代码,但它们在那里不起作用。我总是从带有摘要/身份验证的 IP 摄像机中收到 401 错误,并且在基本/身份验证方面工作良好。
带有 live555 的 VLC 可以很好地配合任何身份验证。
I spent whole weekend on it (ffmpeg 07/07/2014) and can say -NO! Perhaps ffmpeg has RTSP codes for digest/auth, but they do not work there. I always got 401 error from IP camera with digest/auth and good work with basic/auth.
VLC with live555 works well with any authentication.