delete old file
This commit is contained in:
parent
8f823cd3e2
commit
f5da511b9e
1 changed files with 8 additions and 0 deletions
|
@ -75,11 +75,19 @@ const reduceSize = (file: string, bitrate: number) => {
|
||||||
|
|
||||||
const finalFile = getNewFilename(file, "Compressed - ");
|
const finalFile = getNewFilename(file, "Compressed - ");
|
||||||
|
|
||||||
|
/* TODO: Keep all the audio tracks */
|
||||||
child_process.execSync(
|
child_process.execSync(
|
||||||
`${ffmpegPath} -y -i "${file}" -c:v libx264 -b:v ${videoBitrate}k -pass 1 -an -f null ${nul} ${and} \
|
`${ffmpegPath} -y -i "${file}" -c:v libx264 -b:v ${videoBitrate}k -pass 1 -an -f null ${nul} ${and} \
|
||||||
${ffmpegPath} -y -i "${file}" -c:v libx264 -b:v ${videoBitrate}k -pass 2 -c:a aac -b:a ${audioBitrate}k "${finalFile}"`
|
${ffmpegPath} -y -i "${file}" -c:v libx264 -b:v ${videoBitrate}k -pass 2 -c:a aac -b:a ${audioBitrate}k "${finalFile}"`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Delete the old file
|
||||||
|
unlink(file, (err) => {
|
||||||
|
if (err) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return finalFile;
|
return finalFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue