Buffering while converting stream to frames with ffmpeg
<p>I am trying to convert udp stream into frames using ffmpeg. I run following command:</p>

<pre><code>ffmpeg -loglevel debug -strict 2 -re -i "udp://192.168.15.50:3200?fifo_size=1000000&amp;overrun_nonfatal=1" -r 8 -vf scale=432:243 -f image2pipe -vcodec ppm pipe:1
</code></pre>

<p>It happens with different stream types, mpeg2video and h264. Cpu load for core processing this specific stream is under 30%, its low quality sd stream with resolution of 640x576.</p>

<p>It works well for the most time, however sometimes, once in a while, latency occurs and frames arrive later. So i want exactly 8 fps but sometime i get less, sometimes more.</p>

<p>Why does this latency occur and how can i reduce it?</p>

<p>update: i tried changing it to:</p>

<pre><code>ffmpeg -loglevel debug -i "udp://192.168.15.50:3200?fifo_size=1000000&amp;overrun_nonfatal=1" -r 8 -preset ultrafast -fflags nobuffer -vf scale=432:243 -f image2pipe -vcodec ppm pipe:1
</code></pre>

<p>But i still get the issue. For example, in ffmpeg log i get:</p>

<pre><code>[2016/02/11 13:32:30] frame= 7477 fps=8.0 q=-0.0 size= 2299638kB time=00:15:34.62 bitrate=20156.4kbits/s dup=7 drop=15867 ^M*** dropping frame 7477 from stream 0 at ts 7475
[2016/02/11 13:32:30] ***dropping frame 7477 from stream 0 at ts 7476
[2016/02/11 13:32:30] ***dropping frame 7478 from stream 0 at ts 7476
[2016/02/11 13:32:32] Last message repeated 1 times
[2016/02/11 13:32:32] frame= 7479 fps=8.0 q=-0.0 size= 2300253kB time=00:15:34.87 bitrate=20156.4kbits/s dup=7 drop=15871 ^M*** dropping frame 7479 from stream 0 at ts 7477
</code></pre>

<p>As you can see, during second 31, no frames are output... and ffmpeg reported time between two frames is 0.25s</p>