- const dataInput: VideoTranscodingPayload = program.resolution !== undefined
- ? { type: 'new-resolution' as 'new-resolution', videoUUID: video.uuid, isNewVideo: false, resolution: program.resolution }
- : { type: 'optimize' as 'optimize', videoUUID: video.uuid, isNewVideo: false }
+ const dataInput: VideoTranscodingPayload[] = []
+ const { videoFileResolution } = await video.getMaxQualityResolution()
+
+ if (program.generateHls) {
+ const resolutionsEnabled = program.resolution
+ ? [ program.resolution ]
+ : computeResolutionsToTranscode(videoFileResolution).concat([ videoFileResolution ])
+
+ for (const resolution of resolutionsEnabled) {
+ dataInput.push({
+ type: 'hls',
+ videoUUID: video.uuid,
+ resolution,
+ isPortraitMode: false,
+ copyCodecs: false
+ })
+ }
+ } else if (program.resolution !== undefined) {
+ dataInput.push({
+ type: 'new-resolution' as 'new-resolution',
+ videoUUID: video.uuid,
+ isNewVideo: false,
+ resolution: program.resolution
+ })
+ } else {
+ dataInput.push({
+ type: 'optimize' as 'optimize',
+ videoUUID: video.uuid,
+ isNewVideo: false
+ })
+ }