2
0
telebot-reverser/reverser.js

23 lines
535 B
JavaScript
Raw Permalink Normal View History

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