Opened 6 years ago

Closed 5 years ago

#7297 closed defect (fixed)

RTSP over HTTP does not work (with some devices) since v2.0.7

Reported by: RafaG Owned by:
Priority: important Component: avformat
Version: git-master Keywords: rtsp regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I want to capture from AXIS IP Camera using RTSP over HTTP.
Older models (I guess with different RTSP server) work, but with newer models it only works on versions <= 2.0.7. I tried with every newer version always getting error "Input/output error".
It seems to connect but it stalls and after a while throws the error.
Tested with different new cameras with same results.
VLC works on all of them.

How to reproduce:

Working example of output with 2.0.7:

ffmpeg-2.0.7$ ./ffmpeg -debug 100 -rtsp_transport http -i "rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp" -codec copy -y /tmp/test.mkv
ffmpeg version 2.0.7 Copyright (c) 2000-2015 the FFmpeg developers

built on Jul 4 2018 15:34:36 with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration:
libavutil 52. 38.100 / 52. 38.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.100 / 55. 12.100
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 79.101 / 3. 79.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102

matched as AVOption 'debug' with argument '100'.

Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'http'.
Reading option '-i' ... matched as input file with argument 'rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp'.
Reading option '-codec' ... matched as option 'codec' (codec name) with argument 'copy'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '/tmp/test.mkv' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp.
Successfully parsed a group of options.
Opening an input file: rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp.
[rtsp @ 0x5556db7a0f00] SDP:
v=0
o=- 10989952236607861289 1 IN IP4 192.168.0.77
s=Session streamed with GStreamer
i=rtsp-server
t=0 0
a=tool:GStreamer
a=type:broadcast
a=range:npt=now-
a=control:rtsp://192.168.0.77:80/axis-media/media.amp
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:50000
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=4d0029;sprop-parameter-sets=Z00AKeKQFAX/LgLcBAQGkHiRFQ==,aO48gA==
a=control:rtsp://192.168.0.77:80/axis-media/media.amp/stream=0
a=framerate:60.000000
a=transform:1.000000,0.000000,0.000000;0.000000,1.000000,0.000000;0.000000,0.000000,1.000000

[rtsp @ 0x5556db7a0f00] video codec set to: h264
[NULL @ 0x5556db7a8f80] RTP Packetization Mode: 1
[NULL @ 0x5556db7a8f80] RTP Profile IDC: 4d Profile IOP: 0 Level: 29
[NULL @ 0x5556db7a8f80] Extradata set to 0x5556db7a8400 (size: 31)!
[rtsp @ 0x5556db7a0f00] hello state=0
[rtsp @ 0x5556db7a0f00] All info found
rfps: 59.750000 0.014718
rfps: 59.833333 0.006515

Last message repeated 1 times

rfps: 59.916667 0.001610

Last message repeated 1 times

rfps: 60.000000 0.000000

Last message repeated 1 times

rfps: 59.940060 0.000825

Last message repeated 1 times

Input #0, rtsp, from 'rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp':

Metadata:

title : Session streamed with GStreamer
comment : rtsp-server

Duration: N/A, start: 0.033344, bitrate: N/A

Stream #0:0, 28, 1/90000: Video: h264 (Main), yuvj420p, 640x360 [SAR 1:1 DAR 16:9], 1/180000, 60 tbr, 90k tbn, 180k tbc

