[FFmpeg-user] ffserver memory consumption

ota sverma ota.sverma at gmail.com
Thu Feb 13 13:23:54 CET 2014

i am streaming video from multicast stream with ffmpeg to ffserver and 
finaly to http using webm(libvpx). Meantime i am saving this stream from 
ffserver into segment using ffmpeg.
My problem is continuos memory consumption when i start saveing stream 
or when some client is connected to ffserver.
If a stop saveing or all clients are disconnected, memory consumption is 
stoped but don`t free used memory.
In two days is all free memory (16gb ram) used by ffserver and linux 
kill ffserver by signal segfault.
Ffserver eats memory from start very quickly, but it is buffered memory. 
That is ok becouse a i can drop cache. But problem is pernamently 
allocated memory which is growing and can not be released.
I am streaming about 12 streams and memory is growing by 40-100KByte/s.

How can i solve this problem? I must stream all videos continuosly 
24/7/365 but now i must stop ffserver once or twice in two days and 
start him again from scratch for releasing memory. So i lose same parts 
of video in my video archiv...

actual version of ffmpeg i use: 2.1.3 (i also tried: 2.0.3, 1.1.8, 
1.0.8, 0.9.3,...)
actual version of libvpx: 1.3.0 (tried: 1.2.0, 1.1.0, 1.0.0, 0.9.0,...)
system: ubuntu server 13.10
cpu: 2 x opteron quadcore
ram: 16gb

precompilation setting of ffserver:
  ./configure --enable-gpl --enable-libfaac --enable-libmp3lame 
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp 
--enable-libtheora --enable-libvorbis --enable-libvpx  --enable-nonfree 

ffserver.conf default setting and setting of one stream(rest 11 are same):

port 8080
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 10000000
CustomLog -

<Feed ct1.ffm>
     File /tmp/ct1.ffm
     FileMaxSize 100K
     ACL allow

<Stream ct1.webm>

     Format webm
     Feed ct1.ffm

     VideoCodec libvpx
     VideoFrameRate 24
     VideoBitRate 1150
     VideoSize 400x224
     VideoBufferSize 1024
     AVOptionVideo flags +global_header
     AVOptionVideo map 0:0
     AudioCodec vorbis
     AudioBitRate 64K
     AVOptionAudio flags +global_header


how i use ffmpeg from multicast to ffserver:
ffmpeg -i  udp://x.x.x.x:5004 http://localhost:8080/ct1.ffm

saving stream from ffserver by ffmpeg:
ffmpeg -i http://localhost:8080/ct1.webm -acodec copy -vcodec copy -map 
0 -ss `date +%s` -f segment -segment_time 60 -segment_list /dev/null 
-reset_timestamps 1 -segment_format vpx /my/path/`date 
+%m%d%y%H%M%S`-%7d.webm -y

Thank you very much
Ota Sverma

More information about the ffmpeg-user mailing list