我正在使用fluent-ffmpeg将用户上传到Firebase的视频压缩到1000k比特率。
console.log("Compressed File Path: " + compressedVideoFilePath);
const command = ffmpeg(tempFilePath).setFfmpegPath(ffmpegStatic.path)
.videoBitrate(1000)
//.audioChannels(1)
//.audioFrequency(16000)
//.format('flac')
.on('error', function(err) {
console.log('An error occurred: ' + err.message);
})
.on('end', function() {
console.log('Processing finished!');
console.log("File compressed");
return destBucket.upload(compressedVideoFilePath, {
destination: 'compressed-' + path.basename(filePath),
metadata: metadata
}).then(() => {
console.log('Output audio uploaded to', targetStorageFilePath);
// Once the audio has been uploaded delete the local file to free up disk space.
fs.unlinkSync(tempFilePath);
fs.unlinkSync(targetTempFilePath);
console.log('Temporary files removed.', targetTempFilePath);
});
})
.save(compressedVideoFilePath);
console.log("Function Finished");
但是,ffmpeg中的代码无法运行,控制台的输出仅为:
Compressed File Path: /tmp/compressed-test-4d68b02f-a6ef-4ff3-a5c9-52687fd3f0c4.mp4
Function Finished
Function execution took 17871 ms, finished with status: 'ok'
它只是跳到结尾而没有在结尾或成功消息上显示任何内容。压缩的视频文件也没有出现在Firebase中/没有被上传。
有人可以帮助我找出问题并帮助我解决吗? ffmpeg的代码不正确吗?谢谢。