Opened 5 years ago

Last modified 5 years ago

#346 new defect

FFserver passing on rtp stream freezes

Reported by: schanda Owned by: baptiste
Priority: normal Component: ffserver
Version: git Keywords: stream error
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I have the following situation:

FFserver on Host 1, which takes input from FFmpeg and offers an rtp stream. Config is reproduced below under the heading mainserver.conf.
FFmpeg is invoked as ffmpeg -i inputfile http://127.0.0.1:8090/f.ffm on this computer.

FFServer on Host 2 (can be the same one for testing purposes, effect is the same) which reads the stream from FFserver on Host 1 and offers it again. Config file is reproduced below under the heading ffserver.conf.

I start both servers with ffserver -d -f config_file.

When watching the stream offered by FFserver on Host 2 it aborts after a few seconds. This happens regardless of whether I watch from the same or a different computer, and also regardless of whether the two ffservers are run from the same or different hosts. The time it takes to abort is always exactly the same, with the same video and settings. For example with these configs and this input video it's always 4.5 seconds.

The effect is independent of which player is used, vlc, mplayer, ffplay all show the same result, the stream freezes.

Watching the stream offered by Host 1 directly works fine.

FFplay reports no error when this happens, the video simply freezes. The counter / timer on the console continues to increase though.

mainserver.conf

Port 8090
RTSPPort 8554
BindAddress 0.0.0.0
MaxHTTPConnections 1000
MaxClients 200
MaxBandwidth 10000
CustomLog -

<Feed f.ffm>
File /tmp/f.ffm
FileMaxSize 2000M
</Feed>


<Stream 1.sdp>
Format rtp
Feed f.ffm

NoLoop
VideoCodec libx264
VideoFrameRate 24
VideoBitRate 400
VideoSize 640x368
# AVPresetVideo default
AVPresetVideo medium
# AVPresetVideo libx264-ultrafast
# AVOptionVideo flags +global_header
NoAudio
VideoBufferSize 500
VideoGopSize 5
AVOptionVideo flags  global_header vpre hq crf 15 maxrate 400k

</Stream>

<Stream stat.html>
Format status
</Stream>

ffserver.conf

Port 8091
RTSPPort 8555
BindAddress 0.0.0.0
MaxHTTPConnections 10
MaxClients 5
MaxBandwidth 10000
CustomLog -

<Stream 1.sdp>
Format rtp
File "rtsp://127.0.0.1:8554/1.sdp?tcp"
</Stream>

<Stream stat.html>
Format status
</Stream>

Log of FFserver on Host 2

ffserver version 0.7, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jul  6 2011 11:29:30 with gcc 4.6.0 20110530 (Red Hat 4.6.0-9)
  configuration: --enable-gpl --enable-libx264 --enable-static --disable-shared --extra-cflags='-Lx264/lib/ -Ix264/inc' --extra-ldflags='-Lx264/lib/ -Ix264/inc/.'
  libavutil    51. 11. 0 / 51. 11. 0
  libavcodec   53.  7. 0 / 53.  7. 0
  libavformat  53.  5. 0 / 53.  5. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 24. 3 /  2. 24. 3
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Wed Jul 13 15:59:34 2011 Opening file 'rtsp://127.0.0.1:8554/1.sdp?tcp'
Wed Jul 13 15:59:34 2011 [rtsp @ 0x25ec740]SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Title
c=IN IP4 0.0.0.0
t=0 0
a=tool:libavformat 53.5.0
m=video 0 RTP/AVP 96
b=AS:400
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=64001F;packetization-mode=1; sprop-parameter-sets=Z2QAH6zZQKAvsBEAAAMAkgAANrIPGDGW,aOvssiw=
a=control:streamid=0

