+ transcodeOriginalVideofile,
+ mergeAudioVideofile
+}
+
+// ---------------------------------------------------------------------------
+
+async function onVideoFileTranscoding (video: VideoModel, videoFile: VideoFileModel, transcodingPath: string, outputPath: string) {
+ const stats = await stat(transcodingPath)
+ const fps = await getVideoFileFPS(transcodingPath)
+
+ await move(transcodingPath, outputPath)
+
+ videoFile.set('size', stats.size)
+ videoFile.set('fps', fps)
+
+ await video.createTorrentAndSetInfoHash(videoFile)
+
+ const updatedVideoFile = await videoFile.save()
+
+ // Add it if this is a new created file
+ if (video.VideoFiles.some(f => f.id === videoFile.id) === false) {
+ video.VideoFiles.push(updatedVideoFile)
+ }
+
+ return video