mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2026-09-03 20:53:09 -05:00
Correctly detect audio copy
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
||||
buildStreamSuffix,
|
||||
ffprobePromise,
|
||||
getAudioStream,
|
||||
getMaxAudioKBitrate,
|
||||
getCopyInfoOrMaxAudioKBitrate,
|
||||
getVideoStream,
|
||||
getVideoStreamBitrate,
|
||||
getVideoStreamDimensionsInfo,
|
||||
@@ -53,7 +53,7 @@ const defaultAACOptionsBuilder: EncoderOptionsBuilder = async ({ input, streamNu
|
||||
|
||||
const audioCodecName = parsedAudio.audioStream['codec_name']
|
||||
|
||||
const bitrate = getMaxAudioKBitrate(audioCodecName, parsedAudio.bitrate)
|
||||
const bitrate = getCopyInfoOrMaxAudioKBitrate(audioCodecName, parsedAudio.bitrate)
|
||||
|
||||
// Force stereo as it causes some issues with HLS playback in Chrome
|
||||
const base = [ '-channel_layout', 'stereo' ]
|
||||
@@ -117,8 +117,8 @@ export async function canDoQuickAudioTranscode (path: string, probe?: FfprobeDat
|
||||
const audioBitrate = parsedAudio.bitrate
|
||||
if (!audioBitrate) return false
|
||||
|
||||
const maxAudioBitrate = getMaxAudioKBitrate('aac', audioBitrate) * 1000
|
||||
if (maxAudioBitrate !== -1 && audioBitrate > maxAudioBitrate) return false
|
||||
const canCopy = getCopyInfoOrMaxAudioKBitrate('aac', audioBitrate) === -1
|
||||
if (!canCopy) return false
|
||||
|
||||
const channelLayout = parsedAudio.audioStream['channel_layout']
|
||||
// Causes playback issues with Chrome
|
||||
|
||||
@@ -95,7 +95,7 @@ export async function getAudioStream (videoPath: string, existingProbe?: Ffprobe
|
||||
return { absolutePath: data.format.filename }
|
||||
}
|
||||
|
||||
export function getMaxAudioKBitrate (type: string, bitrate: number) {
|
||||
export function getCopyInfoOrMaxAudioKBitrate (type: string, bitrate: number) {
|
||||
const maxKBitrate = 384
|
||||
|
||||
// If we did not manage to get the bitrate, use an average value
|
||||
|
||||
Reference in New Issue
Block a user