diff options
Diffstat (limited to 'server/helpers/ffmpeg-utils.ts')
-rw-r--r-- | server/helpers/ffmpeg-utils.ts | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index 8041e7b3b..914ecc51a 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts | |||
@@ -387,14 +387,15 @@ namespace audio { | |||
387 | export namespace bitrate { | 387 | export namespace bitrate { |
388 | const baseKbitrate = 384 | 388 | const baseKbitrate = 384 |
389 | 389 | ||
390 | const toBits = (kbits: number): number => { return kbits * 8000 } | 390 | const toBits = (kbits: number) => kbits * 8000 |
391 | 391 | ||
392 | export const aac = (bitrate: number): number => { | 392 | export const aac = (bitrate: number): number => { |
393 | switch (true) { | 393 | switch (true) { |
394 | case bitrate > toBits(baseKbitrate): | 394 | case bitrate > toBits(baseKbitrate): |
395 | return baseKbitrate | 395 | return baseKbitrate |
396 | default: | 396 | |
397 | return -1 // we interpret it as a signal to copy the audio stream as is | 397 | default: |
398 | return -1 // we interpret it as a signal to copy the audio stream as is | ||
398 | } | 399 | } |
399 | } | 400 | } |
400 | 401 | ||
@@ -405,12 +406,14 @@ namespace audio { | |||
405 | made here are not made to be accurate, especially with good mp3 encoders. | 406 | made here are not made to be accurate, especially with good mp3 encoders. |
406 | */ | 407 | */ |
407 | switch (true) { | 408 | switch (true) { |
408 | case bitrate <= toBits(192): | 409 | case bitrate <= toBits(192): |
409 | return 128 | 410 | return 128 |
410 | case bitrate <= toBits(384): | 411 | |
411 | return 256 | 412 | case bitrate <= toBits(384): |
412 | default: | 413 | return 256 |
413 | return baseKbitrate | 414 | |
415 | default: | ||
416 | return baseKbitrate | ||
414 | } | 417 | } |
415 | } | 418 | } |
416 | } | 419 | } |