diff --git a/dist/index.js b/dist/index.js index 20bcefb..7f2e6db 100644 --- a/dist/index.js +++ b/dist/index.js @@ -42,14 +42,17 @@ app.post("/uploadVideo", async (req, res) => { const fileStream = fs.createWriteStream(targetPath); uploadingFile.pipe(fileStream); fileStream.on("close", () => { - console.log(`Completed upload ${fileInfo.filename}`); + console.log(`Completed upload ${videoId}`); const ffmpegCommand = `ffmpeg -y -loglevel error -i "${targetPath}" -c:v libx264 -crf 23 -preset medium -movflags +faststart -c:a aac -b:a 128k ${formattedPath}`; currentlyExecFfmpeg = true; execPromise(ffmpegCommand).then(async ({ stdout, stderr }) => { if (stderr && stderr.length > 0) console.log("FFmpeg stderr:", stderr); await minioClient.fPutObject("videos-garage", videoId, formattedPath); + console.log(`Size - Old: ${fs.statSync(targetPath).size / (1024 * 1024)} New: ${fs.statSync(formattedPath).size / (1024 * 1024)}`); + fs.unlinkSync(targetPath); fs.unlinkSync(formattedPath); console.log(await minioClient.presignedGetObject("videos-garage", videoId, 24 * 60 * 60)); + console.log(""); }).catch((error) => { console.log("FFmpeg caught error:", error); }).finally(() => { diff --git a/src/index.ts b/src/index.ts index 414ee2f..1fe2ffc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -74,6 +74,11 @@ app.post("/uploadVideo", async (req, res) => { videoId, formattedPath ); + console.log( + `Size - Old: ${ + fs.statSync(targetPath).size / (1024 * 1024) + } New: ${fs.statSync(formattedPath).size / (1024 * 1024)}` + ); fs.unlinkSync(targetPath); fs.unlinkSync(formattedPath); console.log( @@ -83,6 +88,7 @@ app.post("/uploadVideo", async (req, res) => { 24 * 60 * 60 ) ); + console.log(""); }) .catch((error) => { console.log("FFmpeg caught error:", error);