π¨ New Feature: Added
auto-generate-video.cβ automatically generates multiple videos from a.txtfile of ideas.
This repository contains my AI Video Generator, a C-based tool that automates short-form content video creation using AI. It includes standalone programs for AI prompting, text-to-speech, subtitle generation, and audio/video merging; all combined in one master program for content generation.
This master program is ideal for creating quick AI-powered video content without any subscriptions or extra tools. Just write an idea, confirm the script, and let it do the rest. π
Watch demo: demo link
Watch example output: example link
- Overview
- Installation Instructions
- Standalone Programs
- Master Program
- Auto Batch Generator
- Bug Reports & Feature Suggestions
- License
This project includes 4 standalone programs and 2 automation program:
- Each standalone program can be used independently for its specific functionality.
- The automation programs (
prompt-to-video.candauto-generate-video.c) combine everything into automated AI-powered video generation workflows.
Originally made to avoid overpriced tools and test my C skills, this project uses:
- C as the primary language
- Some Python for JSON parsing
- System calls like
read,write,dup2,pipe,execl,fork, and more
Make sure you have the following installed:
python3gcccompiler- A terminal or shell (Zsh or Bash)
- Homebrew
β macOS is HIGHLY recommended. Other operating systems will require adjustments.
git clone <repo-url>
cd video-generatormake installThis installs:
ffmpegβ for video/audio processingcurlβ for HTTP requestsWhisperβ for subtitle generation
β οΈ Requires Homebrew (for macOS)
Edit the Makefile and replace:
KEY = "PLACEHOLDER"with:
KEY = "your-api-key-here"If you're using Zsh (macOS default):
make setup-env
source ~/.zshrcIf you're using Bash:
Uncomment the Bash lines in the setup-env section of the Makefile, then run:
make setup-env
source ~/.bashrcmakeNote: make all is an equivalent command
This compiles all the programs:
text_to_audiohttp-requestadd-subsmerge-audioprompt-to-videoauto-generate-video
You're now ready to use the tools individually or together through prompt-to-video.
If your directory gets too cluttered, you can run:
make cleanThis deletes all the files produced by make, including executables. Be sure to recompile everything before next use (See step 5)!
This project includes four standalone programs that can be used independently or as part of the master program prompt-to-video.c:
Prompts DeepSeek AI directly from the terminal. It parses the JSON response and saves only the AI's generated text into a file called ai-out.
πΉ Usage:
./http-request
Converts a text file into an audio file. You can choose between .aiff, .mp3, or .wav formats using flags.
πΉ Usage:
./text_to_audio -[flag] input_text_file
(Useno flagfor.aiff,-mmp3for.mp3,-wavfor.wav)
Default (AIFF):
./text_to_audio input_text_file
Burns subtitles onto a video. It uses the Whisper model to generate a .srt file, converts it to .ass, and overlays it on the video.
πΉ Usage:
./add-subs input_video.mp4 output_video.mp4
Merges an audio file onto a video and automatically truncates the video to match the audio length.
πΉ Usage:
./merge-audio input_audio input_video output_video
The prompt-to-video program is the all-in-one tool that automates the creation of short-form AI-generated videos. It combines all standalone programs:
http-request.cto generate the video script via DeepSeek AItext_to_audio.cto convert the script into audiomerge-audio.cto overlay the audio on a background video (and auto-truncate)add-subs.cto generate subtitles and burn them onto the video
No manual steps are required once you confirm the AI-generated script β the video is fully created with voiceover and subtitles in one shot.
There are two ways to run prompt-to-video:
./prompt-to-videoTo use this method, you must define the DEFAULT_VIDEO macro at the top of prompt-to-video.c:
#define DEFAULT_VIDEO "path/to/background-video.mp4"Don't forget to recompile after editing:
make prompt-to-video./prompt-to-video path/to/background-video.mp4This method lets you pick any video file on the fly.
/video-generator/videos directory.
A new feature! The program auto-generate-video.c automates video creation by reading ideas line-by-line from a .txt file and generating a corresponding video for each idea. Each output video file is indexed in the order the idea was read.
./auto-generate-video <input.txt> <background-video-path.mp4>-
If no background video path is specified, define the
DEFAULT_VIDEOmacro at the top of the source file with the default video path. -
The program produces indexed video files (inside
/video-generator/videosdirectory) corresponding to each line in the input text file.
If you encounter any bugs or have ideas for new features, feel free to open an issue in the Issues section.
You can also start a conversation or ask questions in the Discussions tab!
MIT License
Copyright (c) 2025 Karl-A. Michaud
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.