[FFmpeg-user] Increase ffmpeg memory footprint?

Ned Rockson nedrocks at gmail.com
Mon Dec 21 02:12:33 CET 2015


On Thu, Dec 17, 2015 at 11:01 AM, Nicolas George <george at nsup.org> wrote:

>
>
> # av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\
>
> "Cannot" and "could not" are not the same thing. Accuracy is paramount when
> quoting error messages.
>

Oh wow, definitely didn't copy/paste the right thing. My apologies!


> > Full output and other, more detailed information in this gist:
> > https://gist.github.com/nedrocks/09afd6a4fa2cd472f17a
> >
> > ffmpeg -y -ss 0.846 -i /tmp/f5543c87-77f5-466a-9f9f-4ba8b40fae03.webm -ss
> > 1.863 -i /tmp/f6cf2730-bfb3-40e5-aef6-3a03ca24333d.webm -filter_complex
> >
> '[0:v]pad=640*2:480[left];[left][1:v]overlay=x=640+(640-w)/2:y=(480-h)/2;amix'
>
> Having two unconnected graphs in the same graph is not a good idea.
>

Interesting. I don't understand and would really like to, can you point me
to some material or explain a little more?

I thought by default the two (audio and video) outputs were combined by
default. Interestingly, when I add output names and do -map commands to
each one it fails on ubuntu 14.04 but not mac os. Slightly different builds
-- 2.7.2 on Mac OSX, version git-2015-11-09-480bad7 on Ubuntu 14.04.


>
> And try using amerge+pan instead of amix; amix may have scheduling problems
> that could explain a huge memory consumption.
>

This gave a significant improvement in the number of times that message was
printed. Instead of a half dozen times on the same input set, it only
showed up three times! Improvement! However, amerge + pan leads to weird
syncing issues between the video and audio that generally get worse
whenever there is are missing video frames (in my use case, I am merging
two videos streamed over webRTC so not the cleanest input). Amix does not
exhibit this behavior..

ffmpeg -y -ss 0.846 -i /tmp/f5543c87-77f5-466a-9f9f-4ba8b40fae03.webm -ss
1.863 -i /tmp/f6cf2730-bfb3-40e5-aef6-3a03ca24333d.webm -filter_complex
'[0:v]pad=640*2:480[left];[left][1:v]overlay=x=640+(640-w)/2:y=(480-h)/2[video];
[0:a]
aformat=sample_fmts=fltp:sample_rates=48000:channel_layouts=stereo[a1];
[1:a]
aformat=sample_fmts=fltp:sample_rates=48000:channel_layouts=stereo[a2];
[a1][a2] amerge,pan=stereo:c0<c0+c2|c1<c1+c3[audio]' -map '[video]' -map
'[audio]' -async 1 -r 24 -shortest -flags +global_header -c:a libfdk_aac
-c:v libx264 /tmp/4a387f3ba0944aa19eeac0332f15ec53.mp4
ffmpeg version git-2015-11-09-480bad7 Copyright (c) 2000-2015 the FFmpeg
developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
  configuration: --extra-libs=-ldl --enable-gpl --enable-libass
--enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
--enable-nonfree
  libavutil      55.  5.100 / 55.  5.100
  libavcodec     57. 15.100 / 57. 15.100
  libavformat    57. 14.100 / 57. 14.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 15.100 /  6. 15.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from
'/tmp/f5543c87-77f5-466a-9f9f-4ba8b40fae03.webm':
  Metadata:
    encoder         : libwebm-0.2.1.0
    creation_time   : 2015-12-16 18:15:50
  Duration: 00:18:07.24, start: 0.000000, bitrate: 989 kb/s
    Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
    Stream #0:1(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 15
tbr, 1k tbn, 1k tbc (default)
Input #1, matroska,webm, from
'/tmp/f6cf2730-bfb3-40e5-aef6-3a03ca24333d.webm':
  Metadata:
    encoder         : libwebm-0.2.1.0
    creation_time   : 2015-12-16 18:15:50
  Duration: 00:18:07.99, start: 0.000000, bitrate: 1016 kb/s
    Stream #1:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
    Stream #1:1(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 1k
tbr, 1k tbn, 1k tbc (default)
[Parsed_pan_5 @ 0x38fa0e0] This syntax is deprecated. Use '|' to separate
the list items.
[Parsed_pan_5 @ 0x38f9d40] This syntax is deprecated. Use '|' to separate
the list items.
-async is forwarded to lavfi similarly to -af
aresample=async=1:min_hard_comp=0.100000:first_pts=0.
    Last message repeated 1 times
[Parsed_amerge_4 @ 0x390e1c0] Input channel layouts overlap: output layout
will be determined by the number of distinct input channels
[libx264 @ 0x387e4c0] using SAR=1/1
[libx264 @ 0x387e4c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x387e4c0] profile High, level 3.1
[libx264 @ 0x387e4c0] 264 - core 148 r2 7599210 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0
qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/tmp/4a387f3ba0944aa19eeac0332f15ec53.mp4':
  Metadata:
    encoder         : Lavf57.14.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
