delete old file

This commit is contained in:
Mylloon 2023-07-30 13:46:07 +02:00
parent 8f823cd3e2
commit f5da511b9e
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -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;
}; };