Opened 9 years ago

Last modified 9 years ago

#2646 open defect

FFMPEG HTTP protocol not generation authorization line

Reported by: Roman Gaufman Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: http
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

I have an acti camera, I can send these headers to it to receive an MJPEG stream:

GET /cgi-bin/cmd/system?GET_STREAM HTTP/1.1
User-Agent: Mozilla/5.0 Lavf/55.8.102
Accept: */*
Host: 192.168.1.40
Connection: Close
Range: bytes=0-
Authorization: Basic YWRtaW46MTIzNDU2

However when I run:

ffmpeg -i "http://admin:123456@192.168.1.40/cgi-bin/cmd/system?GET_STREAM"

And capture what it sends with tcpdump, I see it sends these headers:

GET /cgi-bin/cmd/system?GET_STREAM HTTP/1.1
User-Agent: Mozilla/5.0 Lavf/55.8.102
Accept: */*
Range: bytes=0-
Connection: close
Host: 192.168.1.40

Notice there are identical except FFMPEG doesn't generate the Authorization line. Isn't it meant to?

I'm using ffmpeg version N-53816-g55121f3 compiled Jun 4 2013 on Ubuntu 13.04.

Change History (9)

in reply to:  description comment:1 by Carl Eugen Hoyos, 9 years ago

Component: FFmpegundetermined
Keywords: http added

Replying to hackeron:

ffmpeg -i "http://admin:123456@192.168.1.40/cgi-bin/cmd/system?GET_STREAM"

Do I understand correctly that you do not receive anything with this command?
Please provide the complete, uncut console output to make this a valid ticket.

comment:2 by Roman Gaufman, 9 years ago

Sure, here you go:

$ ffmpeg -i "http://admin:123456@192.168.1.40/cgi-bin/cmd/system?GET_STREAM"
ffmpeg version N-53816-g55121f3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun  4 2013 00:44:05 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --extra-ldflags=-ldl --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-version3
  libavutil      52. 34.100 / 52. 34.100
  libavcodec     55. 15.100 / 55. 15.100
  libavformat    55.  8.102 / 55.  8.102
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 74.101 /  3. 74.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[http @ 0x2ac75a0] HTTP error 401 Unauthorized
http://admin:123456@192.168.1.40/cgi-bin/cmd/system?GET_STREAM: Input/output error
Last edited 9 years ago by Carl Eugen Hoyos (previous) (diff)

comment:3 by Carl Eugen Hoyos, 9 years ago

Component: undeterminedavformat
Status: newopen

Consider adding the exact type of camera that needs this http header line.

comment:4 by Carl Eugen Hoyos, 9 years ago

Description: modified (diff)

comment:5 by Roman Gaufman, 9 years ago

The specific cameras I'm using are ACTi E32 and ACTi D71 but I'm guessing any camera that requires HTTP basic authorization will not work with FFMPEG at the moment.

comment:6 by Carl Eugen Hoyos, 9 years ago

HTTP basic authorization is supported by FFmpeg, if I understand the code correctly, 401 should make FFmpeg retry with authorization.

Do you have a possibility to make a camera visible to the internet?

comment:7 by Roman Gaufman, 9 years ago

I'm made the camera available over internet. To reproduce, please run: ffmpeg -i "http://admin:123456@proxy81.zanview.com/cgi-bin/cmd/system?GET_STREAM"

Then run: curl "http://admin:123456@proxy81.zanview.com/cgi-bin/cmd/system?GET_STREAM" >/dev/null to see it working :)

Last edited 9 years ago by Roman Gaufman (previous) (diff)

comment:8 by Carl Eugen Hoyos, 9 years ago

I unfortunately get a different error here:

$ ffmpeg -i "http://admin:123456@proxy81.zanview.com/cgi-bin/cmd/system?GET_STREAM"
ffmpeg version N-53877-g3554238 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun  6 2013 20:05:06 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 35.100 / 52. 35.100
  libavcodec     55. 15.100 / 55. 15.100
  libavformat    55.  8.102 / 55.  8.102
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 75.101 /  3. 75.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[http @ 0x31375a0] HTTP error 502 Bad Gateway
http://admin:123456@proxy81.zanview.com/cgi-bin/cmd/system?GET_STREAM: Input/output error

You could try with an older version or start debugging yourself: There is code in libavformat/http.c and libavformat/httpauth.c that should create the basic "Authorization:" line for the http header.

comment:9 by Roman Gaufman, 9 years ago

Sorry my bad! - closed the console by accident so the ssh tunnel died. I've put it in a screen session now so should be as expected now.

Note: See TracTickets for help on using tickets.