2
0
telebot-reverser/reverser.js

23 lines
548 B
JavaScript
Raw Normal View History

2019-11-14 00:19:07 +01:00
const path = require('path');
const ffmpeg = require('fluent-ffmpeg');
const {path: ffPath} = require('@ffmpeg-installer/ffmpeg');
ffmpeg.setFfmpegPath(ffPath);
const reverse = file => {
return new Promise((resolve, reject) => {
const basename = path.basename(file);
const savepath = path.join(__dirname, '../outputs', 're-' + basename);
ffmpeg(file)
.videoFilter('reverse')
.on('error', error => reject(error))
.on('end', async () => resolve({
path: savepath
}))
.save(savepath);
});
};
module.exports = {
reverse
};