Current behavior
When using VideoCompressor.compress() with maxSize: 1080 on Android, the compressed video file becomes corrupted/unplayable. The compressed video:
- Shows a black screen when played with
react-native-video (ExoPlayer)
- Throws
ExoPlaybackException: ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED error
- Results in error message: "None of the available extractors could read the stream."
- The file appears to exist and has a size of 28 (which is weird), but is not in a valid/playable format
This occurs specifically when the maxSize parameter is set. When maxSize is removed (using only bitrate and compressionMethod: 'manual'), compression works correctly.
Code example:
const compressedVideoUri = await VideoCompressor.compress(file.uri, {
compressionMethod: 'manual',
maxSize: 1080, // This causes corruption
minimumFileSizeForCompress: 15,
bitrate: 5_000_000,
});
Expected behavior
The compressed video should be playable with react-native-video on Android, maintaining proper container format and codec compatibility with ExoPlayer. The maxSize parameter should resize the video resolution without corrupting the file format.
Platform
(Note: Issue confirmed on Android; iOS had no issues with the configuration, but used different videos, not sure if this can be the cause but don't think so)
React Native Version
0.75.4
React Native Compressor Version
1.13.0
Reproducible Steps And Demo
- Pick a video file from the device library using
react-native-image-picker
- Compress the video using the configuration above with
maxSize: 1080
- Attempt to play the compressed video using
react-native-video on Android
- Observe: Black screen and ExoPlayer error
ERROR_CODE_PARSING_CONTAINER_UNSUPPORTED
Workaround: Remove maxSize parameter, and compression works correctly (only using bitrate reduction).
Tested video files: MP4 format, various resolutions (1080p and above), file sizes > 15MB.
Current behavior
When using
VideoCompressor.compress()withmaxSize: 1080on Android, the compressed video file becomes corrupted/unplayable. The compressed video:react-native-video(ExoPlayer)ExoPlaybackException: ERROR_CODE_PARSING_CONTAINER_UNSUPPORTEDerrorThis occurs specifically when the
maxSizeparameter is set. WhenmaxSizeis removed (using onlybitrateandcompressionMethod: 'manual'), compression works correctly.Code example:
Expected behavior
The compressed video should be playable with
react-native-videoon Android, maintaining proper container format and codec compatibility with ExoPlayer. ThemaxSizeparameter should resize the video resolution without corrupting the file format.Platform
(Note: Issue confirmed on Android; iOS had no issues with the configuration, but used different videos, not sure if this can be the cause but don't think so)
React Native Version
0.75.4
React Native Compressor Version
1.13.0
Reproducible Steps And Demo
react-native-image-pickermaxSize: 1080react-native-videoon AndroidERROR_CODE_PARSING_CONTAINER_UNSUPPORTEDWorkaround: Remove
maxSizeparameter, and compression works correctly (only using bitrate reduction).Tested video files: MP4 format, various resolutions (1080p and above), file sizes > 15MB.