When relaying RTMP streams ffmpeg quits with av_interleaved_write_frame message
|Reported by:||regstuff||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
Summary of the bug: I have an Nginx server (with rtmp-module) on a Ubuntu-16.04 VM. I'm using it to receive an input rtmp stream from my PC. FFmpeg is then used in the VM to take this input and relay to multiple destinations after transcoding, overlaying a lower third, and changing the volume.
However, FFmpeg quits after a random duration between 3-30 minutes with an "av_interleaved_write_frame(): End of file" message.
How to reproduce: Pull an rtmp stream as input. Command used was as below. In the below command, I have used aac and strict -2 as well. I am aware that strict -2 is no longer necessary. The error occurs even with other aac encoders such as libfdk_aac and without strict -2. The reason I have used this particular command is explained in more detail below.
/usr/local/bin/ffmpeg -v 9 -loglevel 99 -nostdin -thread_queue_size 512 -i rtmp://127.0.0.1:1935/input/stream1 -i /usr/local/nginx/scripts/images/lowerthird.png -af azmq,volume=2 -c:a aac -filter_complex 'zmq=bind_address=tcp\\\://127.0.0.1\\\:5559,overlay=0:H' -vcodec libx264 -pix_fmt yuv420p -preset veryfast -r 25 -g 50 -b:v 6000k -maxrate 6M -minrate 6M -bufsize 6M -f flv -strict -2 -f flv rtmp://127.0.0.1:1935/distribute/stream1 -y -report
This happens with the latest ffmpeg version (details below). However, I do not see this issue when I use the standard FFmpeg that comes with Ubuntu 16.04's apt-get install (ffmpeg version 2.8.15). To do an aac encode with the Ubuntu standard Ffmpeg, I have to use aac and strict -2. This is why I have used the command above with the latest Ffmpeg version as well, just to standardize the comparsion. Just to reiterate, this issue occurs even when I use a different encoder and without the -strict -2 flags with the latest ffmpeg.
ffmpeg version N-92427-gae43235 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609 configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs='-lpthread -lm' --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzmq --enable-librtmp --enable-network --enable-nonfree libavutil 56. 23.101 / 56. 23.101 libavcodec 58. 39.100 / 58. 39.100 libavformat 58. 22.100 / 58. 22.100 libavdevice 58. 6.100 / 58. 6.100 libavfilter 7. 43.100 / 7. 43.100 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100
Have attached log output with this ticket. The issue occurs even if I remove all encoding and just do a codec copy as below.
/usr/local/bin/ffmpeg -nostdin -thread_queue_size 512 -i rtmp://127.0.0.1:1935/stream1/input -c copy -f flv rtmp://a.rtmp.youtube.com/live2/[my key] -y
Issue occurs irrespective of destination, whether youtube, facebook or just another location on the same nginx server.
Issue also occurs whether thread_queue_size is 8 or 1024 or 512. It appears that this issue is more frequent in a 4-core system rather than a single core system I was using. Not totally sure about that though.
Change History (27)
comment:2 by , 3 years ago
|Component:||ffmpeg → undetermined|
|Version:||unspecified → git-master|