Opened 9 years ago

Closed 9 months ago

#1941 closed defect (fixed)

unable to receive RTSP stream from VLC

Reported by: Roger Pack Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: rtsp
Cc: ffmpeg@codywohlers.ca Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug: $title
How to reproduce:

# in one terminal:

$ vlc sintel.mpg
":sout=#transcode{vcodec=h264,vb=300,scale=0.25,acodec=mp4a,ab=128,channels=2,samplerate=22050}:rtp{mux=ts,sdp=rtsp://:8554/test.sdp}"

$ ffmpeg -i rtsp://localhost:8554/test.sdp
ffmpeg version N-43576-gaee7b88 Copyright (c) 2000-2012 the FFmpeg developers
  built on Aug 15 2012 11:12:55 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-gpl --enable-libx264 --disable-stripping
  libavutil      51. 69.100 / 51. 69.100
  libavcodec     54. 52.100 / 54. 52.100
  libavformat    54. 23.100 / 54. 23.100
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3.  9.100 /  3.  9.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[rtsp @ 0x9505500] method SETUP failed: 459 Aggregate operation not allowed


Of course, I'm not sure if it's a VLC or ffmpeg bug, but at least it's reproducible.

Change History (13)

comment:1 by Carl Eugen Hoyos, 9 years ago

Keywords: rtsp added
Version: unspecifiedgit-master

Is MPlayer (or any other application) able to receive the stream?

comment:2 by Roger Pack, 9 years ago

unfortunately mplayer responds with

rtsp_session: unsupported RTSP server. Server type is 'VLC/2.0.4'.

then rejects it. odd.

comment:3 by Carl Eugen Hoyos, 9 years ago

Is that with or without live555 support in MPlayer?

comment:4 by Roger Pack, 9 years ago

ok, with live555 it seems to sometimes work...after a long pause/delay it started playing it at least once, other times it doesn't work https://gist.github.com/4128685.

$ mplayer.exe  rtsp://localhost:8554/test.sdp
MPlayer Sherpya-SVN-r34401-4.6.2 (C) 2000-2011 MPlayer Team

Playing rtsp://localhost:8554/test.sdp.
Resolving localhost for AF_INET...
Connecting to server localhost[127.0.0.1]: 8554...

rtsp: warning: setting NEW session: 338e96a07fc33214;timeout=60;timeout=60
Timeout! No data from host 0.0.0.0
rtsp_session: unsupported RTSP server. Server type is 'VLC/2.0.4'.
STREAM_LIVE555, URL: rtsp://localhost:8554/test.sdp
Stream not seekable!
 file format detected.
Initiated "video/MP2T" RTP subsession on port 49496
Stream url is not set!
TS file format detected.
VIDEO H264(pid=68) NO AUDIO! (try increasing -tsprobe) NO SUBS (yet)!  PROGRAM N. 1
BUG! Invalid demuxer type in new_demuxer(), big troubles ahead.FPS seems to be: 29.970030
<vo_directx><ERROR>Your card doesn't support overlay
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Audio: no sound
Starting playback...
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Unsupported PixelFormat 81
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
[swscaler @ 01377ea0]using unscaled yuv420p -> bgra special converter
VO: [directx] 176x118 => 210x118 BGRA
V:26526.3 244/244  1%  1%  0.0% 0 0

Exiting... (Quit)

comment:5 by jyavenard, 7 years ago

is there any progress on this?

using master as of today, still yield:

ffplay version N-62951-g3316556 Copyright (c) 2003-2014 the FFmpeg developers
  built on May  4 2014 16:31:04 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  configuration: 
  libavutil      52. 81.100 / 52. 81.100
  libavcodec     55. 60.103 / 55. 60.103
  libavformat    55. 37.102 / 55. 37.102
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
[rtsp @ 0x7ff70a809e00] method SETUP failed: 459 Aggregate operation not allowed
rtsp://127.0.0.1:5554/test: Invalid data found when processing input

comment:6 by codywohlers, 3 years ago

Cc: ffmpeg@codywohlers.ca added