Wed Jul 13 15:59:34 2011 [rtsp @ 0x25ec740]video codec set to: h264
Wed Jul 13 15:59:34 2011 [NULL @ 0x25f0600]RTP Profile IDC: 64 Profile IOP: 0 Level: 1f
Wed Jul 13 15:59:34 2011 [NULL @ 0x25f0600]RTP Packetization Mode: 1
Wed Jul 13 15:59:34 2011 [NULL @ 0x25f0600]Extradata set to 0x25ec000 (size: 35)!hello state=0
Wed Jul 13 15:59:34 2011 [h264 @ 0x25f0600]Unsupported bit depth: 0
Wed Jul 13 15:59:34 2011 [h264 @ 0x25f0600]Missing reference picture
Wed Jul 13 15:59:34 2011 [h264 @ 0x25f0600]decode_slice_header error
Wed Jul 13 15:59:34 2011 [h264 @ 0x25f0600]concealing 920 DC, 920 AC, 920 MV errors
Wed Jul 13 15:59:34 2011 [h264 @ 0x25f0600]no picture
Wed Jul 13 15:59:34 2011 [h264 @ 0x25f0600]no picture
Wed Jul 13 15:59:35 2011 [rtsp @ 0x25ec740]All info found
Wed Jul 13 15:59:35 2011 [rtsp @ 0x25ec740]Estimating duration from bitrate, this may be inaccurate
Wed Jul 13 15:59:35 2011 FFserver started.
Wed Jul 13 15:59:40 2011 127.0.0.1 - - [DESCRIBE] "rtsp://127.0.0.1:8555/1.sdp RTSP/1.0" 200 529
Wed Jul 13 15:59:40 2011 [rtsp @ 0x25f0600]SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Title
c=IN IP4 0.0.0.0
t=0 0
a=tool:libavformat 53.5.0
m=video 0 RTP/AVP 96
b=AS:400
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=64001F;packetization-mode=1; sprop-parameter-sets=Z2QAH6zZQKAvsBEAAAMAkgAANrIPGDGW,aOvssiw=
a=control:streamid=0

Wed Jul 13 15:59:40 2011 [rtsp @ 0x25f0600]video codec set to: h264
Wed Jul 13 15:59:40 2011 [NULL @ 0x2717040]RTP Profile IDC: 64 Profile IOP: 0 Level: 1f
Wed Jul 13 15:59:40 2011 [NULL @ 0x2717040]RTP Packetization Mode: 1
Wed Jul 13 15:59:40 2011 [NULL @ 0x2717040]Extradata set to 0x25ec000 (size: 35)!hello state=0
Wed Jul 13 15:59:40 2011 [h264 @ 0x2717040]Unsupported bit depth: 0
Wed Jul 13 15:59:40 2011 [h264 @ 0x2717040]Frame num gap 3 0
Wed Jul 13 15:59:40 2011 [h264 @ 0x2717040]Frame num gap 3 1
Wed Jul 13 15:59:40 2011 [h264 @ 0x2717040]reference picture missing during reorder
Wed Jul 13 15:59:40 2011 [h264 @ 0x2717040]Missing reference picture
Wed Jul 13 15:59:40 2011 [h264 @ 0x2717040]no picture
Wed Jul 13 15:59:40 2011 [h264 @ 0x2717040]no picture
Wed Jul 13 15:59:41 2011 [rtsp @ 0x25f0600]All info found
Wed Jul 13 15:59:41 2011 [rtsp @ 0x25f0600]Estimating duration from bitrate, this may be inaccurate
Wed Jul 13 15:59:41 2011 [rtsp @ 0x25f0600]hello state=3
Wed Jul 13 15:59:41 2011 127.0.0.1:60088 - - "PLAY 1.sdp/streamid=0 RTP/UDP"
Wed Jul 13 15:59:41 2011 [rtp @ 0x2715940]Sending NAL 1 of len 304 M=1
Wed Jul 13 15:59:41 2011 [rtp @ 0x2715940]Sending NAL 1 of len 51 M=1
Wed Jul 13 15:59:41 2011 [rtp @ 0x2715940]Sending NAL 5 of len 12195 M=1
Wed Jul 13 15:59:41 2011 [rtp @ 0x2715940]NAL size 12195 > 1460
Wed Jul 13 15:59:41 2011 [rtp @ 0x2715940]Sending NAL 1 of len 62 M=1
Wed Jul 13 15:59:41 2011 [rtp @ 0x2715940]Sending NAL 1 of len 174 M=1
Wed Jul 13 15:59:41 2011 [rtp @ 0x2715940]Sending NAL 1 of len 28 M=1
Wed Jul 13 15:59:41 2011 [rtp @ 0x2715940]Sending NAL 1 of len 176 M=1
Wed Jul 13 15:59:41 2011 [rtp @ 0x2715940]Sending NAL 5 of len 11706 M=1