1280x480 [SAR 1:1 DAR 8:3], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc57.15.100 libx264
    Stream #0:1: Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000
Hz, stereo, s16, 139 kb/s (default)
    Metadata:
      encoder         : Lavc57.15.100 libfdk_aac
Stream mapping:
  Stream #0:0 (opus) -> aformat
  Stream #0:1 (vp8) -> pad
  Stream #1:0 (opus) -> aformat
  Stream #1:1 (vp8) -> overlay:overlay
  overlay -> Stream #0:0 (libx264)
  pan -> Stream #0:1 (libfdk_aac)
Press [q] to stop, [?] for help
Past duration 0.607994 too large    1458kB time=00:00:12.39 bitrate=
963.4kbits/s dup=121 drop=0
Past duration 0.607994 too large    3666kB time=00:00:26.19
bitrate=1146.4kbits/s dup=245 drop=0
Past duration 0.607994 too large    5426kB time=00:00:38.31
bitrate=1160.0kbits/s dup=354 drop=0
Past duration 0.671989 too large    7928kB time=00:00:53.05
bitrate=1224.1kbits/s dup=487 drop=0
Past duration 0.615990 too large    8864kB time=00:00:59.00
bitrate=1230.6kbits/s dup=544 drop=0
Past duration 0.615990 too large   10974kB time=00:01:13.23
bitrate=1227.6kbits/s dup=672 drop=0
Past duration 0.775993 too large   13973kB time=00:01:33.26
bitrate=1227.3kbits/s dup=852 drop=0
Past duration 1.055992 too large   17386kB time=00:01:56.20
bitrate=1225.7kbits/s dup=1064 drop=0
Past duration 0.631996 too large   17747kB time=00:01:58.42
bitrate=1227.7kbits/s dup=1083 drop=0
Past duration 1.495995 too large   18317kB time=00:02:02.68
bitrate=1223.1kbits/s dup=1121 drop=0
Past duration 0.983986 too large
Past duration 0.607994 too large   20155kB time=00:02:14.59
bitrate=1226.8kbits/s dup=1229 drop=0
Past duration 0.607994 too large   21047kB time=00:02:20.41
bitrate=1227.9kbits/s dup=1281 drop=0
Past duration 0.607994 too large   23385kB time=00:02:37.26
bitrate=1218.1kbits/s dup=1432 drop=0
Past duration 0.607994 too large   29283kB time=00:03:17.71
bitrate=1213.3kbits/s dup=1812 drop=0
Past duration 0.767998 too large   31946kB time=00:03:36.06
bitrate=1211.2kbits/s dup=1978 drop=0
Past duration 1.103996 too large   34708kB time=00:03:55.07
bitrate=1209.5kbits/s dup=2149 drop=0
Past duration 0.607994 too large   37775kB time=00:04:15.25
bitrate=1212.3kbits/s dup=2334 drop=0
Past duration 0.607994 too large   43641kB time=00:04:54.03
bitrate=1215.9kbits/s dup=2684 drop=0
Past duration 0.607994 too large   44321kB time=00:04:57.83
bitrate=1219.1kbits/s dup=2732 drop=0
Past duration 0.623985 too large   45196kB time=00:05:04.08
bitrate=1217.6kbits/s dup=2789 drop=0
Past duration 0.719994 too large   57817kB time=00:06:23.50
bitrate=1235.0kbits/s dup=3510 drop=0
Past duration 0.711998 too large   58084kB time=00:06:25.60
bitrate=1234.0kbits/s dup=3528 drop=0
Past duration 0.607994 too large   59916kB time=00:06:37.84
bitrate=1233.7kbits/s dup=3639 drop=0
Error while decoding stream #0:0: Cannot allocate memory.00
bitrate=1234.6kbits/s dup=3659 drop=0
    Last message repeated 36 times
