mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-23 02:09:56 +00:00
feat(metadata): add video_codec field and verbose codec name resolution
This commit is contained in:
@@ -50,7 +50,8 @@ describe('Transcode Activities', () => {
|
||||
bitRate: 1000,
|
||||
frameRate: 30,
|
||||
hasAudio: true,
|
||||
audioCodec: 'aac',
|
||||
videoCodec: 'Advanced Video Coding',
|
||||
audioCodec: 'MPEG-4 Audio',
|
||||
audioChannels: 2,
|
||||
audioSampleRate: 48000,
|
||||
audioBitDepth: 16,
|
||||
@@ -66,7 +67,8 @@ describe('Transcode Activities', () => {
|
||||
expect(transcodeService.getVideoInfo).toHaveBeenCalledWith('/tmp/v.mp4')
|
||||
expect(result.duration).toBe(10)
|
||||
expect(result.metadata?.originalWidth).toBe(1920)
|
||||
expect(result.metadata?.audioCodec).toBe('aac')
|
||||
expect(result.metadata?.videoCodec).toBe('Advanced Video Coding')
|
||||
expect(result.metadata?.audioCodec).toBe('MPEG-4 Audio')
|
||||
expect(result.metadata?.audioChannels).toBe(2)
|
||||
expect(result.metadata?.audioSampleRate).toBe(48000)
|
||||
expect(result.metadata?.audioBitDepth).toBe(16)
|
||||
|
||||
@@ -49,6 +49,7 @@ export async function getMediaInfoActivity(params: {
|
||||
bitRate: info.bitRate,
|
||||
frameRate: info.frameRate,
|
||||
hasAudio: info.hasAudio,
|
||||
videoCodec: info.videoCodec,
|
||||
audioCodec: info.audioCodec,
|
||||
audioChannels: info.audioChannels,
|
||||
audioSampleRate: info.audioSampleRate,
|
||||
@@ -62,6 +63,7 @@ export async function getMediaInfoActivity(params: {
|
||||
{ key: 'bitRate', value: info.bitRate / 1000 },
|
||||
{ key: 'frame_rate', value: info.frameRate },
|
||||
]
|
||||
if (info.videoCodec) metadataUpdates.push({ key: 'video_codec', value: info.videoCodec })
|
||||
if (info.audioCodec) metadataUpdates.push({ key: 'audio_codec', value: info.audioCodec })
|
||||
if (info.audioChannels !== undefined)
|
||||
metadataUpdates.push({ key: 'audio_channels', value: info.audioChannels })
|
||||
|
||||
Reference in New Issue
Block a user