- console.log('Optimizing video file %s with bitrate %s kbps (max: %s kbps)',
- basename(currentFile), videoBitrate / 1000, maxBitrate / 1000)
- const backupFile = `${currentFile}_backup`
- await copy(currentFile, backupFile)
- await optimizeVideofile(video, file)
+ console.log(
+ 'Optimizing video file %s with bitrate %s kbps (max: %s kbps)',
+ basename(currentFilePath), videoBitrate / 1000, maxBitrate / 1000
+ )
+
+ const backupFile = `${currentFilePath}_backup`
+ await copy(currentFilePath, backupFile)
+
+ await optimizeOriginalVideofile(video, file)
+ // Update file path, the video filename changed
+ currentFilePath = getVideoFilePath(video, file)
+