Past duration 0.775993 too large   67723kB time=00:07:30.59
bitrate=1231.2kbits/s dup=4153 drop=0
Past duration 0.615990 too large   71065kB time=00:07:53.38
bitrate=1229.8kbits/s dup=4358 drop=0
Past duration 0.607994 too large   72202kB time=00:08:01.33
bitrate=1228.8kbits/s dup=4437 drop=0
Past duration 0.815987 too large   72875kB time=00:08:05.51
bitrate=1229.6kbits/s dup=4474 drop=0
Past duration 0.607994 too large   75049kB time=00:08:19.62
bitrate=1230.5kbits/s dup=4603 drop=0
Past duration 0.631996 too large
Past duration 0.607994 too large   78113kB time=00:08:41.29
bitrate=1227.5kbits/s dup=4800 drop=0
Past duration 0.607994 too large   79004kB time=00:08:47.58
bitrate=1226.7kbits/s dup=4856 drop=0
Past duration 0.607994 too large   79274kB time=00:08:49.33
bitrate=1226.8kbits/s dup=4872 drop=0
Past duration 0.615990 too large   81824kB time=00:09:06.23
bitrate=1227.1kbits/s dup=5038 drop=0
Past duration 0.607994 too large   84275kB time=00:09:23.02
bitrate=1226.2kbits/s dup=5189 drop=0
Past duration 1.320000 too large   89379kB time=00:09:54.91
bitrate=1230.8kbits/s dup=5478 drop=0
Past duration 1.047997 too large
Past duration 0.607994 too large   93437kB time=00:10:21.17
bitrate=1232.2kbits/s dup=5718 drop=0
Past duration 0.623985 too large   96442kB time=00:10:41.08
bitrate=1232.4kbits/s dup=5897 drop=0
Past duration 0.663994 too large   98363kB time=00:10:53.62
bitrate=1232.8kbits/s dup=6017 drop=0
Past duration 1.207985 too large   98645kB time=00:10:55.60
bitrate=1232.6kbits/s dup=6035 drop=0
Past duration 0.695992 too large
Past duration 0.783989 too large  100164kB time=00:11:05.76
bitrate=1232.5kbits/s dup=6139 drop=0
Past duration 0.607994 too large  103909kB time=00:11:30.25
bitrate=1233.2kbits/s dup=6360 drop=0

...

Error while decoding stream #1:0: Cannot allocate memory.11
bitrate=1241.8kbits/s dup=8383 drop=0
    Last message repeated 47 times
Past duration 0.615990 too large  138970kB time=00:15:17.71
bitrate=1240.5kbits/s dup=8464 drop=0
Past duration 0.623985 too large  142160kB time=00:15:38.48
bitrate=1240.9kbits/s dup=8650 drop=0
Past duration 1.239998 too large  144774kB time=00:15:54.42
bitrate=1242.6kbits/s dup=8794 drop=0
Past duration 0.751991 too large
Past duration 0.631996 too large  147748kB time=00:16:11.94
bitrate=1245.3kbits/s dup=8958 drop=0
Past duration 0.607994 too large  150059kB time=00:16:26.19
bitrate=1246.5kbits/s dup=9086 drop=0
Past duration 0.607994 too large  150358kB time=00:16:28.13
bitrate=1246.5kbits/s dup=9103 drop=0
Past duration 0.607994 too large  151605kB time=00:16:35.47
bitrate=1247.6kbits/s dup=9169 drop=0
Error while decoding stream #0:0: Cannot allocate memory.23
bitrate=1248.0kbits/s dup=9221 drop=0
    Last message repeated 44 times
Past duration 0.735985 too large  163365kB time=00:17:47.90
bitrate=1253.2kbits/s dup=9859 drop=0
frame=26075 fps= 96 q=-1.0 Lsize=  167503kB time=00:18:06.41
bitrate=1263.0kbits/s dup=10036 drop=0
video:148286kB audio:18491kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.435046%
[libx264 @ 0x387e4c0] frame I:105   Avg QP:16.56  size: 66967
[libx264 @ 0x387e4c0] frame P:8722  Avg QP:20.05  size: 13388
[libx264 @ 0x387e4c0] frame B:17248 Avg QP:24.71  size:  1626
[libx264 @ 0x387e4c0] consecutive B-frames: 10.7%  0.5%  8.1% 80.6%
[libx264 @ 0x387e4c0] mb I  I16..4: 19.0% 52.8% 28.2%
[libx264 @ 0x387e4c0] mb P  I16..4:  1.3%  3.6%  0.8%  P16..4: 32.6% 11.1%
 6.8%  0.0%  0.0%    skip:43.8%
[libx264 @ 0x387e4c0] mb B  I16..4:  0.0%  0.2%  0.0%  B16..8: 23.7%  1.4%
 0.3%  direct: 0.6%  skip:73.7%  L0:45.8% L1:47.4% BI: 6.8%
[libx264 @ 0x387e4c0] 8x8 transform intra:62.2% inter:55.2%
[libx264 @ 0x387e4c0] coded y,uvDC,uvAC intra: 70.0% 66.2% 26.2% inter:
10.1% 8.4% 0.8%
[libx264 @ 0x387e4c0] i16 v,h,dc,p: 17% 30% 21% 31%
[libx264 @ 0x387e4c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 18% 18%  5%  7%
 9%  7%  8%  7%
[libx264 @ 0x387e4c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 17% 14%  5%  8%
10%  6%  7%  4%
[libx264 @ 0x387e4c0] i8c dc,h,v,p: 52% 19% 23%  6%
[libx264 @ 0x387e4c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x387e4c0] ref P L0: 63.2% 16.0% 13.9%  6.9%  0.0%
[libx264 @ 0x387e4c0] ref B L0: 91.2%  7.2%  1.5%
[libx264 @ 0x387e4c0] ref B L1: 94.8%  5.2%
[libx264 @ 0x387e4c0] kb/s:1118.09


>
> Regards,
>
> --
>   Nicolas George
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
>


-- 
Ned Rockson
m: +1 415 580 0074 | @nedrockson


More information about the ffmpeg-user mailing list