AAC-only hls stream slowly exceeds file descriptors
|Reported by:||ncon||Owned by:||stevenliu|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
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 http://127.0.0.1:8000/test.ogg \ -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 --enable-nonfree
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 656
Change History (11)
Changed 2 months ago by ncon
comment:1 follow-up: ↓ 2 Changed 2 months ago by cehoyos
- Component changed from ffmpeg to undetermined
- Keywords aac segments removed
- Priority changed from important to normal
comment:9 Changed 2 months ago by cehoyos
- Component changed from undetermined to avformat
- Keywords regression added
- Priority changed from normal to important