日期:2021/05/27 天气:晴
背景描述
ios拍摄视频默认格式是.MOV格式,上传视频回显的时候,只有声音没有视频,所以需要把上传默认的.MOV格式转换为.MP4格式
const ffmpegInstaller = require('@ffmpeg-installer/ffmpeg');
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegInstaller.path);
// IMG_1046.MOV是要上传的视频
ffmpeg('IMG_1046.MOV')
.format('mp4')
.on('error', function(err) {
console.log('An error occurred: ' + err.message);
})
.on('end', function() {
console.log('Processing finished !');
})
.save('output.mp4');