diff --git a/server/src/domain/media/media.service.spec.ts b/server/src/domain/media/media.service.spec.ts index 8a67a2774..d4c23ae68 100644 --- a/server/src/domain/media/media.service.spec.ts +++ b/server/src/domain/media/media.service.spec.ts @@ -315,8 +315,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=yuv420p', '-preset ultrafast', @@ -356,8 +356,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=yuv420p', '-preset ultrafast', @@ -382,8 +382,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-preset ultrafast', @@ -411,8 +411,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=yuv420p', '-preset ultrafast', @@ -438,8 +438,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=720:-2,format=yuv420p', '-preset ultrafast', @@ -465,8 +465,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-preset ultrafast', @@ -492,8 +492,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-preset ultrafast', @@ -543,8 +543,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-preset ultrafast', @@ -575,8 +575,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-preset ultrafast', @@ -604,8 +604,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-preset ultrafast', @@ -635,8 +635,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-cpu-used 5', @@ -668,8 +668,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-cpu-used 2', @@ -700,8 +700,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-row-mt 1', @@ -731,8 +731,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-cpu-used 5', @@ -761,8 +761,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-preset ultrafast', @@ -791,8 +791,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-preset ultrafast', @@ -821,8 +821,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-preset ultrafast', @@ -854,8 +854,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-preset ultrafast', @@ -925,8 +925,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload_cuda,scale_cuda=-2:720', '-preset p1', @@ -967,8 +967,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload_cuda,scale_cuda=-2:720', '-preset p1', @@ -1005,8 +1005,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload_cuda,scale_cuda=-2:720', '-preset p1', @@ -1044,8 +1044,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload_cuda,scale_cuda=-2:720', '-cq:v 23', @@ -1079,8 +1079,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload_cuda,scale_cuda=-2:720', '-preset p1', @@ -1114,8 +1114,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload=extra_hw_frames=64,scale_qsv=-1:720', '-preset 7', @@ -1151,8 +1151,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload=extra_hw_frames=64,scale_qsv=-1:720', '-global_quality 23', @@ -1185,8 +1185,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-low_power 1', '-v verbose', '-vf format=nv12,hwupload=extra_hw_frames=64,scale_qsv=-1:720', @@ -1226,8 +1226,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload,scale_vaapi=-2:720', '-compression_level 7', @@ -1257,8 +1257,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload,scale_vaapi=-2:720', '-compression_level 7', @@ -1290,8 +1290,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload,scale_vaapi=-2:720', '-qp 23', @@ -1319,8 +1319,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload,scale_vaapi=-2:720', '-compression_level 7', @@ -1344,8 +1344,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf format=nv12,hwupload,scale_vaapi=-2:720', '-compression_level 7', @@ -1376,8 +1376,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf scale=-2:720,format=yuv420p', '-preset ultrafast', @@ -1413,8 +1413,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=bt709:m=bt709:range=pc,format=yuv420p', '-preset ultrafast', @@ -1440,8 +1440,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf zscale=t=linear:npl=100,tonemap=hable:desat=0,zscale=p=bt709:t=bt709:m=bt709:range=pc,format=yuv420p', '-preset ultrafast', @@ -1467,8 +1467,8 @@ describe(MediaService.name, () => { '-c:a aac', '-movflags faststart', '-fps_mode passthrough', - '-map 0:v:0', - '-map 0:a:0', + '-map 0:0', + '-map 0:1', '-v verbose', '-vf zscale=t=linear:npl=250,tonemap=mobius:desat=0,zscale=p=bt709:t=bt709:m=bt709:range=pc,format=yuv420p', '-preset ultrafast', diff --git a/server/src/domain/media/media.util.ts b/server/src/domain/media/media.util.ts index 0e9a859a9..7e996a1a5 100644 --- a/server/src/domain/media/media.util.ts +++ b/server/src/domain/media/media.util.ts @@ -41,10 +41,10 @@ class BaseConfig implements VideoCodecSWConfig { '-movflags faststart', '-fps_mode passthrough', // explicitly selects the video stream instead of leaving it up to FFmpeg - `-map 0:v:${videoStream.index}`, + `-map 0:${videoStream.index}`, ]; if (audioStream) { - options.push(`-map 0:a:${audioStream.index}`); + options.push(`-map 0:${audioStream.index}`); } return options; } diff --git a/server/test/fixtures/media.stub.ts b/server/test/fixtures/media.stub.ts index f5988b9c6..8cde51cad 100644 --- a/server/test/fixtures/media.stub.ts +++ b/server/test/fixtures/media.stub.ts @@ -20,7 +20,7 @@ const probeStubDefaultVideoStream: VideoStreamInfo[] = [ ]; const probeStubDefaultAudioStream: AudioStreamInfo[] = [ - { index: 0, codecName: 'aac', codecType: 'audio', frameCount: 100 }, + { index: 1, codecName: 'aac', codecType: 'audio', frameCount: 100 }, ]; const probeStubDefault: VideoInfo = { @@ -119,7 +119,7 @@ export const probeStub = { }), audioStreamMp3: Object.freeze({ ...probeStubDefault, - audioStreams: [{ index: 0, codecType: 'audio', codecName: 'aac', frameCount: 100 }], + audioStreams: [{ index: 1, codecType: 'audio', codecName: 'aac', frameCount: 100 }], }), matroskaContainer: Object.freeze({ ...probeStubDefault,