Skip to content

Crash on LG V40 / S9 / Note 9 etc. (IllegalArgumentException: bufferInfo … presentation time) #309

@synstin

Description

@synstin

Title
Crash on LG V40 / S9 / Note 9 etc. (IllegalArgumentException: bufferInfo … presentation time) — please bump Transcoder to ≥ 0.10.11 (or 0.11.x)


TL;DR

video_compress 3.1.4 ships with Transcoder 0.10.5.
That version still forwards buffers whose presentationTimeUs (PTS) is negative to MediaMuxer.writeSampleData(), triggering:

java.lang.IllegalArgumentException: bufferInfo must specify a valid buffer offset, size and presentation time

The bug was fixed upstream in 0.10.7 (and all 0.11.x releases).
Real-world data suggest ~0.5 % of Android devices (mostly 2018 flagships on Snapdragon 845 / Exynos 9810) are affected.

Proposal: update the Maven dependency in android/build.gradle to at least io.deepmedia.community:transcoder-android:0.10.11 (current stable is 0.11.2). No API changes required.


1 Crash log (LG V40, Android 11)

E/TranscodeEngine: Unexpected error while transcoding.
java.lang.IllegalArgumentException: bufferInfo must specify a valid buffer offset, size and presentation time
        at android.media.MediaMuxer.writeSampleData(MediaMuxer.java:683)
        at com.otaliastudios.transcoder.sink.DefaultDataSink.writeTrack(DefaultDataSink.java:163)
        at com.otaliastudios.transcoder.internal.utils.EosIgnoringDataSink.writeTrack(eos.kt:28)
        …

Same trace on Galaxy Note 9 (Exynos) and Xperia XZ2.


2 Reproduction steps

  1. Flutter app with video_compress 3.1.4 (no manual overrides).

  2. Call

    await VideoCompress.compressVideo(path,
        quality: VideoQuality.MediumQuality);
    
  3. On LG V40, S9, Note 9, Poco F1… the app crashes within seconds.
    Pixel emulator and Pixel 8 real device do not reproduce (software codec).


3 Root cause timeline

Transcoder version Change Status
0.10.4 Ignore size == 0 buffers (PR #158) included
0.10.7 Ignore presentationTimeUs < 0 buffers (PR #176) missing
0.11.x Same fix + misc clean-ups latest

video_compress currently pins 0.10.5, i.e. the fix for negative PTS is not present.


4 Field impact snapshot (Play Store, Apr 2025)

  • Android ≤ 11 share ....................... 32 %

  • Devices on SD845 / Exynos 9810 ..... ≈ 1.5–2 %

  • Those actually emitting PTS < 0 ... 30–40 %

≈ 0.5 % of all active phones will hit the exception whenever they compress a video
(~500 crashes/day for 500 k DAU if 20 % of sessions use compression).


5 Work-arounds we tried

  • Catch exception and fall back to “send original” → saves crash, but no compression.

  • VideoCompress.setDeleteAudio(true) on black-listed models → works (bug sits in AAC track) but kills audio.

  • Local fork with one-liner guard

    if (bufferInfo.presentationTimeUs < 0) return
    

    → fully resolves the issue on LG V40.

All work-arounds disappear if we just bump Transcoder.


6 Proposed fix

// android/build.gradle (library module)
implementation "io.deepmedia.community:transcoder-android:0.11.2"
// or at minimum 0.10.11

No API or pro-guard changes; build size delta is <15 kB.


Thanks

Happy to provide more logs or a sample project.
Upgrading the dependency would eliminate hundreds of daily crashes for legacy-flagship users while leaving everyone else untouched.

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