mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 21:50:30 +00:00
feat(transcode): add HLS live streaming support (#436)
* feat(transcode): add HLS live streaming support * fix(hls): resolve version stacks for public HLS and add workflow E2E test
This commit is contained in:
@@ -8,7 +8,11 @@ import {
|
||||
failTask,
|
||||
cleanupTmpDir,
|
||||
} from './common'
|
||||
import { getTargetVideoResolutions, resolutionToDimensions } from './transcode-utils'
|
||||
import {
|
||||
getTargetVideoResolutions,
|
||||
getTargetHlsResolutions,
|
||||
resolutionToDimensions,
|
||||
} from './transcode-utils'
|
||||
|
||||
export async function transcodeVideoWorkflow(task: WorkflowTask): Promise<void> {
|
||||
let tmpDir: string | undefined
|
||||
@@ -21,6 +25,7 @@ export async function transcodeVideoWorkflow(task: WorkflowTask): Promise<void>
|
||||
updateAssetStatusActivity,
|
||||
getMediaInfoActivity,
|
||||
transcodeVideoActivity,
|
||||
transcodeHlsActivity,
|
||||
transcodeAudioActivity,
|
||||
transcodeImageActivity,
|
||||
extractPosterActivity,
|
||||
@@ -189,6 +194,35 @@ export async function transcodeVideoWorkflow(task: WorkflowTask): Promise<void>
|
||||
|
||||
mediaInfo.videoTranscodes.push(videoTranscode)
|
||||
}
|
||||
|
||||
if (spec.hlsEnabled) {
|
||||
const hlsLadders = getTargetHlsResolutions(
|
||||
spec.hlsResolutions,
|
||||
metadata.originalWidth,
|
||||
metadata.originalHeight,
|
||||
)
|
||||
if (hlsLadders.length > 0) {
|
||||
const hlsResult = await executeActivity(workerQueue, transcodeHlsActivity, {
|
||||
taskId: task.id,
|
||||
assetKey: key,
|
||||
filePath,
|
||||
ladders: hlsLadders,
|
||||
originalWidth: metadata.originalWidth,
|
||||
originalHeight: metadata.originalHeight,
|
||||
originalFps: metadata.frameRate,
|
||||
sourceVideoBitrate: metadata.videoBitRate || metadata.bitRate,
|
||||
hardwareAcceleration: spec.hardwareAcceleration,
|
||||
threads: spec.threads,
|
||||
sourceIsHdr: metadata.isHdr,
|
||||
sourceHdrType: metadata.hdrType,
|
||||
sourceColorTransfer: metadata.colorTransfer,
|
||||
sourceColorPrimaries: metadata.colorPrimaries,
|
||||
sourceColorSpace: metadata.colorSpace,
|
||||
})
|
||||
mediaInfo.isHls = true
|
||||
mediaInfo.hls = hlsResult
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const isAudio = mediaInfo.proxyType === 'audio'
|
||||
|
||||
Reference in New Issue
Block a user