short-video-maker
repository·main·Indexed 22 days ago
https://github.com/gyoridavid/short-video-makerAn automated tool for generating short-form video content for TikTok, Instagram Reels, and YouTube Shorts from text prompts. It orchestrates Kokoro TTS for speech, Whisper for captioning, Pexels for stock footage, and Remotion for composition. The tool is available as a REST API and a Model Context Protocol (MCP) server, allowing integration with AI agents like n8n. Version 1.3.4.
What's inside short-video-maker
- Short Video Maker is an open-source automated tool for generating short-form video content from text inputs. It automates the process of text-to-speech (using Kokoro TTS), caption generation (using Whisper), background video selection (via Pexels), and video composition (using Remotion). The tool serves both as a REST API and a Model Context Protocol (MCP) server, making it suitable for integration with AI agents like n8n.
Understand the 'Scene' concept
mainVideos are assembled from multiple Scenes. Each scene consists of two primary components:
- Text: The narration that the Text-to-Speech (TTS) engine reads and from which captions are generated.
- Search terms: Keywords used to find relevant background videos via the Pexels API. If no specific terms are provided or found, the system uses 'joker terms':
nature,globe,space, orocean.
Run Short Video Maker via NPM
mainWhile Docker is recommended, you can run the server via
npmornpx.Supported Platforms:
- Ubuntu (≥ 22.04): Requires
git,wget,cmake,ffmpeg,curl,make, and several system libraries (libsdl2-dev,libnss3,libgbm-dev, etc.). - macOS: Requires
ffmpeg(install viabrew install ffmpeg) and Node.js (tested on 22+). - Windows: NOT supported due to
whisper.cppinstallation issues.
- Ubuntu (≥ 22.04): Requires
Run Short Video Maker with Docker Compose
mainUse Docker Compose to integrate Short Video Maker with other services like n8n. If using the Self-hosted AI starter kit, ensure you add
networks: ['demo']to the service configuration so n8n can reach it athttp://short-video-maker:3123.version: "3" services: short-video-maker: image: gyoridavid/short-video-maker:latest-tiny environment: - LOG_LEVEL=debug - PEXELS_API_KEY= ports: - "3123:3123" volumes: - ./videos:/app/data/videos # expose the generated videosHow to add new music to the project
mainTo expand the music library, follow these two steps:
- Place your MP3 file into the
static/music/directory. - Register the file in
src/short-creator/music.tsby adding a new object to themusicListarray. The object must specify the filename, the start and end timestamps (in seconds), and the correspondingMusicMoodEnumvalue.
{ file: "your-new-music-file.mp3", // Filename of your MP3 start: 5, // Start time in seconds (when to begin playing) end: 30, // End time in seconds (when to stop playing) mood: MusicMoodEnum.happy, // Mood tag for the music }- Place your MP3 file into the
Run Short Video Maker using Docker
mainDocker is the recommended method for deployment. There are three specialized images based on your hardware and resource availability:
Tiny (Recommended for limited resources)
Uses
tiny.enWhisper model andq4quantized Kokoro model. Optimized for low RAM/CPU withCONCURRENCY=1and a 2GB video cache.docker run -it --rm --name short-video-maker -p 3123:3123 -e LOG_LEVEL=debug -e PEXELS_API_KEY= <YOUR_KEY> gyoridavid/short-video-maker:latest-tinyNormal
Uses
base.enWhisper model andfp32Kokoro model. Optimized for standard resources.docker run -it --rm --name short-video-maker -p 3123:3123 -e LOG_LEVEL=debug -e PEXELS_API_KEY= <YOUR_KEY> gyoridavid/short-video-maker:latestCuda (For Nvidia GPU users)
Uses
medium.enWhisper model with GPU acceleration andfp32Kokoro model.docker run -it --rm --name short-video-maker -p 3123:3123 -e LOG_LEVEL=debug -e PEXELS_API_KEY= <YOUR_KEY> --gpus=all gyoridavid/short-video-maker:latest-cudadocker run -it --rm --name short-video-maker -p 3123:3123 -e LOG_LEVEL=debug -e PEXELS_API_KEY= gyoridavid/short-video-maker:latest-tinyDeploy short-video-maker to a VPS
mainWhen deploying to a cloud VPS, follow these recommendations:
- OS: Ubuntu ≥ 22.04
- Hardware: ≥ 4GB RAM, ≥ 2 vCPUs, and ≥ 5GB storage
- Process Management: Use pm2 to run and manage the server process.
- Environment Variables: Store your configuration in the
.bashrcfile or a similar environment management tool.
General Requirements for Short Video Maker
mainTo run Short Video Maker, ensure your environment meets the following requirements:
- Internet access: Required for Pexels API and potentially other services.
- Pexels API Key: A free key is required for background video sourcing.
- RAM: Minimum 3 GB (4 GB recommended).
- CPU: Minimum 2 vCPUs.
- Disk Space: Minimum 5 GB.
Connect n8n to short-video-maker
mainThe connection URL between n8n and the
short-video-makerserver depends on your deployment architecture:short-video-makerLocationn8n Local ( n8n start)n8n Docker n8n Cloud Docker http://localhost:3123http://short-video-maker:3123(if on same network) orhttp://host.docker.internal:3123Requires cloud deployment of maker NPM/NPX http://localhost:3123http://host.docker.internal:3123Requires cloud deployment of maker Cloud http://{YOUR_IP}:3123http://{YOUR_IP}:3123http://{YOUR_IP}:3123Core components of the ShortCreator
mainThe
ShortCreatorclass is the central orchestrator of the video generation process. It requires the following initialized components to function:Config: Application configuration.Remotion: Video rendering engine.Kokoro: Text-to-speech (TTS) engine.Whisper: Speech-to-text (STT) engine.FFMpeg: Media processing utility.PexelsAPI: Stock video footage provider.MusicManager: Handles music file management and availability.
Configure Short Video Maker environment variables
main🟢 Application Configuration
key description default PEXELS_API_KEYYour free Pexels API key LOG_LEVELPino log level infoWHISPER_VERBOSEWhether to forward whisper.cpp output to stdout falsePORTThe port the server will listen on 3123⚙️ System Configuration
key description default KOKORO_MODEL_PRECISIONThe size of the Kokoro model to use. Valid options: fp32,fp16,q8,q4,q4f16depends on Docker image CONCURRENCYNumber of parallel browser tabs for Remotion rendering. Lowering this helps on limited hardware. depends on Docker image VIDEO_CACHE_SIZE_IN_BYTESCache size for Remotion OffthreadVideo frames. depends on Docker image Configure Video Generation Options
mainWhen making requests to the API, you can specify the following configuration options to customize the output video:
key description default paddingBackEnd screen duration (in milliseconds) after narration finishes. 0musicMood of background music. Use values from the GET /api/music-tagsendpoint.randomcaptionPositionPosition of captions: top,center, orbottom.bottomcaptionBackgroundColorBackground color of the active caption item. bluevoiceThe Kokoro voice identifier (e.g., af_heart).af_heartorientationVideo orientation: portraitorlandscape.portraitmusicVolumeBackground music volume: low,medium,high, ormuted.high