mirror of
https://github.com/immich-app/immich.git
synced 2025-01-01 08:31:59 +00:00
fix(server): enable transcoding of audioless videos (#3147)
* Fix: enable transcoding of audioless videos * Fix: enable transcoding of audioless videos & typing * Fix: enable transcoding of audioless videos & formatting * fix: do not always transcode if there is no audio stream
This commit is contained in:
parent
398bd04ffd
commit
50f26374e3
1 changed files with 12 additions and 6 deletions
|
@ -142,7 +142,7 @@ export class MediaService {
|
|||
const mainVideoStream = this.getMainVideoStream(videoStreams);
|
||||
const mainAudioStream = this.getMainAudioStream(audioStreams);
|
||||
const containerExtension = format.formatName;
|
||||
if (!mainVideoStream || !mainAudioStream || !containerExtension) {
|
||||
if (!mainVideoStream || !containerExtension) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ export class MediaService {
|
|||
private isTranscodeRequired(
|
||||
asset: AssetEntity,
|
||||
videoStream: VideoStreamInfo,
|
||||
audioStream: AudioStreamInfo,
|
||||
audioStream: AudioStreamInfo | null,
|
||||
containerExtension: string,
|
||||
ffmpegConfig: SystemConfigFFmpegDto,
|
||||
): boolean {
|
||||
|
@ -192,12 +192,18 @@ export class MediaService {
|
|||
}
|
||||
|
||||
const isTargetVideoCodec = videoStream.codecName === ffmpegConfig.targetVideoCodec;
|
||||
const isTargetAudioCodec = audioStream.codecName === ffmpegConfig.targetAudioCodec;
|
||||
const isTargetContainer = ['mov,mp4,m4a,3gp,3g2,mj2', 'mp4', 'mov'].includes(containerExtension);
|
||||
const isTargetAudioCodec = audioStream == null || audioStream.codecName === ffmpegConfig.targetAudioCodec;
|
||||
|
||||
this.logger.verbose(
|
||||
`${asset.id}: AudioCodecName ${audioStream.codecName}, AudioStreamCodecType ${audioStream.codecType}, containerExtension ${containerExtension}`,
|
||||
);
|
||||
if (audioStream != null) {
|
||||
this.logger.verbose(
|
||||
`${asset.id}: AudioCodecName ${audioStream.codecName}, AudioStreamCodecType ${audioStream.codecType}, containerExtension ${containerExtension}`,
|
||||
);
|
||||
} else {
|
||||
this.logger.verbose(
|
||||
`${asset.id}: AudioCodecName None, AudioStreamCodecType None, containerExtension ${containerExtension}`,
|
||||
);
|
||||
}
|
||||
|
||||
const allTargetsMatching = isTargetVideoCodec && isTargetAudioCodec && isTargetContainer;
|
||||
const scalingEnabled = ffmpegConfig.targetResolution !== 'original';
|
||||
|
|
Loading…
Reference in a new issue