+function getHLSVideoPath (options: TranscodeOptions) {
+ return `${dirname(options.outputPath)}/${options.hlsPlaylist.videoFilename}`
+}
+
+async function onTranscodingSuccess (options: TranscodeOptions) {
+ if (!options.hlsPlaylist) return
+
+ // Fix wrong mapping with some ffmpeg versions
+ const fileContent = await readFile(options.outputPath)
+
+ const videoFileName = options.hlsPlaylist.videoFilename
+ const videoFilePath = getHLSVideoPath(options)
+
+ const newContent = fileContent.toString()
+ .replace(`#EXT-X-MAP:URI="${videoFilePath}",`, `#EXT-X-MAP:URI="${videoFileName}",`)
+
+ await writeFile(options.outputPath, newContent)
+}
+