How rishabhjain2003/autosubai works
1. What this repo is
- A small Python CLI package for generating subtitle files from YouTube URLs.
- It is not a service or web app; the whole architecture is a local command-line pipeline.
2. Top-level structure
- setup.py packages and exposes the tool for installation.
- requirements.txt captures runtime dependencies.
- yt_whisper/ contains the actual application code.
- README.md documents the user-facing flow and supported options.
3. Primary entry point
- yt_whisper/cli.py is the main boundary between the user and the system.
- This layer is responsible for parsing command-line arguments such as the video URL, Whisper model size, and translation task.
4. Core processing layer
- yt_whisper/utils.py appears to hold the operational logic for the pipeline.
- This is where the repo likely separates media download, audio preparation, Whisper inference, and subtitle file generation.
5. End-to-end data flow
- Input: a YouTube video URL from the CLI.
- Step 1: the tool downloads audio from YouTube using yt-dlp.
- Step 2: the audio is processed by Whisper locally.
- Step 3: subtitle segments are converted into .vtt.
- Output: a subtitle file written to the local filesystem.
6. External dependencies that shape the architecture
- yt-dlp is the ingestion layer for pulling media from YouTube.
- ffmpeg is an external system dependency for audio extraction/transcoding.
- Whisper models are selected locally (tiny through large), affecting compute cost and transcription quality.
7. Feature boundary: transcription vs translation
- The --task translate option changes the Whisper job from transcription to English translation.
- This is a pipeline-level mode switch rather than a separate subsystem.
8. Output contract
- The system’s final artifact is a standard WebVTT subtitle file.
- That makes the output interoperable with media players and subtitle tooling.
9. Packaging/runtime boundary
- The project is distributed as a Python package installed via pip.
- Runtime requirements include Python 3.7+ plus system-level ffmpeg, so the architecture depends on both Python libraries and an OS-installed binary.
10. Likely architectural diagram shape
- One user-facing CLI box feeding into a small internal processing box.
- From there, arrows go to YouTube/yt-dlp for download, to local Whisper for inference, and to local filesystem for .vtt output.
- There are no evident internal microservices, databases, or remote application servers.
11. Important repo characteristic
- The codebase is intentionally minimal: a thin CLI wrapper around a single local media-processing pipeline.
- Most architectural complexity comes from the external tools it orchestrates, not from many internal modules.
Main entry points: cli.py CLI · utils.py Pipeline · setup.py Setup · requirements.txt Requirements
Components 15
Repository
Python package, CLI entrypoint, and core pipeline code.
- README · User-facing usage and option overview.
README.md - Setup · Package metadata and console-script exposure.
setup.py - Requirements · Runtime Python dependency list.
requirements.txt - Package · Python package namespace marker.
yt_whisper/__init__.py - CLI · Parses URL, model choice, and task mode.
yt_whisper/cli.py - Pipeline · Coordinates download, inference, and output generation.
yt_whisper/utils.py - Download audio · Fetches media from YouTube via yt-dlp.
- Prep audio · Uses ffmpeg-backed processing before inference.
- Whisper run · Runs local Whisper transcription or translation.
- VTT writer · Converts segments into a WebVTT subtitle file.
External
Runtime tools and inputs the CLI orchestrates.
- YouTube · Source video addressed by the CLI URL.
- yt-dlp · Downloads audio from YouTube.
- ffmpeg · System-level audio extraction/transcoding dependency.
- Whisper · Local speech-to-text model selected by size and task.
- Filesystem · Writes the final .vtt artifact locally.
Connections 16
- README → CLI: documents · Describes the command-line flow and options.
- Setup → CLI: exposes · Installs the CLI entrypoint for pip-based use.
- Setup → Requirements: depends on · Package/runtime dependency specification.
- CLI → Pipeline: invokes · Hands parsed arguments to the processing pipeline.
- CLI → Download audio: starts · Begins the media acquisition stage.
- CLI → Whisper run: selects mode · Chooses transcription or translation task.
- Download audio → yt-dlp: uses · Delegates YouTube media fetching to yt-dlp.
- yt-dlp → YouTube: reads from · Pulls the source video/audio from YouTube.
- Pipeline → Prep audio: coordinates · Stages audio before model inference.
- Prep audio → ffmpeg: uses · Relies on ffmpeg for extraction/transcoding.
- Pipeline → Whisper run: coordinates · Runs the Whisper job after preparation.
- Whisper run → Whisper: uses · Executes the selected Whisper model locally.
- Whisper run → VTT writer: emits · Produces timestamped subtitle segments.
- VTT writer → Filesystem: writes · Saves the final WebVTT file locally.
- Requirements → ffmpeg: depends on · Python requirements complement the OS binary dependency.
- Package → CLI: namespaces · Marks the installable package boundary.