6.0.3 • Published 16 days ago
@sheehanmunim/react-native-ffmpeg v6.0.3
React Native FFmpeg 🎥⚡
The ultimate zero-configuration FFmpeg solution for React Native and Expo projects.
This package combines ffmpeg-kit-react-native
with all necessary fixes and dependencies, providing a single-install solution that just works.
🚀 Features
- ✅ Complete FFmpeg functionality - All features from ffmpeg-kit-react-native
- ✅ Zero configuration - No manual setup required
- ✅ Automatic dependency resolution - Includes smart-exception-java fix
- ✅ Android & iOS support - Works on both platforms
- ✅ Expo compatibility - Perfect for Expo projects
- ✅ Drop-in replacement - Same API as original ffmpeg-kit-react-native
📦 Installation
That's it! One command:
npm install @sheehanmunim/react-native-ffmpeg
No more:
- ❌ Manual dependency fixes
- ❌ Gradle configuration
- ❌ JAR file copying
- ❌ Maven repository setup
- ❌ Build failures
🎯 Usage
Use exactly the same API as the original ffmpeg-kit-react-native:
import FFmpegKit from "@sheehanmunim/react-native-ffmpeg";
// Everything works exactly the same!
FFmpegKit.execute("-i input.mp4 -c:v libx264 output.mp4").then((session) => {
const returnCode = session.getReturnCode();
if (returnCode.isValueSuccess()) {
console.log("FFmpeg process completed successfully");
}
});
🔧 What's Included
Core Functionality
- Full FFmpeg command execution
- Session management
- Media information extraction
- Multiple output formats
- Hardware acceleration support
Auto-Applied Fixes
- smart-exception-java - Resolves Android compilation errors
- Maven repository setup - Ensures dependency resolution
- Gradle configuration - Automatic build.gradle modification
- JAR fallback - Local JAR files as backup
Platform Support
- Android - All architectures (arm64-v8a, armeabi-v7a, x86, x86_64)
- iOS - All architectures (arm64, x86_64)
- Expo - Full compatibility with Expo development workflow
🎯 Migration Guide
From ffmpeg-kit-react-native
Before:
{
"dependencies": {
"ffmpeg-kit-react-native": "6.0.2"
}
}
After:
{
"dependencies": {
"@sheehanmunim/react-native-ffmpeg": "6.0.3"
}
}
Then update your imports:
// Before
import FFmpegKit from "ffmpeg-kit-react-native";
// After
import FFmpegKit from "@sheehanmunim/react-native-ffmpeg";
🚀 Quick Start
Install:
npm install @sheehanmunim/react-native-ffmpeg
Use immediately:
import FFmpegKit from "@sheehanmunim/react-native-ffmpeg"; FFmpegKit.execute("-version").then((session) => { console.log("FFmpeg version:", session.getOutput()); });
Build and run:
npx expo run:android # Just works! npx expo run:ios # Just works!
🏗️ How It Works
This package:
- Wraps ffmpeg-kit-react-native - Provides 100% API compatibility
- Auto-detects your project - Finds React Native/Expo projects automatically
- Applies fixes during install - Postinstall script handles all configuration
- Bundles dependencies - Includes smart-exception-java and other fixes
- Validates setup - Ensures everything is configured correctly
🔍 Troubleshooting
Build Still Failing?
The package automatically handles 99% of issues, but if you still have problems:
Clean and rebuild:
cd android && ./gradlew clean && cd .. npx expo run:android
Check the logs - Installation should show:
🚀 FFmpeg Kit React Native Complete - Setting up... ✅ Added smart-exception-java dependency ✅ Added mavenLocal repository 🎉 Setup finished!
Manual verification: Check if
android/app/build.gradle
contains:dependencies { implementation 'com.arthenica:smart-exception-java:0.2.1' // ... other dependencies }
Still Need Help?
Create an issue with:
- Your
package.json
- Your
android/app/build.gradle
- Full error logs
- Platform (Android/iOS/Expo)
📋 Requirements
- React Native >= 0.60.0
- Node.js >= 12.0.0
- Android API Level 21+ (Android 5.0+)
- iOS 12.4+
🎯 Examples
Video Compression
import FFmpegKit from "@sheehanmunim/react-native-ffmpeg";
const compressVideo = async (inputPath, outputPath) => {
const command = `-i ${inputPath} -c:v libx264 -crf 23 -c:a aac -b:a 128k ${outputPath}`;
const session = await FFmpegKit.execute(command);
const returnCode = session.getReturnCode();
if (returnCode.isValueSuccess()) {
console.log("Video compressed successfully!");
} else {
console.error("Compression failed");
}
};
Extract Audio
import FFmpegKit from "@sheehanmunim/react-native-ffmpeg";
const extractAudio = async (videoPath, audioPath) => {
const command = `-i ${videoPath} -vn -acodec copy ${audioPath}`;
await FFmpegKit.execute(command);
};
Get Media Information
import { FFprobeKit } from "@sheehanmunim/react-native-ffmpeg";
const getMediaInfo = async (filePath) => {
const session = await FFprobeKit.getMediaInformation(filePath);
const mediaInformation = session.getMediaInformation();
console.log("Duration:", mediaInformation.getDuration());
console.log("Format:", mediaInformation.getFormat());
};
📄 License
LGPL-3.0 (same as original ffmpeg-kit-react-native)
🙏 Credits
- FFmpeg - The amazing multimedia framework
- Arthenica - Original ffmpeg-kit creators (now retired)
- Community - For keeping FFmpeg alive in React Native
🎉 Enjoy zero-configuration FFmpeg in React Native!
6.0.3
16 days ago