mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 04:14:30 +00:00
feat(settings): add FFmpeg threads setting for media processing (#415)
* feat(settings): add FFmpeg threads setting for media processing * style(settings): add bottom padding to media processing page
This commit is contained in:
@@ -606,6 +606,7 @@ describe('Transcode Activities', () => {
|
||||
originalFps: 30,
|
||||
hardwareAcceleration: 'auto',
|
||||
sourceVideoBitrate: 600_000,
|
||||
threads: 8,
|
||||
})
|
||||
|
||||
expect(transcodeService.transcodeVideo).toHaveBeenCalledWith(
|
||||
@@ -613,6 +614,7 @@ describe('Transcode Activities', () => {
|
||||
inputFile: '/tmp/v.mp4',
|
||||
hardwareAcceleration: 'auto',
|
||||
sourceVideoBitrate: 600_000,
|
||||
threads: 8,
|
||||
}),
|
||||
)
|
||||
})
|
||||
@@ -1013,12 +1015,14 @@ describe('Transcode Activities', () => {
|
||||
const res = await transcodeAudioActivity({
|
||||
assetKey: 'files/proj-123/a.wav',
|
||||
filePath: '/tmp/a.wav',
|
||||
threads: 4,
|
||||
})
|
||||
|
||||
expect(transcodeService.transcodeAudio).toHaveBeenCalledWith({
|
||||
inputFile: '/tmp/a.wav',
|
||||
outputFile: expect.stringContaining('a-audio-proxy.mp4'),
|
||||
bitrate: '128k',
|
||||
threads: 4,
|
||||
})
|
||||
|
||||
expect(s3Service.putObject).toHaveBeenCalledWith(
|
||||
|
||||
@@ -223,6 +223,7 @@ export interface VideoActivityParams {
|
||||
originalFps: number
|
||||
hardwareAcceleration?: PrismaJson.HardwareAcceleration
|
||||
sourceVideoBitrate?: number
|
||||
threads?: number
|
||||
}
|
||||
|
||||
export async function transcodeVideoActivity(
|
||||
@@ -267,6 +268,7 @@ export async function transcodeVideoActivity(
|
||||
disableAudio,
|
||||
hardwareAcceleration: params.hardwareAcceleration,
|
||||
sourceVideoBitrate: params.sourceVideoBitrate,
|
||||
threads: params.threads,
|
||||
})
|
||||
|
||||
const stat = fs.statSync(outputFile)
|
||||
@@ -302,6 +304,7 @@ export async function transcodeVideoActivity(
|
||||
export interface AudioActivityParams {
|
||||
assetKey: string
|
||||
filePath: string
|
||||
threads?: number
|
||||
}
|
||||
|
||||
export async function transcodeAudioActivity(
|
||||
@@ -326,6 +329,7 @@ export async function transcodeAudioActivity(
|
||||
inputFile: params.filePath,
|
||||
outputFile,
|
||||
bitrate: '128k',
|
||||
threads: params.threads,
|
||||
})
|
||||
|
||||
const stat = fs.statSync(outputFile)
|
||||
|
||||
@@ -352,6 +352,7 @@ describe('Watermark Activities', () => {
|
||||
transcode: {
|
||||
videoStrategy: 'best_match',
|
||||
hardwareAcceleration: 'auto',
|
||||
threads: 6,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -398,6 +399,7 @@ describe('Watermark Activities', () => {
|
||||
hardwareAcceleration: 'auto',
|
||||
sourceVideoBitrate: 1800000,
|
||||
disableAudio: true,
|
||||
threads: 6,
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ export async function transcodeWatermarkMediaActivity(
|
||||
|
||||
const teamSettings = asset.project?.team?.settings as PrismaJson.Settings | null
|
||||
const hardwareAcceleration = teamSettings?.transcode?.hardwareAcceleration ?? 'off'
|
||||
const threads = teamSettings?.transcode?.threads ?? 0
|
||||
|
||||
// The config column is declared as PrismaJson.WatermarkConfigSpec, which is
|
||||
// structurally identical to the DTO type, so no cast is required.
|
||||
@@ -338,6 +339,7 @@ export async function transcodeWatermarkMediaActivity(
|
||||
overlayFile: overlayPngPath,
|
||||
hardwareAcceleration,
|
||||
sourceVideoBitrate,
|
||||
threads,
|
||||
})
|
||||
|
||||
const stat = fs.statSync(outFilePath)
|
||||
|
||||
Reference in New Issue
Block a user