Opened 6 years ago

Closed 6 years ago

#2761 closed defect (fixed)

RTSP DESCRIBE without a User-Agent causes some IP Cameras to close the connection

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

Description

Summary of the bug:

When connecting via RTSP, the IP Cam IcyBox? IB-CAM2002 closes the connection when ffmpeg sends a DESCRIBE without a User-Agent. This causes issues with CCTV software such as ZoneMinder? that use ffmpeg.

How to reproduce:

% ffprobe.exe rtsp://192.168.0.220:554/stream1/ 

I can provide access to devs if needed, although problem seems straightforward.

Attachments (3)

wireshark.png (44.6 KB) - added by imavra 6 years ago.
Wireshark captures packets
patchrtspuseragent.diff (613 bytes) - added by cehoyos 6 years ago.
patchrtspuseragent2.diff (2.2 KB) - added by cehoyos 6 years ago.

Download all attachments as: .zip

Change History (12)

Changed 6 years ago by imavra

Wireshark captures packets

comment:1 Changed 6 years ago by imavra

FFMPEG:

OPTIONS rtsp://192.168.0.220:554/stream1/ RTSP/1.0
CSeq: 1

DESCRIBE rtsp://192.168.0.220:554/stream1/ RTSP/1.0
Accept: application/sdp
CSeq: 2

LibVLC:

OPTIONS rtsp://192.168.0.220:554/stream1/ RTSP/1.0
CSeq: 2
User-Agent: LibVLC/2.0.7 (LIVE555 Streaming Media v2012.12.18)

DESCRIBE rtsp://192.168.0.220:554/stream1/ RTSP/1.0
CSeq: 3
User-Agent: LibVLC/2.0.7 (LIVE555 Streaming Media v2012.12.18)
Accept: application/sdp

comment:2 Changed 6 years ago by cehoyos

Is the problem only reproducible with ffprobe or also with ffmpeg? (Please only report problems against ffprobe if they are not reproducible with another tool.)
Please provide the failing command line (ffmpeg -i rtsp://192.168.0.220:554/stream1/ together with the complete, uncut console output to make this a valid ticket.

comment:3 Changed 6 years ago by imavra

From windows:

D:\Stuff\bin>ffmpeg -i rtsp://192.168.0.220:554/stream1/
ffmpeg version N-54499-g63d7684 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jul  6 2013 10:30:06 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 11.101 / 55. 11.101
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 78.102 /  3. 78.102
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
rtsp://192.168.0.220:554/stream1/: Invalid data found when processing input

From ubuntu linux:

functor@ichigo:~$ ffmpeg -i rtsp://192.168.0.220:554/stream1/
ffmpeg version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
  built on Mar 30 2013 22:23:21 with gcc 4.7.2
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
rtsp://192.168.0.220:554/stream1/: Invalid data found when processing input

Same theme on other devices / versions I tried

As I mentioned, I re-injected the packets myself and if you add a User-Agent the camera doesn't close the connection after "DESCRIBE"

Thanks

Last edited 6 years ago by cehoyos (previous) (diff)

comment:4 Changed 6 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Keywords rtsp added
  • Status changed from new to open
  • Version changed from unspecified to git-master

Unrelated: You may want to read http://blog.pkh.me/p/13-the-ffmpeg-libav-situation.html to learn more about the intentionally broken version of FFmpeg that you tested on Ubuntu.

comment:5 Changed 6 years ago by cehoyos

Please test attached patch (completely untested).

Changed 6 years ago by cehoyos

comment:6 Changed 6 years ago by imavra

Yep the patch works!

Example of avprobe (technically the same patch would work here):

functor@ichigo:~/bin$ ffprobe rtsp://192.168.0.220:554/stream1/
avprobe version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2007-2013 the Libav developers
  built on Mar 30 2013 22:23:21 with gcc 4.7.2
rtsp://192.168.0.220:554/stream1/: Invalid data found when processing input

Example of ffmpeg with your patch:

functor@ichigo:~/bin$ ./ffprobe rtsp://192.168.0.220:554/stream1/
ffprobe version git-2013-07-09-c5a1b18 Copyright (c) 2007-2013 the FFmpeg developers
  built on Jul  9 2013 18:42:27 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --prefix=/home/functor/ffmpeg_build --extra-cflags=-I/home/functor/ffmpeg_build/include --extra-ldflags=-L/home/functor/ffmpeg_build/lib --bindir=/home/functor/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 11.101 / 55. 11.101
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 79.101 /  3. 79.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, rtsp, from 'rtsp://192.168.0.220:554/stream1/':
  Metadata:
    title           : Test
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuv420p, 1280x1024, 90k tbr, 90k tbn, 180k tbc

Changed 6 years ago by cehoyos

comment:7 Changed 6 years ago by cehoyos

Thank you!
Could you also test the new version of the patch that allows to specify a custom user-agent? (It should still work if you do not specify anything.)

comment:8 Changed 6 years ago by imavra

Works! Both default and not. Thanks!

functor@ichigo:~/bin$ ./ffprobe -user-agent tst rtsp://192.168.0.220:554/stream1/
ffprobe version git-2013-07-09-c5a1b18 Copyright (c) 2007-2013 the FFmpeg developers
  built on Jul 11 2013 12:32:50 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --prefix=/home/functor/ffmpeg_build --extra-cflags=-I/home/functor/ffmpeg_build/include --extra-ldflags=-L/home/functor/ffmpeg_build/lib --bindir=/home/functor/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 11.101 / 55. 11.101
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 79.101 /  3. 79.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, rtsp, from 'rtsp://192.168.0.220:554/stream1/':
  Metadata:
    title           : Test
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuv420p, 1280x1024, 90k tbr, 90k tbn, 180k tbc
DESCRIBE rtsp://192.168.0.220:554/stream1/ RTSP/1.0
Accept: application/sdp
User-Agent: tst
CSeq: 2
functor@ichigo:~/bin$ ./ffprobe rtsp://192.168.0.220:554/stream1/
ffprobe version git-2013-07-09-c5a1b18 Copyright (c) 2007-2013 the FFmpeg developers
  built on Jul 11 2013 12:32:50 with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --prefix=/home/functor/ffmpeg_build --extra-cflags=-I/home/functor/ffmpeg_build/include --extra-ldflags=-L/home/functor/ffmpeg_build/lib --bindir=/home/functor/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 11.101 / 55. 11.101
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 79.101 /  3. 79.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, rtsp, from 'rtsp://192.168.0.220:554/stream1/':
  Metadata:
    title           : Test
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuv420p, 1280x1024, 90k tbr, 90k tbn, 180k tbc
DESCRIBE rtsp://192.168.0.220:554/stream1/ RTSP/1.0
Accept: application/sdp
User-Agent: Lavf/55.11.101
CSeq: 2

comment:9 Changed 6 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

The second patch was merged, thank you for reporting, analyzing and testing!

Note: See TracTickets for help on using tickets.