Successfully opened the file.
Parsing a group of options: output file /tmp/test.mkv.
Applying option codec (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: /tmp/test.mkv.
Successfully opened the file.
Output #0, matroska, to '/tmp/test.mkv':

Metadata:

title : Session streamed with GStreamer
comment : rtsp-server
encoder : Lavf55.12.100
Stream #0:0, 0, 1/1000: Video: h264 (H264 / 0x34363248), yuvj420p, 640x360 [SAR 1:1 DAR 16:9], 1/90000, q=2-31, 1k tbn, 90k tbc

Stream mapping:

Stream #0:0 -> #0:0 (copy)

Press [q] to stop, ? for help
[matroska @ 0x5556db7a9ba0] Writing block at offset 642, size 19604, pts 0, dts 0, duration 0, flags 128
[matroska @ 0x5556db7a9ba0] Writing block at offset 20254, size 2098, pts 0, dts 0, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 22359, size 453, pts 50, dts 50, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 22819, size 272, pts 100, dts 100, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 23098, size 303, pts 250, dts 250, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 23408, size 1836, pts 317, dts 317, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 25251, size 1636, pts 400, dts 400, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 26894, size 305, pts 450, dts 450, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 27206, size 2210, pts 583, dts 583, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 29423, size 2145, pts 717, dts 717, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 31575, size 2037, pts 783, dts 783, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 33619, size 1899, pts 817, dts 817, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 35525, size 359, pts 867, dts 867, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 35891, size 256, pts 917, dts 917, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 36154, size 2038, pts 1033, dts 1033, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 38199, size 15803, pts 1367, dts 1367, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 54009, size 5894, pts 1433, dts 1433, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 59910, size 770, pts 1533, dts 1533, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 60687, size 2478, pts 1667, dts 1667, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 63172, size 474, pts 1717, dts 1717, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 63653, size 3049, pts 1750, dts 1750, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 66709, size 545, pts 1800, dts 1800, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 67261, size 2958, pts 1833, dts 1833, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 70226, size 2768, pts 1850, dts 1850, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 73001, size 2772, pts 1867, dts 1867, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 75780, size 2487, pts 1950, dts 1950, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 78274, size 436, pts 2000, dts 2000, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 78717, size 2688, pts 2117, dts 2117, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 81412, size 408, pts 2167, dts 2167, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 81827, size 13288, pts 2217, dts 2217, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 95122, size 3019, pts 2267, dts 2267, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 98148, size 4228, pts 2333, dts 2333, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 102383, size 607, pts 2383, dts 2383, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 102997, size 3412, pts 2417, dts 2417, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 106416, size 3512, pts 2483, dts 2483, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 109935, size 490, pts 2533, dts 2533, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 110432, size 409, pts 2583, dts 2583, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 110848, size 343, pts 2633, dts 2633, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 111198, size 279, pts 2683, dts 2683, duration 0, flags 0
Writing block at offset 111484, size 272, pts 2733, dts 2733, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 111763, size 205, pts 2783, dts 2783, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 111975, size 270, pts 2833, dts 2833, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 112252, size 233, pts 2883, dts 2883, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 112492, size 252, pts 2933, dts 2933, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 112751, size 224, pts 2983, dts 2983, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 112982, size 257, pts 3033, dts 3033, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 113246, size 201, pts 3083, dts 3083, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 113454, size 205, pts 3133, dts 3133, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 113666, size 206, pts 3183, dts 3183, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 113879, size 223, pts 3233, dts 3233, duration 0, flags 0
Writing block at offset 114109, size 3710, pts 3300, dts 3300, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 117826, size 555, pts 3350, dts 3350, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 118388, size 398, pts 3400, dts 3400, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] Writing block at offset 118793, size 351, pts 3450, dts 3450, duration 0, flags 0
[matroska @ 0x5556db7a9ba0] end duration = 3450
frame= 54 fps= 44 q=-1.0 Lsize= 116kB time=00:00:03.45 bitrate= 276.4kbits/s
video:115kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.886312%
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x5556db929ac0] Statistics: 24 seeks, 72 writeouts

NOT WORKING example of output with 2.1.8:

ffmpeg-2.1.8$ ./ffmpeg -debug 100 -rtsp_transport http -i "rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp" -codec copy -y /tmp/test.mkv
ffmpeg version 2.1.8 Copyright (c) 2000-2015 the FFmpeg developers

built on Jul 4 2018 15:34:14 with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration:
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104

matched as AVOption 'debug' with argument '100'.

Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'http'.
Reading option '-i' ... matched as input file with argument 'rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp'.
Reading option '-codec' ... matched as option 'codec' (codec name) with argument 'copy'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '/tmp/test.mkv' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp.
Successfully parsed a group of options.
Opening an input file: rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp.
rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp: Input/output error

Any ideas?
Thank you

Change History (4)

comment:1 by RafaG, 6 years ago

Another not working output:

ffmpeg-2.2.16$ ./ffmpeg -debug 100 -rtsp_transport http -i "rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp" -codec copy -y /tmp/test.mkv
ffmpeg version 2.2.16 Copyright (c) 2000-2015 the FFmpeg developers

built on Jul 4 2018 15:32:58 with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration:
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100

