mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 06:54:28 +00:00
feat(transcode): optimize video operations using ffmpeg http range requests (#393)
* feat(transcode): optimize video operations using ffmpeg http range requests * fix(transcode): preserve non-retryable errors and ensure mapConcurrent settles on rejection
This commit is contained in:
@@ -118,6 +118,7 @@ export interface S3Service {
|
||||
request: S3SignRequest,
|
||||
) => Promise<{ url: string }>
|
||||
abortMultipartUpload: (bucket: string, key: string, uploadId: string) => Promise<void>
|
||||
resolveInput: (bucket: string, key: string) => Promise<string>
|
||||
}
|
||||
|
||||
export class S3StorageService implements S3Service {
|
||||
@@ -459,6 +460,10 @@ export class S3StorageService implements S3Service {
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
async resolveInput(bucket: string, key: string): Promise<string> {
|
||||
return this.presign(bucket, key, 'GET')
|
||||
}
|
||||
}
|
||||
|
||||
export class LocalStorageService implements S3Service {
|
||||
@@ -717,6 +722,14 @@ export class LocalStorageService implements S3Service {
|
||||
): Promise<void> {
|
||||
await this.deleteObject(bucket, key)
|
||||
}
|
||||
|
||||
async resolveInput(bucket: string, key: string): Promise<string> {
|
||||
const filePath = this.getFilePath(bucket, key)
|
||||
if (fs.existsSync(filePath)) {
|
||||
return filePath
|
||||
}
|
||||
return this.presign(bucket, key, 'GET')
|
||||
}
|
||||
}
|
||||
|
||||
export function getStorageBackend(): 's3' | 'local' {
|
||||
|
||||
Reference in New Issue
Block a user