用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); }); })