-async function generateHlsPlaylist (video: MVideoWithFile, resolution: VideoResolution, copyCodecs: boolean, isPortraitMode: boolean) {
- const baseHlsDirectory = join(HLS_STREAMING_PLAYLIST_DIRECTORY, video.uuid)
- await ensureDir(join(HLS_STREAMING_PLAYLIST_DIRECTORY, video.uuid))
+// Concat TS segments from a live video to a fragmented mp4 HLS playlist
+async function generateHlsPlaylistFromTS (options: {
+ video: MVideoWithFile
+ concatenatedTsFilePath: string
+ resolution: VideoResolution
+ isPortraitMode: boolean
+ isAAC: boolean
+}) {
+ return generateHlsPlaylistCommon({
+ video: options.video,
+ resolution: options.resolution,
+ isPortraitMode: options.isPortraitMode,
+ inputPath: options.concatenatedTsFilePath,
+ type: 'hls-from-ts' as 'hls-from-ts',
+ isAAC: options.isAAC
+ })
+}
+
+// Generate an HLS playlist from an input file, and update the master playlist
+function generateHlsPlaylist (options: {
+ video: MVideoWithFile
+ videoInputPath: string
+ resolution: VideoResolution
+ copyCodecs: boolean
+ isPortraitMode: boolean
+}) {
+ return generateHlsPlaylistCommon({
+ video: options.video,
+ resolution: options.resolution,
+ copyCodecs: options.copyCodecs,
+ isPortraitMode: options.isPortraitMode,
+ inputPath: options.videoInputPath,
+ type: 'hls' as 'hls'
+ })
+}
+
+// ---------------------------------------------------------------------------
+
+export {
+ generateHlsPlaylist,
+ generateHlsPlaylistFromTS,
+ optimizeOriginalVideofile,
+ transcodeNewResolution,
+ mergeAudioVideofile
+}
+
+// ---------------------------------------------------------------------------
+
+async function onVideoFileTranscoding (video: MVideoWithFile, videoFile: MVideoFile, transcodingPath: string, outputPath: string) {
+ const stats = await stat(transcodingPath)
+ const fps = await getVideoFileFPS(transcodingPath)
+ const metadata = await getMetadataFromFile(transcodingPath)