From 41749a5c10576d2166c5b7efd779f0546bd6672f Mon Sep 17 00:00:00 2001 From: Ying Zhao Date: Sat, 24 May 2025 08:55:08 -0400 Subject: [PATCH] add opus 19k option --- app/dl_formats.py | 13 +++++++++++++ ui/src/app/formats.ts | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/dl_formats.py b/app/dl_formats.py index 97b4993..88e3353 100644 --- a/app/dl_formats.py +++ b/app/dl_formats.py @@ -83,6 +83,19 @@ def get_opts(format: str, quality: str, ytdl_opts: dict) -> dict: opts["postprocessor_args"] = { "ffmpeg": ["-ac", "1", "-ar", "22050", "-q:a", "8"] } + + # Add voice mono settings for OPUS + if format == "opus" and quality == "19_mono": + opts["postprocessor_args"] = { + "ffmpeg": [ + "-ac", "1", # Force mono + "-c:a", "libopus", # Use OPUS codec + "-b:a", "19k", # Set bitrate to 19kbps + "-application", "voip", # Optimize for speech + "-frame_duration", "20", # Standard frame size + "-compression_level", "10" # Highest quality compression + ] + } # Audio formats without thumbnail if format not in ("wav") and "writethumbnail" not in opts: diff --git a/ui/src/app/formats.ts b/ui/src/app/formats.ts index cb5b5ab..a206c8d 100644 --- a/ui/src/app/formats.ts +++ b/ui/src/app/formats.ts @@ -61,7 +61,10 @@ export const Formats: Format[] = [ { id: 'opus', text: 'OPUS', - qualities: [{ id: 'best', text: 'Best' }], + qualities: [ + { id: 'best', text: 'Best' }, + { id: '19_mono', text: '19 kbps(Mono)' } + ], }, { id: 'wav',