23 lines
548 B
JavaScript
23 lines
548 B
JavaScript
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
|
|
}; |