[FFmpeg-trac] #1604(undetermined:new): Rtmp streaming fps continually drops

FFmpeg trac at avcodec.org
Wed Dec 31 21:48:39 CET 2014

#1604: Rtmp streaming fps continually drops
             Reporter:  Pyriel0      |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
              Version:  git-master   |  undetermined
             Keywords:  rtmp         |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0

Comment (by ctetrick):

 I've been looking at this issue for the last couple of weeks and have some
 If I stream to live-dwf.twitch.tv/app/ The frame rate does not drop. This
 server is near my location, and has a very low RTT.
 If I stream to live-prg.twitch.tv/app The frame rate drops as described.
 RTT is around 147ms.
 I'm using an ffmpeg build with librtmp enabled.
 Some people have noted that a TPC Relay app seems to help. I got similar
 Now, in librtmp the function RTMP_SendPacket() packets are broken up by
 the default outgoing chunksize (128 bytes) and these are sent to the
 socket directly. However, I noticed this code:

   /* send all chunks in one HTTP request */
   if (r->Link.protocol & RTMP_FEATURE_HTTP)
     int chunks = (nSize+nChunkSize-1) / nChunkSize;
     if (chunks > 1)
       tlen = chunks * (cSize + 1) + nSize + hSize;
       tbuf = malloc(tlen);
       if (!tbuf)
         return FALSE;
       toff = tbuf;

 By forcing the use of buffering with



   if ((r->Link.protocol & RTMP_FEATURE_HTTP) ||
           (packet->m_packetType == RTMP_PACKET_TYPE_VIDEO) ||
           (packet->m_packetType == RTMP_PACKET_TYPE_AUDIO))

 The framerate improves considerably - limited by RTT.

 rogerdpack mentioned on the ffmpeg forum that librtmp turns off Nagle.
 I'm no expert on TCP, but I suspect that twitch.tv's RTMP ingestion
 servers still has Nagle turned on so there is still some blocking.

Ticket URL: <https://trac.ffmpeg.org/ticket/1604#comment:22>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list