[x264-devel] Adding fps option eats up memory

Bernd Butscheidt bbutscheidt at yahoo.de
Thu Apr 11 12:10:18 CEST 2013


Hello,

since I got no reaction here: http://doom10.org/index.php?topic=2526.0

I follow the suggestions of the web page (http://www.videolan.org/developers/x264.html) to report a possible bug on the mailing list. If this is the wrong place, please ignore me or lead me to the right place and take a sorry for the noise.

Here is what I do:

Code: 
mkfifo pipe_video; ffmpeg -i Sport_HD_CUT.ts -map 0:0 -f yuv4mpegpipe -y pipe_video

And the encoding:
x264 --preset ultrafast --crf 12 --video-filter select_every:2,0 -o Sport_HD_CUT_ntsc.264 pipe_video


It works like charm.

If I slightly modify my x264-command by adding a fps-option like this:

x264 --preset ultrafast --crf 12 --fps 50 --video-filter select_every:2,0 -o Sport_HD_CUT_ntsc.264 pipe_video


something strange happens. Each second, the amount of used memory rises. The clip in the example is of one minute, so the encoding succeeds and the result is as expected, but nearly 3 GB(!) of additional memory is used 
until the end of encoding. Of course, it is freed after the encoding is finished. But if I try to encode a longer video this way, my 4 GB Memory plus 1 GB of swap runs out and the encoding stops. Without the additional fps-option, nearly no memory consumption is noticeable, may be about 100 MB in total regardless of the length of the video used.



Here is the complete output of the two commands:


Code: 
bernd_b at localhost /w_LD2/ProjectX $ mkfifo pipe_video; /extern07/ffmpeg_neu/ffmpeg/ffmpeg -i Sport_HD_CUT.ts -map 0:0 -f yuv4mpegpipe -y pipe_video
ffmpeg version 1.1.git Copyright (c) 2000-2013 the FFmpeg developers
  built on Apr  8 2013 12:52:44 with gcc 4.6.3 (Gentoo Hardened 4.6.3 p1.3, pie-0.5.2)
  configuration: --enable-avresample --enable-gpl --enable-libx264 --enable-nonfree --enable-libmp3lame --enable-libfaac --enable-frei0r --enable-libsoxr --cpu=amd64 --arch=x86_64 --enable-version3 --arch=x86_64 --enable-version3
  libavutil      52. 25.100 / 52. 25.100
  libavcodec     55.  2.100 / 55.  2.100
  libavformat    55.  1.100 / 55.  1.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 49.100 /  3. 49.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mpegts @ 0x2d2bf80] Stream #5: not enough frames to estimate rate; consider increasing probesize
[NULL @ 0x2d334e0] start time is not set in estimate_timings_from_pts
[mpegts @ 0x2d2bf80] PES packet size mismatch
Input #0, mpegts, from 'Sport_HD_CUT.ts':
  Duration: 00:00:58.07, start: 14960.027511, bitrate: 14038 kb/s
  Program 132 
    Stream #0:0[0x17de]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
    Stream #0:1[0x17e8](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 256 kb/s
    Stream #0:2[0x17e9](mis): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:3[0x17eb](mul): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:4[0x17ea](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 448 kb/s
    Stream #0:5[0x17f3](deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
Output #0, yuv4mpegpipe, to 'pipe_video':
  Metadata:
    encoder         : Lavf55.1.100
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 50 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> rawvideo)
Press [q] to stop, [?] for help
[yuv4mpegpipe @ 0x2d2e780] Encoder did not produce proper pts, making some up.
frame= 2904 fps= 32 q=0.0 Lsize= 3920417kB time=00:00:58.08 bitrate=552962.4kbits/s dup=1 drop=0    
video:272kB audio:0kB subtitle:0 global headers:0kB muxing overhead 1439906.271881%




Code:
bernd_b at localhost /w_LD2/ProjectX $ /extern07/ffmpeg_neu/x264/x264 --preset ultrafast --crf 12 --fps 50 --video-filter select_every:2,0 -o Sport_HD_CUT_ntsc.264 pipe_video
[yuv4mpegpipe @ 0xf13490] Estimating duration from bitrate, this may be inaccurate
lavf [info]: 1280x720p 0:1 @ 50/1 fps (cfr)
x264 [info]: using cpu capabilities: MMX2 SSE2Slow SlowCTZ
x264 [info]: profile Constrained Baseline, level 3.1
x264 [info]: frame I:6     Avg QP: 9.00  size:304097                           
x264 [info]: frame P:1446  Avg QP:11.57  size:118444
x264 [info]: mb I  I16..4: 100.0%  0.0%  0.0%
x264 [info]: mb P  I16..4:  2.1%  0.0%  0.0%  P16..4: 96.2%  0.0%  0.0%  0.0%  0.0%    skip: 1.7%
x264 [info]: coded y,uvDC,uvAC intra: 76.3% 78.5% 58.2% inter: 82.2% 64.3% 28.0%
x264 [info]: i16 v,h,dc,p: 24% 31% 30% 14%
x264 [info]: i8c dc,h,v,p: 32% 34% 21% 13%
x264 [info]: kb/s:23842.26

encoded 1452 frames, 15.95 fps, 23842.26 kb/s



More information about the x264-devel mailing list