我使用ffmpeg.ffprobe在Node JS上获取视频的持续时间数据,但我得到了Cannot find ffprobe错误。
'''
function video_control(video) {
var path = video.path
ffmpeg.setFfmpegPath(require("@ffmpeg-installer/ffmpeg").path);
ffmpeg.ffprobe(path, (err, metadata) => {
if (err) {
console.log(err);
} else {
const duration = metadata.format.duration;
console.log(duration);
}
});
}
//By the way, I was using this structure to get the duration data of the video, but I wanted to use ffmpeg because it created errors in some webm format videos.
const { getVideoDurationInSeconds } = require('get-video-duration')
getVideoDurationInSeconds(path).then(async (duration) => {});
字符串
'''
1条答案
按热度按时间bvuwiixz1#
@ffmpeg-installer/ffmpeg只为你安装ffmpeg而不是ffprobe,你需要ffprobe-installer
然后像下面这样加载
字符串