๐งฉ Description
Since support for the FFmpeg library has ended, I switched to using react-native-compressor.
However, even though the output file size is larger compared to FFmpeg, the video quality is significantly lower โ it becomes blurry during scene transitions and overall looks degraded.
๐ฅ Original Video Metadata (QuickTime)
File Information
- Resolution: 1080 ร 2340
- File size: 203.2 MB
- Bitrate: 13.61 Mbit/s
- Video Format: H.264
- Audio Format: MPEG-4 AAC, 48 000 Hz
Video Details
- Encoded frame rate: 24.19 fps
- Data rate: 13.32 Mbit/s
- Color values: ITU-R BT.709
- Transfer function: ITU-R BT.709
- YCbCr matrix: ITU-R BT.709
Audio Details
- Language: Unknown
- Data rate: 287.97 kbit/s
- Channels: Mono
- Track number: 1
๐งฎ FFmpeg Compression
let encodeScaleCommand = '';
if (videoWidth >= 640) {
encodeScaleCommand = '-vf "scale=480:-2" ';
if (videoWidth >= 720) {
encodeScaleCommand = '-vf "scale=360:-2" ';
}
}
const encodeFFMpegCommand = `-i ${videoUri} -c:v libx264 ${encodeScaleCommand}${encodeDestination}`;
FFmpeg Encoded Video Metadata
File Information
- Resolution: 360 ร 780
- File size: 4.6 MB
- Bitrate: 300.58 kbit/s
- Current Dimensions: 1448 ร 3137
- Video Format: H.264
- Audio Format: MPEG-4 AAC, 48 000 Hz
Video Details
- Encoded frame rate: 24.25 fps
- Data rate: 299.06 kbit/s
- Current scale: 4.02ร
- Color values: Unspecified
- Transfer function: Unspecified
- YCbCr matrix: Unspecified
- Code points: Unspecified
- Track number: 1
Audio Details
- Language: English
- Data rate: 1.52 kbit/s
- Channels: Mono
- Track number: 2
๐งฉ react-native-compressor Compression
const isPortrait = videoHeight > videoWidth;
if (isPortrait) {
maxSize = 780;
newWidth = (maxSize / videoHeight * videoWidth);
}
const compressedVideo = await Video.compress(
videoUri,
{
compressionMethod: "manual",
maxSize,
bitrate: 300000
}
);
react-native-compressor Encoded Video Metadata
File Information
- Resolution: 360 ร 780
- File size: 9 MB
- Bitrate: 602.15 kbit/s
- Current Dimensions: 720 ร 1560
- Video Format: H.264
- Audio Format: MPEG-4 AAC, 48 000 Hz
Video Details
- Encoded frame rate: 24.23 fps
- Data rate: 314.18 kbit/s
- Current scale: Double
- Color values: EBU Tech 3213
- Transfer function: ITU-R BT.709
- Code points: (5โ1โ5)
- Track number: 1
Audio Details
- Language: English
- Data rate: 287.96 kbit/s
- Channels: Mono
- Track number: 2
โ ๏ธ Issue Summary
Compared to FFmpeg, the react-native-compressor output:
- Produces larger file sizes (9 MB vs 4.6 MB)
- Has worse visual quality, especially visible during video transitions
- Appears blurry and less sharp
๐ง Expected Behavior
A compressed video with comparable quality to FFmpeg output at similar or smaller file size.
๐ป Environment
- Platform: Android
- Library:
react-native-compressor
- Compression method: manual
- React Native version: 0.77.3
๐งฉ Description
Since support for the FFmpeg library has ended, I switched to using react-native-compressor.
However, even though the output file size is larger compared to FFmpeg, the video quality is significantly lower โ it becomes blurry during scene transitions and overall looks degraded.
๐ฅ Original Video Metadata (QuickTime)
File Information
Video Details
Audio Details
๐งฎ FFmpeg Compression
FFmpeg Encoded Video Metadata
File Information
Video Details
Audio Details
๐งฉ react-native-compressor Compression
react-native-compressor Encoded Video Metadata
File Information
Video Details
Audio Details
Compared to FFmpeg, the
react-native-compressoroutput:๐ง Expected Behavior
A compressed video with comparable quality to FFmpeg output at similar or smaller file size.
๐ป Environment
react-native-compressor