...
Lots more like this
...


Wed Jul 13 15:59:50 2011 [rtp @ 0x2715940]NAL size 5433 > 1460
Wed Jul 13 15:59:50 2011 [rtp @ 0x2715940]Sending NAL 1 of len 91 M=1

Attachments (2)

ffserver_buf_size.diff (828 bytes) - added by thunder.m 5 years ago.
Patch for ffserver clients freezing after one minute.
0001-ffserver-fix-missing-buffer-set.patch (1.3 KB) - added by thunder.m 5 years ago.
Signed patch

Download all attachments as: .zip

Change History (10)

comment:1 Changed 5 years ago by thunder.m

I have same probleme here with format .flv or rtp, did you found any possible solution? Everything works with version 0.6.2 (May 2011)

Version 0, edited 5 years ago by thunder.m (next)

comment:2 Changed 5 years ago by thunder.m

I have done some regresion testing:

ffmpeg 0.6.3 - works
ffmpeg 0.7.0rc1 - works
ffmpeg 0.7.0 - no
ffmpeg 0.7.7 - no
ffmpeg 0.8.6 - no

I will try to find problematic code.

-update-

Last working commit is: 2011-06-16_Kirill Zorin_mmsh: fix 400 bad request

After that commit is broken by Anton Khirnov patches.

Last edited 5 years ago by thunder.m (previous) (diff)

comment:3 Changed 5 years ago by thunder.m

Ok, i have found problematic patch:

From: Anton Khirnov <anton@khirnov.net>
Date: Sat, 4 Jun 2011 15:36:30 +0000 (+0200)
Subject: Deprecate av_open_input_* and remove their uses.
X-Git-Tag: n0.8~24^2~26
X-Git-Url: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff_plain;h=603b8bc2a109978c8499b06d2556f1433306eca7

This patch rewrite function "av_open_input_file", which was used to open rtsp stream, i am working on patch. It is not so easy as rever this patch, because there are many function which depeneds on this patch.

Last edited 5 years ago by thunder.m (previous) (diff)

Changed 5 years ago by thunder.m

Patch for ffserver clients freezing after one minute.

comment:4 Changed 5 years ago by thunder.m

After 2 days i finally write simple code to fix this issue, while rewriting functions "av_open_input_stream" and "av_open_input_file" to "avformat_open_input" Anton Khirnov forgot to add buf_size in ffserver needed for streaming. Simple patch above is the easiest solution i found, there are also another solutions but it needs more dirty code. Please apply this patch to ffmpeg, ffserver is broken more than 5 months!

Changed 5 years ago by thunder.m

Signed patch

comment:5 Changed 5 years ago by thunder.m

I also send patch to ffmpeg-devel list, so we have to wait :)

comment:6 follow-up: Changed 5 years ago by michael

Doesnt the buffer size need to be set before probing ?

comment:7 in reply to: ↑ 6 Changed 5 years ago by thunder.m

Replying to michael:

Doesnt the buffer size need to be set before probing ?

In previous code it was set right after avio_open function, but now it is not possible to get it to this place without completly rewrite too many lines of code depending on function avformat_open_input, or add extra parameter to objects.

In easy way it is not possible to put it before avformat_open_input, all calls of ffio_set_buf_size in patch can't be before because s->pb is not yet initialized.

So this is only easy solution, i was also trying to find function called before buffer set which depends on buffer and i didn't find any.

comment:8 Changed 5 years ago by michael

Ive applied the patch as nothing better was submitted but i still think that a solution that sets the buffer size earlier is better

Note: See TracTickets for help on using tickets.