ebook2audiobook: How One Python Script Solves the 1,158-Language Audiobook Problem
Hook
While Audible supports roughly 40 languages, a single open-source Python tool now handles 1,158—including endangered languages like Zarma and Lingala. Here’s how it works under the hood.
Context
The audiobook market has a diversity problem. Commercial platforms focus on profitable languages, leaving billions of readers without accessible audio content. Even when audiobooks exist, they’re often locked behind DRM, incompatible with assistive technologies, or unavailable in regional dialects.
ebook2audiobook emerged as a pragmatic solution to this gap. Built by DrewThomasson, it’s a Python pipeline that converts DRM-free ebooks into professionally-formatted audiobooks with chapter markers, metadata, and optional voice cloning. With 18,594 GitHub stars, it’s become the de facto standard for personal audiobook generation—not because it’s perfect, but because it democratizes access to neural TTS engines that were previously locked in research labs or enterprise APIs. The tool’s value proposition is simple: if you can legally acquire an ebook, you can create an audiobook in nearly any human language, running entirely on your own hardware.
Technical Insight
At its core, ebook2audiobook is a carefully orchestrated pipeline that handles the messy reality of ebook formats. The architecture splits into four distinct phases: parsing, text extraction, speech synthesis, and audio packaging.
The parsing stage handles multiple ebook formats including EPUB, MOBI, AZW3, and even image formats like TIFF and JPEG. For image-based content, the tool invokes OCR (optical character recognition) to extract text from scanned pages—crucial for older digitized books or PDFs created from photocopies. This preprocessing step normalizes everything into a structured text format that downstream components can consume.
Text extraction is where things get interesting. The tool chunks content by chapters, but here’s the gotcha: EPUB files don’t have a standardized chapter definition. The README explicitly acknowledges this: “EPUB format lacks any standard structure like what is a chapter, paragraph, preface etc.” In practice, this means you might get table-of-contents entries, copyright notices, or footnotes read aloud unless you pre-process the file.
The TTS engine layer is the real innovation. Instead of hardcoding a single engine, ebook2audiobook supports eight different backends: XTTSv2 (the default), Bark, Fairseq, VITS, Tacotron2, Tortoise, GlowTTS, and YourTTS. Each has different quality-speed tradeoffs.
XTTSv2, the flagship engine, supports voice cloning by accepting a reference audio file. The system extracts voice characteristics from your sample audio, then conditions the synthesis on those characteristics. The community has developed fine-tuned models for specific voices—David Attenborough, ASMR narrators, and character-specific voices are mentioned in the README demos.
The multilingual support is genuine—the system supports 1,158 languages according to the README, linking to a comprehensive language list that includes languages with virtually no commercial TTS support.
For power users, the tool supports SML tags embedded directly in the ebook text. Want a pause before a dramatic reveal? Insert [pause] for a 1.0-1.6 second silence, or [pause:N] for a specific duration. Need to switch voices mid-chapter for dialogue? Use [voice:/path/to/voice/file]...[/voice]. This granular control is normally only available in expensive studio software.
The final stage packages audio into multiple formats (M4B, MP3, FLAC, WAV, OGG, AAC, and others) with chapter markers and metadata. Remarkably, the entire pipeline can run on 2GB RAM and 1GB VRAM minimum—though the README notes these are minimums with 8GB RAM and 4GB VRAM recommended for practical use.
Gotcha
The biggest limitation isn’t technical—it’s legal and structural. The README opens with a prominent disclaimer: “This tool is intended for use with non-DRM, legally acquired eBooks only.” There’s no DRM-stripping functionality, which means you can’t convert your existing Kindle or Audible library without first removing protection (a legally gray area in most jurisdictions). The burden of compliance falls entirely on the user.
Performance is the second major constraint. The README explicitly warns that “modern TTS engines are very slow on CPU.” While specific benchmarks aren’t provided, the implication is clear: CPU-only processing will be significantly slower than GPU-accelerated conversion. The minimum specs (2GB RAM/1GB VRAM) are listed alongside recommended specs (8GB RAM/4GB VRAM), suggesting the minimums are technically viable but not optimal. If you’re running CPU-only, the README recommends using legacy engines like YourTTS or Tacotron2 rather than the more advanced options.
Chapter detection remains imperfect due to EPUB’s structural limitations. The README explicitly states: “EPUB format lacks any standard structure like what is a chapter, paragraph, preface etc. So you should first remove manually any text you don’t want to be converted in audio.” You’ll often need to manually edit the ebook file before conversion, stripping front matter and fixing chapter boundaries.
Verdict
Use ebook2audiobook if you’re sitting on a collection of DRM-free ebooks in non-English languages, have access to GPU acceleration (the README lists support for CUDA, ROCm, JETSON, and Apple Silicon), and value customization over convenience. It’s transformative for accessibility advocates creating audiobooks for underserved languages, researchers who need to consume academic papers audibly, or anyone who wants custom voice narration. The voice cloning feature and extensive language support justify the setup friction if you have specific requirements. Skip it if you’re working with DRM-protected content from major platforms, need production-ready quality without manual editing of ebook source files, or lack patience for the setup process. Commercial services like Speechify or Play.ht deliver better out-of-the-box quality for mainstream use cases. But for the long tail of languages, formats, and use cases that commercial tools ignore, ebook2audiobook is the only game in town—and it’s free.