From e7d8e2b245491c0a8e008fb570037506d729ff04 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 5 May 2023 10:53:04 +0200 Subject: Fix audio transcoding copy --- .../lib/transcoding/transcoding-quick-transcode.ts | 51 +--------------------- 1 file changed, 1 insertion(+), 50 deletions(-) (limited to 'server/lib/transcoding/transcoding-quick-transcode.ts') diff --git a/server/lib/transcoding/transcoding-quick-transcode.ts b/server/lib/transcoding/transcoding-quick-transcode.ts index b7f921890..53f12cd06 100644 --- a/server/lib/transcoding/transcoding-quick-transcode.ts +++ b/server/lib/transcoding/transcoding-quick-transcode.ts @@ -1,16 +1,6 @@ import { FfprobeData } from 'fluent-ffmpeg' import { CONFIG } from '@server/initializers/config' -import { VIDEO_TRANSCODING_FPS } from '@server/initializers/constants' -import { getMaxBitrate } from '@shared/core-utils' -import { - ffprobePromise, - getAudioStream, - getMaxAudioBitrate, - getVideoStream, - getVideoStreamBitrate, - getVideoStreamDimensionsInfo, - getVideoStreamFPS -} from '@shared/ffmpeg' +import { canDoQuickAudioTranscode, canDoQuickVideoTranscode, ffprobePromise } from '@shared/ffmpeg' export async function canDoQuickTranscode (path: string, existingProbe?: FfprobeData): Promise { if (CONFIG.TRANSCODING.PROFILE !== 'default') return false @@ -20,42 +10,3 @@ export async function canDoQuickTranscode (path: string, existingProbe?: Ffprobe return await canDoQuickVideoTranscode(path, probe) && await canDoQuickAudioTranscode(path, probe) } - -export async function canDoQuickAudioTranscode (path: string, probe?: FfprobeData): Promise { - const parsedAudio = await getAudioStream(path, probe) - - if (!parsedAudio.audioStream) return true - - if (parsedAudio.audioStream['codec_name'] !== 'aac') return false - - const audioBitrate = parsedAudio.bitrate - if (!audioBitrate) return false - - const maxAudioBitrate = getMaxAudioBitrate('aac', audioBitrate) - if (maxAudioBitrate !== -1 && audioBitrate > maxAudioBitrate) return false - - const channelLayout = parsedAudio.audioStream['channel_layout'] - // Causes playback issues with Chrome - if (!channelLayout || channelLayout === 'unknown' || channelLayout === 'quad') return false - - return true -} - -export async function canDoQuickVideoTranscode (path: string, probe?: FfprobeData): Promise { - const videoStream = await getVideoStream(path, probe) - const fps = await getVideoStreamFPS(path, probe) - const bitRate = await getVideoStreamBitrate(path, probe) - const resolutionData = await getVideoStreamDimensionsInfo(path, probe) - - // If ffprobe did not manage to guess the bitrate - if (!bitRate) return false - - // check video params - if (!videoStream) return false - if (videoStream['codec_name'] !== 'h264') return false - if (videoStream['pix_fmt'] !== 'yuv420p') return false - if (fps < VIDEO_TRANSCODING_FPS.MIN || fps > VIDEO_TRANSCODING_FPS.MAX) return false - if (bitRate > getMaxBitrate({ ...resolutionData, fps })) return false - - return true -} -- cgit v1.2.3