代码拉取完成,页面将自动刷新
const path = require('path');
const fs = require('fs-extra');
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(path.join(__dirname, 'sys-lib/ffmpeg-2023-06-27/bin/ffmpeg.exe'));
const ProgressBar = require('cli-progress');
let progress_bar = new ProgressBar.Bar({
// 'progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total} | Speed: {speed}'
format: 'Saving: [{bar}] {percentage}% | {currentKbps} kb/s | {timemark}'
});
const in_path = `C:/Users/zzw-fe/Desktop/screencast-20_30_1_118_8802-2024_07_12-10_28_27.webm`;
const out_path = `C:/Users/zzw-fe/Desktop/screencast-20_30_1_118_8802-2024_07_12-10_28_27.mp4`;
let res_video = ffmpeg(in_path).output(out_path);
progress_bar.start(100, 0, {
currentKbps: 0,
timemark: '00:00:00.00'
});
res_video.on('error', err => {
console.error(err.message);
});
res_video.on('progress', progress => {
progress_bar.update(progress.percent, progress);
});
res_video.on('end', () => {
try {
progress_bar.stop();
} catch (error) {
//
}
console.log('Success.');
});
res_video.run();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。