[FFmpeg-trac] #6204(ffmpeg:new): AAC-only hls stream slowly exceeds file descriptors

FFmpeg trac at avcodec.org
Tue Feb 28 15:07:11 EET 2017

#6204: AAC-only hls stream slowly exceeds file descriptors
             Reporter:  ncon         |                     Type:  defect
               Status:  new          |                 Priority:  important
            Component:  ffmpeg       |                  Version:  git-
             Keywords:  aac hls      |  master
  segments                           |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
 Summary of the bug:

 The hls muxer does not release the segment's file descriptors if there is
 only an audio-only stream. This happens regardless of the delete_segments
 flag or -re flag being set or not. Once ffmpeg runs out of avalable FD's,
 it terminates gracefully with the following output:

 Excerpt (full output included in file):
 [hls muxer @ 0x3a3d5a0] deleting old segment segment_128_0000000501.ts
 [file @ 0x59c0100] Setting default whitelist 'file,crypto'
 [file @ 0x5a85ba0] Setting default whitelist 'file,crypto'
 [hls muxer @ 0x3a3d5a0] EXT-X-MEDIA-SEQUENCE:506
 [AVIOContext @ 0x5b21a60] Statistics: 0 seeks, 1 writeouts
 [hls muxer @ 0x3aa6500] deleting old segment segment_96_0000000501.ts
 [file @ 0x5b7ce00] Setting default whitelist 'file,crypto'
 [file @ 0x5b7cf00] Setting default whitelist 'file,crypto'
 av_interleaved_write_frame(): Too many open files
 No more output streams to write to, finishing.


 How to reproduce:
 % ffmpeg -v 9 -loglevel 99 -re -i \
           -c:a aac \
           -vn \
           -b:a 128000 \
           -f hls \
           -hls_time 6 \
           -hls_list_size 3 \
           -hls_flags delete_segments \
           -hls_segment_filename segment_128_%10d.ts \
           playlist_128.m3u8 \
           -c:a aac \
           -vn \
           -b:a 96000 \
           -f hls \
           -hls_time 6 \
           -hls_list_size 3 \
           -hls_flags delete_segments \
           -hls_segment_filename segment_96_%10d.ts \
           playlist_96.m3u8 2>>ffmpeg-all.log

 ffmpeg version N-83663-g7e9ba78
 built on Ubuntu 16.04.2 LTS (4.4.0-62-generic)
 built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
 configured with --enable-gpl --enable-libass --enable-libfdk-aac --enable-
 libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora
 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265

 Please note that it takes some time to happen and depends on the limits on
 the system.

 the machine's "max open files" was set to 1024.

 The provided live source can be any kind of audio source. However, the
 tested source was an OGG source provided by an Icecast2 instance.

 while the process is running you can see the open files (deleted segments
 included) stacking up until the termination of the ffmpeg process:

 lsof -p <PID> | grep segment | grep deleted | wc -l

Ticket URL: <https://trac.ffmpeg.org/ticket/6204>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list