快速裁剪视频工具ffmpeg

用brew安装ffmpeg

brew install ffmpeg

然后用npm的包node-ffmpeg: https://www.npmjs.com/package/ffmpeg

用node控制ffmpeg

const ffmpeg = require('ffmpeg');

console.log('begin');

const precess = new ffmpeg('./test.mp4')

precess.then(video => {
    video.setVideoSize('750x1334', false, false, '#ffffff').save('./your_movie.mp4', function (error, file) {
        console.log(file)
        console.log('saved')
        if (error) console.log(error);
    });
})

 

posted @ 2020-08-24 18:42  张啊咩  阅读(445)  评论(0编辑  收藏  举报