1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-01 08:31:59 +00:00

fix format, adjust log message

This commit is contained in:
mertalev 2024-11-22 01:46:34 -05:00
parent 5e32cc7bd5
commit e2188867a6
No known key found for this signature in database
GPG key ID: CA85EF6600C9E8AD
3 changed files with 14 additions and 12 deletions

View file

@ -2133,7 +2133,7 @@ describe(MediaService.name, () => {
'-map 0:1', '-map 0:1',
'-g 256', '-g 256',
'-v verbose', '-v verbose',
'-vf scale_rkrga=-2:720:format=nv12:afbc=1', '-vf scale_rkrga=-2:720:format=nv12:afbc=1:async_depth=4',
'-level 51', '-level 51',
'-rc_mode CQP', '-rc_mode CQP',
'-qp_init 23', '-qp_init 23',
@ -2204,7 +2204,7 @@ describe(MediaService.name, () => {
inputOptions: expect.arrayContaining(['-hwaccel rkmpp', '-hwaccel_output_format drm_prime', '-afbc rga']), inputOptions: expect.arrayContaining(['-hwaccel rkmpp', '-hwaccel_output_format drm_prime', '-afbc rga']),
outputOptions: expect.arrayContaining([ outputOptions: expect.arrayContaining([
expect.stringContaining( expect.stringContaining(
'scale_rkrga=-2:720:format=p010:afbc=1,hwmap=derive_device=opencl:mode=read,tonemap_opencl=format=nv12:r=pc:p=bt709:t=bt709:m=bt709:tonemap=hable:desat=0:tonemap_mode=lum:peak=100,hwmap=derive_device=rkmpp:mode=write:reverse=1,format=drm_prime', 'scale_rkrga=-2:720:format=p010:afbc=1:async_depth=4,hwmap=derive_device=opencl:mode=read,tonemap_opencl=format=nv12:r=pc:p=bt709:t=bt709:m=bt709:tonemap=hable:desat=0:tonemap_mode=lum:peak=100,hwmap=derive_device=rkmpp:mode=write:reverse=1,format=drm_prime',
), ),
]), ]),
twoPass: false, twoPass: false,
@ -2228,7 +2228,7 @@ describe(MediaService.name, () => {
inputOptions: expect.arrayContaining(['-hwaccel rkmpp', '-hwaccel_output_format drm_prime', '-afbc rga']), inputOptions: expect.arrayContaining(['-hwaccel rkmpp', '-hwaccel_output_format drm_prime', '-afbc rga']),
outputOptions: expect.arrayContaining([ outputOptions: expect.arrayContaining([
expect.stringContaining( expect.stringContaining(
'scale_rkrga=-2:720:format=nv12:afbc=1', 'scale_rkrga=-2:720:format=nv12:afbc=1:async_depth=4',
), ),
]), ]),
twoPass: false, twoPass: false,

View file

@ -329,9 +329,11 @@ export class MediaService extends BaseService {
} }
if (ffmpeg.accel === TranscodeHWAccel.DISABLED) { if (ffmpeg.accel === TranscodeHWAccel.DISABLED) {
this.logger.log(`Encoding video ${asset.id} without hardware acceleration`); this.logger.log(`Transcoding video ${asset.id} without hardware acceleration`);
} else { } else {
this.logger.log(`Encoding video ${asset.id} with ${ffmpeg.accel.toUpperCase()} acceleration`); this.logger.log(
`Transcoding video ${asset.id} with ${ffmpeg.accel.toUpperCase()}-accelerated encoding and${ffmpeg.accelDecode ? '' : ' software'} decoding`,
);
} }
try { try {
@ -345,8 +347,8 @@ export class MediaService extends BaseService {
let partialFallbackSuccess = false; let partialFallbackSuccess = false;
if (ffmpeg.accelDecode) { if (ffmpeg.accelDecode) {
try { try {
this.logger.error(`Retrying with ${ffmpeg.accel.toUpperCase()} acceleration but software decoding`); this.logger.error(`Retrying with ${ffmpeg.accel.toUpperCase()}-accelerated encoding and software decoding`);
const config = BaseConfig.create({...ffmpeg, accelDecode: false}); const config = BaseConfig.create({ ...ffmpeg, accelDecode: false });
command = config.getCommand(target, mainVideoStream, mainAudioStream); command = config.getCommand(target, mainVideoStream, mainAudioStream);
await this.mediaRepository.transcode(input, output, command); await this.mediaRepository.transcode(input, output, command);
partialFallbackSuccess = true; partialFallbackSuccess = true;
@ -357,7 +359,7 @@ export class MediaService extends BaseService {
if (!partialFallbackSuccess) { if (!partialFallbackSuccess) {
this.logger.error(`Retrying with ${ffmpeg.accel.toUpperCase()} acceleration disabled`); this.logger.error(`Retrying with ${ffmpeg.accel.toUpperCase()} acceleration disabled`);
const config = BaseConfig.create({...ffmpeg, accel: TranscodeHWAccel.DISABLED}); const config = BaseConfig.create({ ...ffmpeg, accel: TranscodeHWAccel.DISABLED });
command = config.getCommand(target, mainVideoStream, mainAudioStream); command = config.getCommand(target, mainVideoStream, mainAudioStream);
await this.mediaRepository.transcode(input, output, command); await this.mediaRepository.transcode(input, output, command);
} }

View file

@ -990,7 +990,7 @@ export class RkmppHwDecodeConfig extends RkmppSwDecodeConfig {
const { primaries, transfer, matrix } = this.getColors(); const { primaries, transfer, matrix } = this.getColors();
if (this.hasMaliOpenCL) { if (this.hasMaliOpenCL) {
return [ // use RKMPP for scaling, OpenCL for tone mapping return [ // use RKMPP for scaling, OpenCL for tone mapping
`scale_rkrga=${this.getScaling(videoStream)}:format=p010:afbc=1`, `scale_rkrga=${this.getScaling(videoStream)}:format=p010:afbc=1:async_depth=4`,
'hwmap=derive_device=opencl:mode=read', 'hwmap=derive_device=opencl:mode=read',
`tonemap_opencl=format=nv12:r=pc:p=${primaries}:t=${transfer}:m=${matrix}:tonemap=${this.config.tonemap}:desat=0:tonemap_mode=lum:peak=100`, `tonemap_opencl=format=nv12:r=pc:p=${primaries}:t=${transfer}:m=${matrix}:tonemap=${this.config.tonemap}:desat=0:tonemap_mode=lum:peak=100`,
'hwmap=derive_device=rkmpp:mode=write:reverse=1', 'hwmap=derive_device=rkmpp:mode=write:reverse=1',
@ -998,14 +998,14 @@ export class RkmppHwDecodeConfig extends RkmppSwDecodeConfig {
]; ];
} }
return [ // use RKMPP for scaling, CPU for tone mapping (only works on RK3588 which support 10bit output) return [ // use RKMPP for scaling, CPU for tone mapping (only works on RK3588 which support 10bit output)
`scale_rkrga=${this.getScaling(videoStream)}:format=p010`, `scale_rkrga=${this.getScaling(videoStream)}:format=p010:afbc=1:async_depth=4`,
'hwdownload', 'hwdownload',
'format=yuv420p10le', 'format=p010',
`tonemapx=tonemap=${this.config.tonemap}:desat=0:p=${primaries}:t=${transfer}:m=${matrix}:r=pc:peak=100:format=yuv420p`, `tonemapx=tonemap=${this.config.tonemap}:desat=0:p=${primaries}:t=${transfer}:m=${matrix}:r=pc:peak=100:format=yuv420p`,
'hwupload', 'hwupload',
]; ];
} else if (this.shouldScale(videoStream)) { } else if (this.shouldScale(videoStream)) {
return [`scale_rkrga=${this.getScaling(videoStream)}:format=nv12:afbc=1`]; return [`scale_rkrga=${this.getScaling(videoStream)}:format=nv12:afbc=1:async_depth=4`];
} }
return []; return [];
} }