# apollo478/ascii-converter architecture

> Architecture diagram of the GitHub repository apollo478/ascii-converter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/apollo478/ascii-converter
- Repository: https://github.com/apollo478/ascii-converter

## Overview

ASCII Converter is a Go CLI for turning images, GIFs, videos, audio, and Linux webcam streams into terminal ASCII previews or saved media. Its main flow is command dispatch, media-specific decoding or frame/sample acquisition, ASCII rendering, then terminal display or encoded output. The README documents all five media workflows; sampled source confirms the video, camera, audio, and image/GIF paths. Camera/audio CLI wiring beyond the excerpts is shown only at the documented subsystem level.

Main entry points: [`cli/cli.go`](https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go) (Command dispatch), [`converter/converter.go`](https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go) (Terminal display), [`converter/audioConverter.go`](https://github.com/apollo478/ascii-converter/blob/main/converter/audioConverter.go) (Audio visualizations), [`converter/videoConverter.go`](https://github.com/apollo478/ascii-converter/blob/main/converter/videoConverter.go) (Camera rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_entry["Program entry<br/>[main.go]"]
  node_commands["Command dispatch<br/>[cli.go]"]
  node_image_flow["Image conversion<br/>[cli.go]"]
  node_gif_flow["GIF conversion<br/>[cli.go]"]
  node_video_flow["Video workflow<br/>[cli.go]"]
  node_camera_flow["Camera workflow<br/>[cli.go]"]
  node_audio_flow["Audio workflow<br/>[cli.go]"]
end

subgraph group_media["Media acquisition"]
  node_image_decode["Image/GIF decode<br/>[cli.go]"]
  node_video_reader["Video frame reader<br/>[FrameReader.go]"]
  node_camera_reader["Camera frame reader<br/>[FrameReader.go]"]
  node_audio_reader["Audio sample reader<br/>[audioReader.go]"]
  node_recorder["Video recorder<br/>[recorder.go]"]
end

subgraph group_render["ASCII rendering"]
  node_ascii_core["Image to ASCII<br/>[converter.go]"]
  node_gif_render["GIF frame rendering<br/>[converter.go]"]
  node_video_render["Video frame rendering<br/>[converter.go]"]
  node_audio_render["Audio visualizations<br/>[audioConverter.go]"]
  node_camera_render["Camera rendering<br/>[videoConverter.go]"]
end

subgraph group_output["Display and export"]
  node_terminal["Terminal display<br/>[converter.go]"]
  node_image_export["Image export<br/>[converter.go]"]
  node_gif_export["GIF export<br/>[converter.go]"]
  node_video_export["Video export<br/>[videoConverter.go]"]
  node_camera_export["Camera recording<br/>[videoConverter.go]"]
end

node_user(("User"))
node_ffmpeg["FFmpeg"]

node_user -->|"runs command"| node_entry
node_entry -->|"calls"| node_commands
node_commands -->|"dispatches"| node_image_flow
node_commands -->|"dispatches"| node_gif_flow
node_commands -->|"dispatches"| node_video_flow
node_commands -->|"dispatches"| node_camera_flow
node_commands -->|"dispatches"| node_audio_flow
node_image_flow -->|"opens and decodes"| node_image_decode
node_image_flow -->|"converts image"| node_ascii_core
node_image_flow -->|"writes image"| node_image_export
node_gif_flow -->|"decodes GIF"| node_image_decode
node_gif_flow -->|"converts frames"| node_gif_render
node_gif_flow -->|"writes animation"| node_gif_export
node_gif_render -->|"converts frames"| node_ascii_core
node_video_flow -->|"converts video"| node_video_render
node_video_render -->|"reads frames"| node_video_reader
node_video_reader -.->|"runs decoder"| node_ffmpeg
node_video_flow -->|"saves frames"| node_video_export
node_video_export -->|"encodes frames"| node_recorder
node_recorder -.->|"runs encoder"| node_ffmpeg
node_camera_flow -->|"starts capture"| node_camera_render
node_camera_render -->|"reads frames"| node_camera_reader
node_camera_reader -.->|"runs capture"| node_ffmpeg
node_camera_flow -->|"requests recording"| node_camera_export
node_camera_export -->|"writes frames"| node_recorder
node_audio_flow -->|"starts visualization"| node_audio_render
node_audio_render -->|"reads samples"| node_audio_reader
node_audio_reader -.->|"runs decoder"| node_ffmpeg
node_video_render -->|"renders pixels"| node_ascii_core
node_camera_render -->|"renders pixels"| node_ascii_core
node_audio_render -->|"prints visualization"| node_terminal
node_image_flow -->|"previews image"| node_terminal
node_gif_flow -->|"previews frames"| node_terminal
node_video_flow -->|"previews frames"| node_terminal
node_camera_flow -->|"previews frames"| node_terminal

click node_entry "https://github.com/apollo478/ascii-converter/blob/main/main.go"
click node_commands "https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go"
click node_image_flow "https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go"
click node_gif_flow "https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go"
click node_video_flow "https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go"
click node_camera_flow "https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go"
click node_audio_flow "https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go"
click node_image_decode "https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go"
click node_video_reader "https://github.com/apollo478/ascii-converter/blob/main/converter/FrameReader.go"
click node_camera_reader "https://github.com/apollo478/ascii-converter/blob/main/converter/FrameReader.go"
click node_audio_reader "https://github.com/apollo478/ascii-converter/blob/main/converter/audioReader.go"
click node_ascii_core "https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go"
click node_gif_render "https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go"
click node_video_render "https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go"
click node_audio_render "https://github.com/apollo478/ascii-converter/blob/main/converter/audioConverter.go"
click node_camera_render "https://github.com/apollo478/ascii-converter/blob/main/converter/videoConverter.go"
click node_terminal "https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go"
click node_image_export "https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go"
click node_gif_export "https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go"
click node_video_export "https://github.com/apollo478/ascii-converter/blob/main/converter/videoConverter.go"
click node_camera_export "https://github.com/apollo478/ascii-converter/blob/main/converter/videoConverter.go"
click node_recorder "https://github.com/apollo478/ascii-converter/blob/main/converter/recorder.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_commands,node_image_flow,node_gif_flow,node_video_flow,node_camera_flow,node_audio_flow,node_user toneBlue
class node_image_decode,node_video_reader,node_camera_reader,node_audio_reader,node_recorder toneAmber
class node_ascii_core,node_gif_render,node_video_render,node_audio_render,node_camera_render toneMint
class node_terminal,node_image_export,node_gif_export,node_video_export,node_camera_export toneRose
class node_ffmpeg toneIndigo
```

## Components

### CLI workflows

- [Program entry](https://github.com/apollo478/ascii-converter/blob/main/main.go): `main.go`
- [Command dispatch](https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go): `cli/cli.go`
- [Image conversion](https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go): `cli/cli.go`
- [GIF conversion](https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go): `cli/cli.go`
- [Video workflow](https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go): `cli/cli.go`
- [Camera workflow](https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go): `cli/cli.go`
- [Audio workflow](https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go): `cli/cli.go`

### Media acquisition

- [Image/GIF decode](https://github.com/apollo478/ascii-converter/blob/main/cli/cli.go): `cli/cli.go`
- [Video frame reader](https://github.com/apollo478/ascii-converter/blob/main/converter/FrameReader.go): `converter/FrameReader.go`
- [Camera frame reader](https://github.com/apollo478/ascii-converter/blob/main/converter/FrameReader.go): `converter/FrameReader.go`
- [Audio sample reader](https://github.com/apollo478/ascii-converter/blob/main/converter/audioReader.go): `converter/audioReader.go`
- [Video recorder](https://github.com/apollo478/ascii-converter/blob/main/converter/recorder.go): `converter/recorder.go`

### ASCII rendering

- [Image to ASCII](https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go): `converter/converter.go`
- [GIF frame rendering](https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go): `converter/converter.go`
- [Video frame rendering](https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go): `converter/converter.go`
- [Audio visualizations](https://github.com/apollo478/ascii-converter/blob/main/converter/audioConverter.go): `converter/audioConverter.go`
- [Camera rendering](https://github.com/apollo478/ascii-converter/blob/main/converter/videoConverter.go): `converter/videoConverter.go`

### Display and export

- [Terminal display](https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go): `converter/converter.go`
- [Image export](https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go): `converter/converter.go`
- [GIF export](https://github.com/apollo478/ascii-converter/blob/main/converter/converter.go): `converter/converter.go`
- [Video export](https://github.com/apollo478/ascii-converter/blob/main/converter/videoConverter.go): `converter/videoConverter.go`
- [Camera recording](https://github.com/apollo478/ascii-converter/blob/main/converter/videoConverter.go): `converter/videoConverter.go`

### Other components

- **User**
- **FFmpeg**

## Connections

- User → Program entry: runs command
- Program entry → Command dispatch: calls
- Command dispatch → Image conversion: dispatches
- Command dispatch → GIF conversion: dispatches
- Command dispatch → Video workflow: dispatches
- Command dispatch → Camera workflow: dispatches
- Command dispatch → Audio workflow: dispatches
- Image conversion → Image/GIF decode: opens and decodes
- Image conversion → Image to ASCII: converts image
- Image conversion → Image export: writes image
- GIF conversion → Image/GIF decode: decodes GIF
- GIF conversion → GIF frame rendering: converts frames
- GIF conversion → GIF export: writes animation
- GIF frame rendering → Image to ASCII: converts frames
- Video workflow → Video frame rendering: converts video
- Video frame rendering → Video frame reader: reads frames
- Video frame reader → FFmpeg: runs decoder
- Video workflow → Video export: saves frames
- Video export → Video recorder: encodes frames
- Video recorder → FFmpeg: runs encoder
- Camera workflow → Camera rendering: starts capture
- Camera rendering → Camera frame reader: reads frames
- Camera frame reader → FFmpeg: runs capture
- Camera workflow → Camera recording: requests recording
- Camera recording → Video recorder: writes frames
- Audio workflow → Audio visualizations: starts visualization
- Audio visualizations → Audio sample reader: reads samples
- Audio sample reader → FFmpeg: runs decoder
- Video frame rendering → Image to ASCII: renders pixels
- Camera rendering → Image to ASCII: renders pixels
- Audio visualizations → Terminal display: prints visualization
- Image conversion → Terminal display: previews image
- GIF conversion → Terminal display: previews frames
- Video workflow → Terminal display: previews frames
- Camera workflow → Terminal display: previews frames
