forked from Supositware/Haha-Yes
change the level of compression
This commit is contained in:
parent
6e64d70f0e
commit
867dda551d
1 changed files with 11 additions and 3 deletions
|
@ -18,6 +18,12 @@ class vidshittifyerCommand extends Command {
|
||||||
{
|
{
|
||||||
id: 'compresion',
|
id: 'compresion',
|
||||||
type: 'string'
|
type: 'string'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'watermark',
|
||||||
|
match: 'flag',
|
||||||
|
flag: '--watermark'
|
||||||
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
description: {
|
description: {
|
||||||
|
@ -32,11 +38,13 @@ class vidshittifyerCommand extends Command {
|
||||||
let input = `${os.tmpdir()}/${message.id}.mp4`;
|
let input = `${os.tmpdir()}/${message.id}.mp4`;
|
||||||
let output = `${os.tmpdir()}/Shittifyed${message.id}.mp4`;
|
let output = `${os.tmpdir()}/Shittifyed${message.id}.mp4`;
|
||||||
let compression;
|
let compression;
|
||||||
|
let option = `-b:v ${compression} -b:a ${compression}`;
|
||||||
|
|
||||||
if (args.link) {
|
if (args.link) {
|
||||||
if (args.compression == 1) {
|
if (args.compression == 1) {
|
||||||
compression = '1m';
|
compression = '10m';
|
||||||
} else if (args.compression == 2) {
|
} else if (args.compression == 2) {
|
||||||
compression = '50k';
|
compression = '5m';
|
||||||
} else {
|
} else {
|
||||||
compression = '10k';
|
compression = '10k';
|
||||||
}
|
}
|
||||||
|
@ -47,7 +55,7 @@ class vidshittifyerCommand extends Command {
|
||||||
});
|
});
|
||||||
video.pipe(fs.createWriteStream(input));
|
video.pipe(fs.createWriteStream(input));
|
||||||
video.on('end', function () {
|
video.on('end', function () {
|
||||||
exec(`ffmpeg -i ${input} -b:v ${compression} -b:a ${compression} -vcodec libx264 -r 5 -r 15 ${output}`)
|
exec(`ffmpeg -i ${input} ${option} -vcodec libx264 -r 5 -r 15 ${output}`)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
message.delete();
|
message.delete();
|
||||||
return message.channel.send({files: [output]})
|
return message.channel.send({files: [output]})
|
||||||
|
|
Loading…
Reference in a new issue