From f5da511b9e1560d3f51ae0eefae242ce78b622bb Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 30 Jul 2023 13:46:07 +0200 Subject: [PATCH] delete old file --- src/main.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.ts b/src/main.ts index 43e8b92..6c3f7dc 100644 --- a/src/main.ts +++ b/src/main.ts @@ -75,11 +75,19 @@ const reduceSize = (file: string, bitrate: number) => { const finalFile = getNewFilename(file, "Compressed - "); + /* TODO: Keep all the audio tracks */ 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 2 -c:a aac -b:a ${audioBitrate}k "${finalFile}"` ); + // Delete the old file + unlink(file, (err) => { + if (err) { + throw err; + } + }); + return finalFile; };