Giter VIP home page Giter VIP logo

react-native-fu-video-compress's Introduction

react-native-fu-video-compress

安装方法,

yarn add react-native-fu-video-compress

使用方法示例,真机测试没问题,模拟器上压缩视频会报错,java不是很懂,没有去认真排查问题,有发现是什么问题欢迎联系

import videoCompress from "react-native-fu-video-compress";


const InputVideoPath = "/storage/emulated/0/DCIM/Camera/1.mp3";
const OutputVideoPath = "/storage/emulated/0/DCIM/Camera/temp_1.mp3";
const cmd = "-y -i " + InputVideoPath + " -s 960x540 -strict -2 -vcodec libx264 -preset faster " +
			"-crf 24 -acodec aac -ar 44100 -ac 2 -b:a 96k -vf transpose=1 -aspect 16:9 " + OutputVideoPath;
videoCompress.compress(InputVideoPath, OutputVideoPath, cmd, (status, outPath, size)=>{
//status, outPath, size
 if(status && size <= 2){
  const uri = 'file://'+outPath;
 }else if(status && size > 2){
  Alert.alert('压缩后大于2M,请重新选择视频');
 }else{
  Alert.alert('压缩失败');
 }
});

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.