FFMPEG支持RTSP认证吗?

发布于 2024-10-17 12:53:01 字数 190 浏览 5 评论 0 原文

例如...

rtsp://user:[email protected]/VideoString

Such as...

rtsp://user:[email protected]/VideoString

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

左耳近心 2024-10-24 12:53:01

已经有一段时间了,不知道 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.

画中仙 2024-10-24 12:53:01

ffmpeg 支持 RTSP 身份验证。我认为您可能缺少涵盖 RTSP URL 的引号。

示例

不工作:

ffmpeg -i rtsp://user:[email protected]/VideoString

工作:

ffmpeg -i "rtsp://user:[email protected]/VideoString"

ffmpeg supports RTSP authentication. I think you might be missing quotes covering RTSP URL.

Examples

Not working:

ffmpeg -i rtsp://user:[email protected]/VideoString

Working:

ffmpeg -i "rtsp://user:[email protected]/VideoString"
A君 2024-10-24 12:53:01

是的,我也有这个问题。似乎缺少摘要式身份验证。有一些关于添加它的邮件列表评论。请参阅 http://web.archiveorange.com/ archive/v/yR2T4nBtThzJs27hqDLb 但没有任何结论。

请注意,HTTP 基本身份验证是在 URL 字符串中传递的,如您的示例所示,但摘要是 md5 编码的,并作为 HTTP 请求中的单独元素传递。

另外 http://www.live555.com/ 库确实支持 http/digest 身份验证,我已经测试过,有用。

要测试连接性,请使用 live555 中的 testProgs

live/testProgs/openRTSP -4 -u admin admin -w 1280 -h 720 -f 20 rtsp://192.168.0.2/defaultPrimary?streamType=u > testmovie.mp4

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

live/testProgs/openRTSP -4 -u admin admin -w 1280 -h 720 -f 20 rtsp://192.168.0.2/defaultPrimary?streamType=u > testmovie.mp4
谜兔 2024-10-24 12:53:01

在对 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.

咿呀咿呀哟 2024-10-24 12:53:01

是的,ffmpeg 确实支持使用 ffplay 命令进行 RTSP 身份验证。

尝试使用 ffplay 命令:

ffplay rtsp://user:[email protected]/VideoString

这对我有用。

源代码(改编自用于验证 ftp 和其他使用相同语法的命令):

ffmpeg.org

Yes, ffmpeg does support RTSP authentication using the ffplay command.

Try using the ffplay command instead:

ffplay rtsp://user:[email protected]/VideoString

This works for me.

source (adapted from the commands used to authenticate ftp and others using the same syntax):

ffmpeg.org

终难愈 2024-10-24 12:53:01

我发现您应该按照 questions/5014973/does-ffmpeg-support-rtsp-authentication/55772260#55772260">@AmitSharma

这样做的原因是,如果密码包含任何特殊字符,你可能会得到奇怪的错误,因为 shell 可能会出现这样的错误 。我首先尝试转义这些字符,这似乎解决了 shell 的问题,但现在由于某种奇怪的原因 ffmpeg 不再正确读取密码......所以我得到的唯一方法它的工作原理是使用单引号,因为这告诉 shell(在我的例子中是 bash)不要解释引号之间的任何内容

@AmitSharma 的解决

ffmpeg -i "rtsp://user:[email protected]/VideoString"

方案使用单引号。

ffmpeg -i 'rtsp://user:[email protected]/VideoString'

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

ffmpeg -i "rtsp://user:[email protected]/VideoString"

Solution with single quotes

ffmpeg -i 'rtsp://user:[email protected]/VideoString'
沉鱼一梦 2024-10-24 12:53:01

FFmpeg 似乎支持摘要式身份验证,至少截至 2010 年 3 月 25 日提交:
https://github.com/FFmpeg/FFmpeg/commit/855e7732c6bcc7d52cd0863407a721c2bf00fcf1

实现逻辑摘要计算主要在这个文件中:
https://github.com/FFmpeg/FFmpeg/blob/master/libavformat /httpauth.c

根据这个 changelog, 0.6版本发布:

  • HTTP Digest验证

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:

  • HTTP Digest authentication
网白 2024-10-24 12:53:01

我花了整个周末(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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文