diff options
Diffstat (limited to 'server/helpers/ffmpeg-utils.ts')
-rw-r--r-- | server/helpers/ffmpeg-utils.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index b59e7e40e..132f4690e 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts | |||
@@ -41,7 +41,7 @@ async function getVideoFileResolution (path: string) { | |||
41 | async function getVideoFileFPS (path: string) { | 41 | async function getVideoFileFPS (path: string) { |
42 | const videoStream = await getVideoFileStream(path) | 42 | const videoStream = await getVideoFileStream(path) |
43 | 43 | ||
44 | for (const key of [ 'r_frame_rate' , 'avg_frame_rate' ]) { | 44 | for (const key of [ 'avg_frame_rate', 'r_frame_rate' ]) { |
45 | const valuesText: string = videoStream[key] | 45 | const valuesText: string = videoStream[key] |
46 | if (!valuesText) continue | 46 | if (!valuesText) continue |
47 | 47 | ||
@@ -184,7 +184,7 @@ function getVideoFileStream (path: string) { | |||
184 | if (err) return rej(err) | 184 | if (err) return rej(err) |
185 | 185 | ||
186 | const videoStream = metadata.streams.find(s => s.codec_type === 'video') | 186 | const videoStream = metadata.streams.find(s => s.codec_type === 'video') |
187 | if (!videoStream) throw new Error('Cannot find video stream of ' + path) | 187 | if (!videoStream) return rej(new Error('Cannot find video stream of ' + path)) |
188 | 188 | ||
189 | return res(videoStream) | 189 | return res(videoStream) |
190 | }) | 190 | }) |
@@ -328,10 +328,10 @@ async function presetH264 (command: ffmpeg.FfmpegCommand, resolution: VideoResol | |||
328 | const audioCodecName = parsedAudio.audioStream[ 'codec_name' ] | 328 | const audioCodecName = parsedAudio.audioStream[ 'codec_name' ] |
329 | let bitrate: number | 329 | let bitrate: number |
330 | if (audio.bitrate[ audioCodecName ]) { | 330 | if (audio.bitrate[ audioCodecName ]) { |
331 | bitrate = audio.bitrate[ audioCodecName ](parsedAudio.audioStream[ 'bit_rate' ]) | 331 | localCommand = localCommand.audioCodec('aac') |
332 | 332 | ||
333 | if (bitrate === -1) localCommand = localCommand.audioCodec('copy') | 333 | bitrate = audio.bitrate[ audioCodecName ](parsedAudio.audioStream[ 'bit_rate' ]) |
334 | else if (bitrate !== undefined) localCommand = localCommand.audioBitrate(bitrate) | 334 | if (bitrate !== undefined && bitrate !== -1) localCommand = localCommand.audioBitrate(bitrate) |
335 | } | 335 | } |
336 | } | 336 | } |
337 | 337 | ||