Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sanskarsharma/thumbgen/llms.txt

Use this file to discover all available pages before exploring further.

Thumbgen is configured entirely at runtime through environment variables — no source code changes or rebuilds are needed to adapt the service to your deployment environment. You can switch the shell used for ffmpeg commands, restrict the set of accepted image formats, or expand the list of supported video codecs, all by setting variables before the process starts.

Variables

ENV
string
Controls which shell is used to invoke ffmpeg commands during video thumbnail generation. This variable has no effect on image processing.When this variable is absent (the default), Thumbgen uses ash — the POSIX-compatible shell bundled with Alpine Linux, which is the base image used in the official Docker distribution.Set this to LOCAL to switch the shell to bash. This is required when running Thumbgen directly on macOS or most Linux distributions outside of Alpine, where ash is not available.
ValueShell used
(not set)ash (Alpine default)
LOCALbash
SUPPORTED_IMAGE_CONTENT_TYPES
string (JSON array)
A JSON-encoded array of MIME type strings that Thumbgen will accept as images. When this variable is set, it completely replaces the built-in default list.If this variable is not set, Thumbgen falls back to its compiled-in defaults:
["image/jpeg", "image/png", "image/gif", "image/bmp", "image/svg+xml", "image/tiff"]
Any request whose Content-Type does not match a value in the active list is rejected with HTTP 422.
SUPPORTED_VIDEO_CONTENT_TYPES
string (JSON array)
A JSON-encoded array of MIME type strings that Thumbgen will accept as videos. When this variable is set, it completely replaces the built-in default list.If this variable is not set, Thumbgen falls back to its compiled-in defaults:
["video/mp4", "video/3gpp", "video/mpv", "video/x-flv", "video/quicktime", "video/raw", "video/x-msvideo", "video/x-ms-wmv", "video/webm"]
Any request whose Content-Type does not match a value in the active list is rejected with HTTP 422.

Examples

# Local development on macOS / non-Alpine Linux
ENV=LOCAL go run main.go

# Override the accepted image MIME types
SUPPORTED_IMAGE_CONTENT_TYPES='["image/jpeg","image/png","image/webp"]' go run main.go

# Docker deployment with restricted video types
docker run -d -p 4499:4499 \
  -e SUPPORTED_VIDEO_CONTENT_TYPES='["video/mp4","video/webm"]' \
  thumbgen:v0
The values of SUPPORTED_IMAGE_CONTENT_TYPES and SUPPORTED_VIDEO_CONTENT_TYPES must be valid JSON arrays. If the string cannot be parsed as JSON, json.Unmarshal will return an error, which Thumbgen treats as a fatal condition and panics. The recovery middleware will catch the panic and return {"error": "There was an internal server error"} to the caller, but the thumbnail will not be generated. Always validate your JSON before deploying.
The port Thumbgen listens on — 4499 — is hardcoded in main.go and cannot be changed via an environment variable. To run on a different host port, use Docker’s port-mapping flag (e.g. -p 8080:4499) rather than trying to configure the service directly.

Build docs developers (and LLMs) love