Skip to content

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() and mixAudio() 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
iOSYes (Swift, AVFoundation, FFmpegKit)
AndroidYes (Kotlin, MediaCodec, FFmpegKit), min SDK 24
New Architecture (TurboModules)Yes
Old Architecture (Bridge)Yes, see Old Architecture
ExpoDevelopment builds and expo prebuild. Not Expo Go.

What you can do ​

FeatureWhere
Trim video and audio with a visual timelineEditor, trim()
Audio waveform for audio filesAudio trimming
Flip, rotate 90°, freeform crop, undo and redoTransforms
Frame-accurate cutsPrecise trimming
Remove the audio track, change speed (0.25x to 4x)Speed and mute
Compress with presets or explicit bitrate and sizecompress()
Grab a frame as JPEG or PNGgetFrameAt()
Extract the audio trackextractAudio()
Convert a segment to GIFtoGif()
Concatenate clipsmerge()
Add background music or a voice-overmixAudio()
Save to Photos, Documents, share sheetFiles and saving
Dark and light theme, custom colorsTheming
HTTPS sourcesRemote 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 files

Every 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 ​

Credits ​

The Android editor is based on Android-Video-Trimmer and the iOS UI on VideoTrimmerControl.

Released under the MIT License.