matched as AVOption 'debug' with argument '100'.

Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'http'.
Reading option '-i' ... matched as input file with argument 'rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp'.
Reading option '-codec' ... matched as option 'codec' (codec name) with argument 'copy'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '/tmp/test.mkv' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp.
Successfully parsed a group of options.
Opening an input file: rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp.
[http @ 0x559195831d20] request: GET /axis-media/media.amp HTTP/1.1
User-Agent: Lavf/55.33.100
Range: bytes=0-
Connection: close
Host: 192.168.0.77:80
x-sessioncookie: a97334b03b812835
Accept: application/x-rtsp-tunnelled
Pragma: no-cache
Cache-Control: no-cache

[http @ 0x559195831d20] header='HTTP/1.0 200 OK'
[http @ 0x559195831d20] http_code=200
[http @ 0x559195831d20] header='Server: GStreamer RTSP Server'
[http @ 0x559195831d20] header='Connection: close'
[http @ 0x559195831d20] header='Cache-Control: no-store'
[http @ 0x559195831d20] header='Pragma: no-cache'
[http @ 0x559195831d20] header='X-Server-IP-Address: 192.168.0.77'
[http @ 0x559195831d20] header='Content-Type: application/x-rtsp-tunnelled'
[http @ 0x559195831d20] header='Date: Wed, 04 Jul 2018 13:57:49 GMT'
[http @ 0x559195831d20] header=
[http @ 0x559195833780] request: POST /axis-media/media.amp HTTP/1.1
User-Agent: Lavf/55.33.100
Accept: */*
Expect: 100-continue
Connection: close
Host: 192.168.0.77:80
x-sessioncookie: a97334b03b812835
Content-Type: application/x-rtsp-tunnelled
Pragma: no-cache
Cache-Control: no-cache
Content-Length: 32767
Expires: Sun, 9 Jan 1972 00:00:00 GMT

rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp: Input/output error
Conversion failed!

And yet another one with latest version:

ffmpeg-4.0.1$ ./ffmpeg -debug 100 -rtsp_transport http -i "rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp" -codec copy -y /tmp/test.mkv
ffmpeg version 4.0.1 Copyright (c) 2000-2018 the FFmpeg developers

built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-shared --enable-pic --disable-doc --enable-ffplay --enable-gpl --enable-nonfree --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libvpx --extra-ldflags='-Wl,-rpath,. -Wl,-rpath,../lib/'
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100

matched as AVOption 'debug' with argument '100'.

Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'http'.
Reading option '-i' ... matched as input url with argument 'rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp'.
Reading option '-codec' ... matched as option 'codec' (codec name) with argument 'copy'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '/tmp/test.mkv' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp.
Successfully parsed a group of options.
Opening an input file: rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp.
[http @ 0x564ee4a48440] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[http @ 0x564ee4a48440] request: GET /axis-media/media.amp HTTP/1.1
User-Agent: Lavf/58.12.100
Range: bytes=0-
Connection: close
Host: 192.168.0.77:80
Icy-MetaData: 1
x-sessioncookie: 46fffc1559edd18e
Accept: application/x-rtsp-tunnelled
Pragma: no-cache
Cache-Control: no-cache

[http @ 0x564ee4a4a400] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
[http @ 0x564ee4a4a400] request: POST /axis-media/media.amp HTTP/1.1
User-Agent: Lavf/58.12.100
Accept: */*
Expect: 100-continue
Connection: close
Host: 192.168.0.77:80
Icy-MetaData: 1
x-sessioncookie: 46fffc1559edd18e
Content-Type: application/x-rtsp-tunnelled
Pragma: no-cache
Cache-Control: no-cache
Content-Length: 32767
Expires: Sun, 9 Jan 1972 00:00:00 GMT

rtsp://root:camera84@192.168.0.77:80/axis-media/media.amp: Input/output error

comment:2 by Carl Eugen Hoyos, 6 years ago

Keywords: rtsp regression added

Please use git bisect to find the change introducing the issue you see.

comment:3 by RafaG, 6 years ago

Done!

$ git bisect good
6b1b63df85ffa020bb36ac8d444a83b755a1d86d is the first bad commit

comment:4 by Carl Eugen Hoyos, 5 years ago

Component: undeterminedavformat
Priority: normalimportant
Resolution: fixed
Status: newclosed
Version: unspecifiedgit-master
Note: See TracTickets for help on using tickets.