[FFmpeg-user] MPEG4 / XVID encoding speed slowdown on long files

iliana.in.france at free.fr iliana.in.france at free.fr
Tue Mar 29 16:19:32 CEST 2011


Hello,

I am since many years and with all ffmpeg versions experiencing a "slowdown" of
encoding speed using the mpeg4 codec to encode in xvid / avi format during the
encoding process as if there were some memory leaks that slowdown the process on
long encoding files.

The example below is significant: The encoding starts at 15 fps but after a
while the encoding speed constantly decreases reaching, for example 9 fps at
frame 4335, 3 fps at frame 8617, and finally 2 fps from frame 21932 onward. The
longer the duration of the file is, the slower the encoding becomes. In this
case, the duration of the file is 37 minutes and it took more than 4 hours 20
minutes to encode the first pass, 7 time the initial duration, while if the
video would last only 1 minute, the encoding time would be only 3 minutes
(factor 3 only).

Does somebody have an explanation ? Is there a memory leak that slows down the
process ?

Best regards, iliana.

Running on Windows 7 64 bit, Athlon Phenon X4 2.4 GHz, 8 GB Ram
-------------- Command Line --------------------
ffmpeg.exe -y -i "inputfile.m2t" -metadata title="Festa 50 (07 May 2011)" -r 25
-vcodec mpeg4 -vtag xvid -pass 1 -deinterlace -vtag XVID -s 1024x576 -aspect
16:9 -maxrate 2100k -b 1900k -qmin 2 -qmax 15 -bufsize 4096k -mbd 2 -bf 2 -flags
+mv4+aic -cmp 2 -subcmp 2 -trellis 1 -g 300 -an "outputfile.avi"
---------------Command Output -------------------
FFmpeg version SVN-r25107-Sherpya, Copyright (c) 2000-2010 the FFmpeg developers
  built on Sep 12 2010 15:54:45 with gcc 4.2.5 20090330 (prerelease) [Sherpya]
  libavutil     50.26. 0 / 50.26. 0
  libavcore      0. 9. 0 /  0. 9. 0
  libavcodec    52.88. 0 / 52.88. 0
  libavformat   52.78. 5 / 52.78. 5
  libavdevice   52. 2. 2 / 52. 2. 2
  libavfilter    1.38. 3 /  1.38. 3
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
[mpegts @ 01798c50] max_analyze_duration reached

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1)
-> 50.00 (50/1)
Input #0, mpegts, from 'inputfile.m2t':
  Duration: 00:37:25.87, start: 0.880011, bitrate: 26057 kb/s
  Program 1
    Stream #0.0[0x3e9]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 50
fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x3ea]: Audio: ac3, 48000 Hz, stereo, s16, 384 kb/s
[buffer @ 016b8f90] w:1920 h:1080 pixfmt:yuv420p
[scale @ 01746000] w:1920 h:1080 fmt:yuv420p -> w:1024 h:576 fmt:yuv420p
flags:0x4
Output #0, avi, to 'outputfile.avi':
  Metadata:
    INAM            : Festa 50 (07 May 2011)
    ISFT            : Lavf52.78.5
    Stream #0.0: Video: mpeg4 (hq), yuv420p, 1024x576 [PAR 1:1 DAR 16:9],
q=2-15, pass 1, 1900 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=   16 fps= 15 q=2.0 size=      14kB time=0.64 bitrate= 174.8kbits/s
frame=   24 fps= 15 q=2.5 size=      17kB time=0.96 bitrate= 143.7kbits/s
frame=  124 fps= 14 q=2.0 size=     113kB time=4.96 bitrate= 186.2kbits/s
frame=  129 fps= 14 q=2.5 size=     127kB time=5.16 bitrate= 201.5kbits/s
frame=  146 fps= 13 q=2.5 size=     187kB time=5.84 bitrate= 261.7kbits/s
frame=  152 fps= 13 q=2.5 size=     207kB time=6.08 bitrate= 278.5kbits/s
frame=  184 fps= 12 q=2.0 size=     320kB time=7.36 bitrate= 356.6kbits/s
frame=  189 fps= 12 q=2.5 size=     335kB time=7.56 bitrate= 362.6kbits/s
frame=  260 fps= 11 q=2.5 size=     636kB time=10.40 bitrate= 501.1kbits/s
frame=  265 fps= 11 q=2.0 size=     661kB time=10.60 bitrate= 510.8kbits/s
frame=  449 fps= 10 q=2.5 size=    1751kB time=17.96 bitrate= 798.6kbits/s
frame=  454 fps= 10 q=2.0 size=    1792kB time=18.16 bitrate= 808.2kbits/s
frame= 4335 fps=  9 q=2.5 size=   20629kB time=173.40 bitrate= 974.6kbits/s
frame= 4339 fps=  9 q=2.7 size=   20667kB time=173.56 bitrate= 975.5kbits/s
frame= 5598 fps=  8 q=2.5 size=   32562kB time=223.92 bitrate=1191.3kbits/s
frame= 5602 fps=  8 q=16.8 size=   32605kB time=224.08 bitrate=1192.0kbits/s
frame= 5853 fps=  7 q=9.4 size=   35182kB time=234.12 bitrate=1231.0kbits/s
frame= 5854 fps=  7 q=13.0 size=   35193kB time=234.16 bitrate=1231.2kbits/s
frame= 6062 fps=  6 q=19.1 size=   37329kB time=242.48 bitrate=1261.1kbits/s
frame= 6063 fps=  6 q=15.8 size=   37339kB time=242.52 bitrate=1261.3kbits/s
frame= 6377 fps=  5 q=8.5 size=   40559kB time=255.08 bitrate=1302.6kbits/s
frame= 6378 fps=  5 q=8.5 size=   40569kB time=255.12 bitrate=1302.7kbits/s
frame= 6928 fps=  4 q=12.5 size=   46213kB time=277.12 bitrate=1366.1kbits/s
frame= 6929 fps=  4 q=8.5 size=   46222kB time=277.16 bitrate=1366.2kbits/s
frame= 8617 fps=  3 q=12.0 size=   63605kB time=344.68 bitrate=1511.7kbits/s
frame= 8618 fps=  3 q=9.4 size=   63615kB time=344.72 bitrate=1511.8kbits/s
frame=21932 fps=  2 q=15.5 size=  196006kB time=877.28 bitrate=1830.3kbits/s
frame=21933 fps=  2 q=13.8 size=  196017kB time=877.32 bitrate=1830.3kbits/s

video:516156kB audio:0kB global headers:0kB muxing overhead 0.261370%


More information about the ffmpeg-user mailing list