What is react-native-video-trim?
react-native-video-trim is a React Native library for trimming video and audio files. It gives you two ways to work with media:
- A native editor screen.
showEditor()presents a full-screen trimmer with a thumbnail timeline (or an audio waveform), playback, zoom, an edit toolbar (flip, rotate, crop, mute, speed, undo, redo) and save or cancel confirmations. The user picks the range; you get the output file through events. - Headless APIs. Functions such as
trim(),compress(),merge()andmixAudio()process files without any UI and return a Promise.
Media processing runs on FFmpegKit on both platforms. Whenever video has to be re-encoded, the library uses the hardware H.264 encoder, with automatic fallbacks on Android.
Platforms and architectures
| Support | |
|---|---|
| iOS | Yes (Swift, AVFoundation, FFmpegKit) |
| Android | Yes (Kotlin, MediaCodec, FFmpegKit), min SDK 24 |
| New Architecture (TurboModules) | Yes |
| Old Architecture (Bridge) | Yes, see Old Architecture |
| Expo | Development builds and expo prebuild. Not Expo Go. |
What you can do
| Feature | Where |
|---|---|
| Trim video and audio with a visual timeline | Editor, trim() |
| Audio waveform for audio files | Audio trimming |
| Flip, rotate 90°, freeform crop, undo and redo | Transforms |
| Frame-accurate cuts | Precise trimming |
| Remove the audio track, change speed (0.25x to 4x) | Speed and mute |
| Compress with presets or explicit bitrate and size | compress() |
| Grab a frame as JPEG or PNG | getFrameAt() |
| Extract the audio track | extractAudio() |
| Convert a segment to GIF | toGif() |
| Concatenate clips | merge() |
| Add background music or a voice-over | mixAudio() |
| Save to Photos, Documents, share sheet | Files and saving |
| Dark and light theme, custom colors | Theming |
| HTTPS sources | Remote files |
How the pieces fit
text
your app ── showEditor(uri, options) ──▶ native editor ──▶ events (onLoad, onFinishTrimming, onError, ...)
── trim / compress / merge ... ──▶ FFmpegKit ──▶ Promise<{ outputPath, ... }>
── saveToPhoto / saveToDocuments / share / deleteFile ──▶ output filesEvery API that produces a file returns or reports its absolute outputPath. Editor and trim() outputs are kept until you delete them; the other headless APIs write to the cache directory. See Files and saving.
Next steps
- Install the library
- Open the editor in five minutes
- Browse the generated API reference
Credits
The Android editor is based on Android-Video-Trimmer and the iOS UI on VideoTrimmerControl.