add opus 19k option

This commit is contained in:
Ying Zhao 2025-05-24 08:55:08 -04:00
parent 2f8a8025f3
commit 41749a5c10
2 changed files with 17 additions and 1 deletions

View file

@ -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:

View file

@ -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',