0

When I attempt to execute the following:

ffmpeg -f lavfi -i mandelbrot=s=7680x4320:r=60 -vf "[in]drawtext=DejaVuSansMono-Bold.ttf: text='mandelbrot-libvpx-vp9-7680x4320x60p': fontcolor=white: fontsize=72: box=1: [email protected]: boxborderw=5: x=(w-text_w)/2:y=h-th-100, drawtext=DejaVuSansMono-Bold.ttf:text='-0-yuv420p-75.webm': fontcolor=white: fontsize=72: box=1: [email protected]: boxborderw=5:x=(w-text_w)/2:y=h-th-25[out]" -c:v libvpx-vp9 -profile:v 0 -b:v 75M -minrate 75M -maxrate 75M -bufsize 150M -pix_fmt yuv420p -framerate 60 -t 10 -y mandelbrot-libvpx-vp9-7680x4320x60p-0-yuv420p-75.webm

I see

ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers
built with Apple clang version 13.0.0 (clang-1300.0.29.30)
configuration: --prefix=/usr/local/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat
59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100 [lavfi @ 0x7fb33dd11f00] Error initializing filter 'mandelbrot' with args 's=7680x4320:r=60' mandelbrot=s=7680x4320:r=60: Cannot allocate memory

I found in this source: https://ffmpeg.org/doxygen/3.2/vsrc__mandelbrot_8c_source.html, that "s->cache_allocated = s->w * s->h * 3;" Perhaps, that means 100MB is needed per image?

Is this an issue with ffmpeg, or this particular filter or do I need more memory than the 16GB my Mac provides?

3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Aug 11, 2022 at 8:29
  • I think the issue is in the next line of code: s->point_cache= av_malloc_array(s->cache_allocated, sizeof(*s->point_cache)). Size of Point is at least 22 bytes. s->point_cache = 7680*4320*3*22` = 2189721600. The size is grater than MAX_INT (2147483647). It looks like av_malloc_array is limited to MAX_INT size (I don't know if the limitation is a bug). In case you want to fix the sources... replace av_malloc_array with malloc. Commented Aug 11, 2022 at 10:20
  • Thank you! I changed line 72 of github.com/FFmpeg/FFmpeg/blob/master/libavutil/mem.c from "static atomic_size_t max_alloc_size = ATOMIC_VAR_INIT(INT_MAX);" to "static atomic_size_t max_alloc_size = ATOMIC_VAR_INIT(2*INT_MAX);" With that I was able to generate the 8k assets I need. Commented Aug 15, 2022 at 2:45

1 Answer 1

1

There is already a command line option named max_alloc to change the value of max_alloc_size so no re-compilation is required e.g.

ffmpeg -f lavfi -i mandelbrot=s=7680x4320:r=60 -t 2 -max_alloc 8589934592 test.ts

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.