6

Such as...

rtsp://user:pass@x.x.x.x/VideoString
NoviceAndNovice
  • 705
  • 2
  • 13
  • 21
  • 3
    When you ask a question here you are expected to select one of the responses as the "answer" by clicking on the large check mark by that answer. You have asked 10 questions to date and not marked any as accepted. When people see this they feel that answering your future questions isn't worth their time. So please go back to your previous questions, evaluate the responses and try to select one as the answer. If you solved the problem on your own, feel free to answer your own question and mark that as accepted. If your question ultimately didn't get answered it is okay to not check anything. – Chris Haas Feb 16 '11 at 14:17
  • i want solution for same. i have ip address, port and credentials. – Nirav Jain May 09 '13 at 23:01

8 Answers8

19

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:pass@x.x.x.x/VideoString

works.

JasonYang
  • 686
  • 7
  • 14
7

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

Examples

Not working:

ffmpeg -i rtsp://user:pass@x.x.x.x/VideoString

Working:

ffmpeg -i "rtsp://user:pass@x.x.x.x/VideoString"
Azhar Khan
  • 3,829
  • 11
  • 26
  • 32
Amit Sharma
  • 153
  • 1
  • 7
  • 1
    Thanks, @AmitSharma. This solved our problem: https://stackoverflow.com/questions/56808123/ffmpeg-returns-method-setup-failed-404-not-found/ – Alex Jul 01 '19 at 11:58
2

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

Try using the ffplay command instead:

ffplay rtsp://user:pass@x.x.x.x/VideoString

This works for me.

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

ffmpeg.org

mchid
  • 2,699
  • 1
  • 14
  • 12
2

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.

Ruslan Kyrychuk
  • 366
  • 1
  • 7
2

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
nick fox
  • 570
  • 8
  • 15
1

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:pass@x.x.x.x/VideoString"

Solution with single quotes

ffmpeg -i 'rtsp://user:password!@x.x.x.x/VideoString'
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
0

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.

victor kulichkin
  • 394
  • 1
  • 2
  • 16
0

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
bovine
  • 5,303
  • 2
  • 18
  • 17