[FFmpeg-trac] #7547(ffmpeg:new): When relaying RTMP streams ffmpeg quits with av_interleaved_write_frame message

FFmpeg trac at avcodec.org
Wed Nov 14 09:55:03 EET 2018

#7547: When relaying RTMP streams ffmpeg quits with av_interleaved_write_frame
             Reporter:  regstuff  |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  ffmpeg    |                  Version:  unspecified
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
 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

 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:// -i
 /usr/local/nginx/scripts/images/lowerthird.png -af azmq,volume=2 -c:a aac
 -filter_complex 'zmq=bind_address=tcp\\\://\\\: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:// -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
 ffmpeg version N-92427-gae43235 Copyright (c) 2000-2018 the FFmpeg
   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
   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:// -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.

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

More information about the FFmpeg-trac mailing list