react-native-video-processing

Migrating from 1.x to 3.0

3.0 is a rewrite for the React Native New Architecture. (2.0.0 on npm is an old build of the 1.x code; skip it.) The native code is new, the API is new, and both platforms now behave the same.

Installation

Remove every manual step from 1.x:

Removed

1.x 3.0
<VideoPlayer /> Removed. Use react-native-video or expo-video for playback.
ProcessingManager Replaced by top-level functions, e.g. ProcessingManager.trim → trim.
merge(files, ffmpegCommand) (Android) merge(files). Raw ffmpeg commands are no longer supported.
GPUImage filters (iOS) Removed. Filters will return as a cross-platform option on process.
quality presets (VideoPlayer.Constants.quality) Use width/height and bitrate.
saveToCameraRoll, saveWithCurrentDate Removed. Save the returned URI with @react-native-camera-roll/camera-roll or expo-media-library.
cameraType (boomerang) Removed. Orientation is read from the file.

Changed

1.x 3.0
getVideoInfo returned size: { width, height } (shape differed per platform) Returns width and height in display orientation, plus rotation, frameRate, bitrate, fileSize, hasAudio and videoCodec.
getPreviewForSecond(source, second, maxSize, format) resolved base64 getThumbnail(source, time, { maxWidth, maxHeight, format }) resolves { uri, time, width, height } with a file:// image.
getTrimmerPreviewImages(source, start, end, step) getThumbnails(source, { count, startTime, endTime }) or getThumbnails(source, { times: [...] }).
compress({ width, height, bitrateMultiplier, minimumBitrate }) compress({ width, height, bitrate }). width/height are a bounding box: the aspect ratio is kept and video is never upscaled.
crop options mixed the rect and times crop(source, { x, y, width, height }, { startTime, endTime }), in display pixels.
Results were a path, { source } or a callback, depending on platform Every operation resolves { uri }, a file:// URI of an H.264/AAC MP4 in the cache directory.
Android times were "HH:MM:SS" strings internally All times are seconds (numbers) on both platforms.

Trimmer

The iOS-only native trimmer and the Android-only JS trimmer are replaced by one TypeScript component.

1.x prop 3.0
source source (also accepts { uri } and require())
onChange({ startTime, endTime }) onChange while dragging, onChangeEnd on release
minLength, maxLength minDuration, maxDuration
currentTime, trackerColor currentTime, playheadColor
themeColor, height themeColor, height
width Fills its container; size it with style.
thumbWidth, borderWidth, showTrackerHandle, trackerHandleColor, onTrackerMove Removed. handleWidth sets the handle size.

New