我正在使用 ffmpeg 从它按预期工作的视频中提取屏幕截图,但该文件无法使用 fs.read 读取/缓冲,稍后我将不得不将图像上传到 s3 存储桶,那么我可以制作文件可读?
var thumPath = path.join(global.__base, 'Temp/');
ffmpeg(req.file.path).screenshots({
count: 1,
filename: req.file.filename + 'thumbnail-at-%s-seconds.png',
folder: thumPath,
size: '320x240'
});
fs.readFile(thumPath + req.file.filename + 'thumbnail-at-%s-seconds.png', function(err, thumb) {
console.log(thumb)
//s3 bucket feature will come
})
最佳答案
阅读 https://github.com/damianociarla/node-ffmpeg
的文档该函数需要回调,该回调在 ffmpeg 停止工作(错误或正确)后执行,然后才能检查文件。
你现在要做的是:
关于node.js - fs.readFile 无法在 nodejs 中使用 ffmpeg 读取缩略图生成的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55528906/