I still get this too

$ ffplay -v debug rtsp://server:8554/
ffplay version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2003-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Initialized opengl renderer.
[tcp @ 0x7f66a4002ea0] No default whitelist set
[rtsp @ 0x7f66a4000b80] SDP:aq=    0KB vq=    0KB sq=    0B f=0/0   
v=0
o=- 16137773033285955342 16137773033285955342 IN IP4 server
s=Unnamed
i=N/A
c=IN IP4 0.0.0.0
t=0 0
a=tool:vlc 3.0.4
a=recvonly
a=type:broadcast
a=charset:UTF-8
a=control:rtsp://192.168.1.100:8554/
m=video 0 RTP/AVP 33
b=RR:0
a=rtpmap:33 MP2T/90000
a=control:rtsp://192.168.1.100:8554/trackID=0

[rtp @ 0x7f66a4004280] No default whitelist set
[udp @ 0x7f66a401b700] No default whitelist set
[udp @ 0x7f66a401b700] end receive buffer size reported is 131072
[udp @ 0x7f66a402bcc0] No default whitelist set
[udp @ 0x7f66a402bcc0] end receive buffer size reported is 131072
[rtsp @ 0x7f66a4000b80] method SETUP failed: 459 Client error=0/0   
[rtsp @ 0x7f66a4000b80] Server: VLC/3.0.4
Date: Fri, 25 Jan 2019 01:21:22 GMT
Content-Length: 0
Cache-Control: no-cache
Cseq: 3

rtsp://server:8554/: Server returned 4XX Client Error, but not one of 40{0,1,3,4}

comment:7 by codywohlers, 3 years ago

the same stream works on the same client using VLC, totem, and gst-play-1.0

comment:8 by Carl Eugen Hoyos, 3 years ago

Component: undeterminedavformat
Reproduced by developer: set

comment:9 by tpol, 2 years ago

It looks like FFmpeg incorrectly parses the SDP information in case of MPEG-2 transport stream.

When payload type is 33, it uses the Session control url instead of the Media control url in RTSP SETUP request.

a=control:rtsp://..:8554/
vs
a=control:rtsp://..:8554/trackID=0

I was able to receive the stream with the following fix:

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c153cac..b8c7128 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -541,7 +541,7 @@
         break;
     case 'a':
         if (av_strstart(p, "control:", &p)) {
-            if (s->nb_streams == 0) {
+            if (rt->nb_rtsp_streams == 0) {
                 if (!strncmp(p, "rtsp://", 7))

comment:10 by Farley Lai, 18 months ago

With the latest pyAV installed through conda which uses ffmpeg 4.2.2, the same RTSP SETUP error is shown as indicated in the above comments when accessing the RTSP media stream hosted by VLC.
What is the exact reason or concern for not fixing this issue for years?

Last edited 18 months ago by Farley Lai (previous) (diff)

comment:11 by Jason J. Kushmaul, 10 months ago

Possibly necro - but I too found myself in this exact situation and it was very frustrating.

While it seems like ffmpeg is just inflexible on this issue, I found an additional related ticket in the opposite, where ffmpeg is the server: https://trac.ffmpeg.org/ticket/3533?cversion=0 (wont fix) The reasoning was Obi-wan like, in that "This isn't the mux you are looking for" - so while it appears that VLC can handle that, just fine, ffmpeg not only does not, but will not. To each their own.

I was able to overcome this issue by removing the vlc mux option from the rtp block:
`
vlc sintel.mpg
":sout=#transcode{vcodec=h264,vb=300,scale=0.25,acodec=mp4a,ab=128,channels=2,samplerate=22050}:rtp{sdp=rtsp://:8554/test.sdp}"
`
I tested this on my own stream where before it reproduced the issue, and after, did not.

Once I removed mux, I saw the payload type 33 replaced, and ffmpeg was able to pull the tracks.

comment:12 by Andriy Gelman, 9 months ago

Resolution: fixed
Status: newclosed

comment:13 by Andriy Gelman, 9 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.