From de5b2d9ca7302ade711d9dfb32b2fe8047f55cc2 Mon Sep 17 00:00:00 2001 From: historia Date: Tue, 18 Aug 2026 03:00:16 -0400 Subject: feat: support .ogg and .flac output --- converter/audio.py | 4 ++++ converter/config.py | 4 ++-- converter/converter.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'converter') diff --git a/converter/audio.py b/converter/audio.py index 5a7ec35..98864f6 100644 --- a/converter/audio.py +++ b/converter/audio.py @@ -52,6 +52,10 @@ def _encode_args(output_format: str) -> List[str]: """Return ffmpeg output codec/bitrate args for the requested container.""" if output_format == "m4b": return ["-c:a", "aac", "-b:a", config.AUDIO_BITRATE] + if output_format == "ogg": + return ["-c:a", "libvorbis", "-b:a", config.AUDIO_BITRATE] + if output_format == "flac": + return ["-c:a", "flac"] if output_format == "wav": # Lossless intermediate for per-chapter scratch audio; avoids # generational loss when the final m4b re-encodes to AAC. diff --git a/converter/config.py b/converter/config.py index b4d7f22..ec84986 100644 --- a/converter/config.py +++ b/converter/config.py @@ -82,8 +82,8 @@ HEARTBEAT_INTERVAL_SECONDS = 30 # Print "still working" this often during a chu # AUDIO OUTPUT SETTINGS # ============================================================================= -AUDIO_FORMAT = "mp3" # Default output container ("mp3" or "m4b") -AUDIO_FORMATS = ("mp3", "m4b") +AUDIO_FORMAT = "mp3" # Default output container +AUDIO_FORMATS = ("mp3", "m4b", "ogg", "flac") AUDIO_BITRATE = "128k" SUPPORTED_FORMATS = [".txt", ".pdf", ".epub"] diff --git a/converter/converter.py b/converter/converter.py index bc64f38..c0e97e4 100644 --- a/converter/converter.py +++ b/converter/converter.py @@ -304,7 +304,7 @@ class AudiobookConverter: print(f"Reference audio: {Path(self.voice_clone_ref_audio).name}") print(f"Language: {config.VOICE_CLONE_LANGUAGE}") print(f"Output format: {self.output_format}") - if self.single_file and self.output_format == "mp3": + if self.single_file and self.output_format != "m4b": print("Chapter mode: single file (--single-file)") if abs(self.speed - 1.0) >= 1e-6: print(f"Playback speed: {self.speed:g}x") -- cgit v1.2.3