🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

react-native-ffmpeg

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-ffmpeg

FFmpeg for React Native

0.1.0
Source
npm
Version published
Maintainers
1
Created
Source

React Native FFmpeg Join the chat at https://gitter.im/react-native-ffmpeg/Lobby npm

FFmpeg for React Native

1. Features

  • Based on MobileFFmpeg
  • Supports both Android and IOS
  • Includes eight different packages with different external libraries enabled in FFmpeg
minmin-gplhttpshttps-gplaudiovideofullfull-gpl
-vid.stab
x264
x265
xvidcore
gnutlsgnutls
vid.stab
x264
x265
xvidcore
chromaprint
lame
libilbc
libvorbis
opencore-amr
opus
shine
soxr
speex
wavpack
fontconfig
freetype
fribidi
kvazaar
libaom
libass
libiconv
libtheora
libvpx
snappy
chromaprint
fontconfig
freetype
fribidi
gmp
gnutls
kvazaar
lame
libaom
libass
libiconv
libilbc
libtheora
libvorbis
libvpx
libwebp
libxml2
opencore-amr
opus
shine
snappy
soxr
speex
wavpack
chromaprint
fontconfig
freetype
fribidi
gmp
gnutls
kvazaar
lame
libaom
libass
libiconv
libilbc
libtheora
libvorbis
libvpx
libwebp
libxml2
opencore-amr
opus
shine
snappy
soxr
speex
vid.stab
wavpack
x264
x265
xvidcore

2. Installation

$ npm install react-native-ffmpeg --save

2.1 Android

$ react-native link react-native-ffmpeg

2.2 iOS

  • Add react-native-ffmpeg pod to your Podfile

    pod 'react-native-ffmpeg', :podspec => '../node_modules/react-native-ffmpeg/ios/react-native-ffmpeg.podspec'
    
  • Run pod install

2.3 Using Packages

Default installation of ReactNativeFFmpeg using instructions in 2.1 and 2.2 enables the default package, which is based on https package. It is possible to enable other installed packages using following steps.

2.3.1 Android

  • Edit android/settings.gradle file and modify projectDir for react-native-ffmpeg by appending package name at the end of the path.
    project(':react-native-ffmpeg').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-ffmpeg/android/<package name>')
    

2.3.2 IOS

  • Edit ios/Podfile file and modify podspec path for react-native-ffmpeg by appending package name at the end of the name. After that run pod install again.
    pod 'react-native-ffmpeg-<package name>', :podspec => '../node_modules/react-native-ffmpeg/ios/react-native-ffmpeg-<package name>.podspec'
    

3. Using

  • Create and execute commands.

    import { LogLevel, RNFFmpeg } from 'react-native-ffmpeg';
    
    RNFFmpeg.execute('-i file1.mp4 -c:v mpeg4 file2.mp4').then(data => {
        console.log("FFmpeg process exited with rc " + data.rc);
    });
    
  • Stop an ongoing operation.

    RNFFmpeg.cancel();
    
  • Enable log callback.

    logCallback = (logData) => {
        console.log(logData.log);
    };
    ...
    RNFFmpeg.enableLogCallback(this.logCallback);
    
  • Enable statistics callback.

    statisticsCallback = (statisticsData) => {
        console.log('Statistics; frame: ' + statisticsData.videoFrameNumber.toFixed(1) + ', fps: ' + statisticsData.videoFps.toFixed(1) + ', quality: ' + statisticsData.videoQuality.toFixed(1) +
        ', size: ' + statisticsData.size + ', time: ' + statisticsData.time);
    };
    ...
    RNFFmpeg.enableStatisticsCallback(this.statisticsCallback);
    
  • Set log level.

    RNFFmpeg.setLogLevel(LogLevel.AV_LOG_WARNING);
    
  • Register custom fonts directory.

    RNFFmpeg.setFontDirectory('<folder with fonts>');
    

4. Test Application

You can see how React Native FFmpeg is used inside an application by running test application provided under test-app folder. Current implementation performs command execution and video encoding operations.

5. License

This project is licensed under the LGPL v3.0. However, if installation is customized to use a package with -gpl postfix (min-gpl, https-gpl, full-gpl) then ReactNativeFFmpeg is subject to the GPL v3.0 license.

Digital assets used in test applications are published in the public domain.

6. Contributing

Feel free to submit issues or pull requests.

7. See Also

Keywords

react-native

FAQs

Package last updated on 16 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts