Skip to content

[Android] Video.compress fails with NO_MEMORY on Samsung Exynos devices at 1080p (2.0.x) #423

Description

@yayobyte

Current behavior

On Samsung Exynos devices (e.g. Galaxy A56, most Galaxy A models and some Galaxy S), Video.compress always rejects. Logcat:

ExynosVideoEncCodec-H264-Intf: [checkRealTimeResource] real-time(32767 fps) is not supported
ExynosC2H264EncComponent: [tryGetResource] obtaining real time resource is failed
MediaCodec: Codec reported err 0xfffffff4/NO_MEMORY, actionCode 0, while in state 5/STARTING

Cause: since #399, CompressorUtils.setOutputFileParameters sets KEY_PRIORITY = 0 (realtime) and KEY_OPERATING_RATE = Short.MAX_VALUE on the encoder format. c2.exynos.h264.encoder accepts these in configure() but refuses them in start(). The prepareEncoder fallback only retries configure() failures, so the error reaches JS. No JS option can disable these keys.

Expected behavior

The video compresses. Locally removing the two keys fixes it: a 94.1 MB, 43.6 s 1080×1920 H.264 clip compresses to 32.0 MB (H.264 High, ~5.6 Mbps) on a Galaxy A56. I'll open a PR with this fix.

Platform

  • Android
  • iOS

React Native Version

0.81.5 (Expo SDK 54) and 0.86.3 (Expo SDK 57). The bug is in the native MediaCodec setup, not RN-specific.

React Native Compressor Version

2.0.3 (introduced in #399)

Reproducible Steps And Demo

  1. Run any app using react-native-compressor 2.0.3 on a Samsung Exynos device (tested: Galaxy A56).
  2. Call Video.compress(uri, { compressionMethod: "manual", bitrate: 5_600_000, maxSize: 1920 }) on any video.
  3. The promise rejects, and logcat shows the NO_MEMORY / real-time(32767 fps) is not supported errors above.

Activity

  1. github-actions commented on Oct 9, 2026

    @github-actions

    👋 @yayobyte
    Thanks for opening your issue here! If you find this package useful hit the star🌟!

  2. yayobyte commented on Oct 10, 2026

    @yayobyte
    Author

    Follow-up after reproducing this against the bare example app on a Galaxy A56 (SM-A566E, Exynos 1580 / s5e8855, Android 16), same source video (94.1 MB, H.264 1920×1080 portrait, 120 fps, 43.6 s):

    Native code Options Result
    2.0.3 (keys set) default auto (→ 360×640) ✅ succeeds
    2.0.3 (keys set) manual, maxSize: 1920, bitrate: 5_600_000 ❌ real-time(32767 fps) is not supported → NO_MEMORY in STARTING, promise rejects
    keys removed manual, maxSize: 1920, bitrate: 5_600_000 ✅ 31.97 MB, H.264 High 1080×1920, ~11 s

    So "always rejects" in the title is too strong: the realtime-resource check depends on resolution. Small auto outputs fit Exynos's realtime budget, and 1080p outputs don't. The encoder in every run was c2.exynos.h264.encoder.

    PR with the fix to follow.

  3. changed the title [-][Android] Video.compress always fails with NO_MEMORY on Samsung Exynos devices (2.0.x)[/-] [+][Android] Video.compress fails with NO_MEMORY on Samsung Exynos devices at 1080p (2.0.x)[/+] on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions