Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OOM exception when the preset is not "ultrafast" or "superfast" #171

Open
BrunoQuaresma opened this issue Dec 5, 2021 · 0 comments
Open

Comments

@BrunoQuaresma
Copy link

BrunoQuaresma commented Dec 5, 2021

Hey folks, I'm using FFmpeg to render some videos, but I'm receiving errors every time I try to use a preset that is different from ultrafast or fast. I tried to increase the TOTAL_MEMORY but looks like it is not working. Here is my code:

const result = ffmpeg({
    MEMFS: [
      { name: "image.png", data: new Uint8Array(image.data) },
      { name: "video.mp4", data: new Uint8Array(video.data) },
    ],
    TOTAL_MEMORY: 10 * 1024 * 1024,

    print: function (data) {},
    printErr: function (data) {
      stderr += data + "\n";
    },

    arguments: [
      "-loop",
      "1",
      "-i",
      "image.png",
      "-i",
      "video.mp4",
      "-preset",
      "superfast",
      "-filter_complex",
      `[1:v]scale=${videoW}:-1[video];[0:v]scale=iw:-2[bg];[bg][video]overlay=(W-w)/2:${videoY}:shortest=1`,
      "out.mp4",
    ],

    onExit: function (code) {
      console.log("Process exited with code " + code);
      console.log(stderr);
    },
  });

Output:

ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with emcc (Emscripten gcc/clang-like replacement) 1.39.11
  configuration: --cc=emcc --ranlib=emranlib --enable-cross-compile --target-os=none --arch=x86 --disable-runtime-cpudetect --disable-asm --disable-fast-unaligned --disable-pthreads --disable-w32threads --disable-os2threads --disable-debug --disable-stripping --disable-safe-bitstream-reader --disable-all --enable-ffmpeg --enable-avcodec --enable-avformat --enable-avfilter --enable-swresample --enable-swscale --disable-network --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --enable-decoder=vp8 --enable-decoder=h264 --enable-decoder=vorbis --enable-decoder=opus --enable-decoder=mp3 --enable-decoder=aac --enable-decoder=pcm_s16le --enable-decoder=mjpeg --enable-decoder=png --enable-demuxer=matroska --enable-demuxer=ogg --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=wav --enable-demuxer=image2 --enable-demuxer=concat --enable-protocol=file --enable-filter=aresample --enable-filter=scale --enable-filter=crop --enable-filter=overlay --enable-filter=hstack --enable-filter=vstack --disable-bzlib --disable-iconv --disable-libxcb --disable-lzma --disable-sdl2 --disable-securetransport --disable-xlib --enable-zlib --enable-encoder=libx264 --enable-encoder=libmp3lame --enable-encoder=aac --enable-muxer=mp4 --enable-muxer=mp3 --enable-muxer=null --enable-gpl --enable-libmp3lame --enable-libx264 --extra-cflags='-s USE_ZLIB=1 -I../lame/dist/include' --extra-ldflags=-L../lame/dist/lib
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
[png @ 0x72cc00] Warning: not compiled with thread support, using thread emulation
Input #0, image2, from 'image.png':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 24929 kb/s
    Stream #0:0: Video: png, rgba(pc), 700x716, 25 fps, 25 tbr, 25 tbn, 25 tbc
[h264 @ 0x72f310] Warning: not compiled with thread support, using thread emulation
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41iso4
    creation_time   : 2021-12-04T18:31:30.000000Z
  Duration: 00:00:19.87, start: 0.000000, bitrate: 22 kb/s
    Stream #1:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 414x270, 16 kb/s, 37.90 fps, 60 tbr, 6k tbn, 12k tbc (default)
    Metadata:
      creation_time   : 2021-12-04T18:31:30.000000Z
      handler_name    : Vireo Eyes v2.7.3
      encoder         : AVC Coding
[png @ 0x72d190] Warning: not compiled with thread support, using thread emulation
[h264 @ 0x732520] Warning: not compiled with thread support, using thread emulation
Stream mapping:
  Stream #0:0 (png) -> scale
  Stream #1:0 (h264) -> scale
  overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[libx264 @ 0x998770] Warning: not compiled with thread support, using thread emulation
[libx264 @ 0x998770] using cpu capabilities: none!
[libx264 @ 0x998770] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x998770] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=1 lookahead_threads=1 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=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=10 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 'out.mp4':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 700x716, q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc58.54.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=   13 fps=0.0 q=28.0 size=       0kB time=-00:00:00.03 bitrate=N/A speed=N/A    
OOM
exception thrown: abort(OOM). Build with -s ASSERTIONS=1 for more info.

Thanks for the amazing work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant