π€ AI-powered novel-to-video conversion platform
This is an AI-based novel video generation system that converts novel text into high-quality video content. The system completes video generation through the following steps:
- π Novel Analysis: Uses DeepSeek large language model to analyze novel content and generate storyboard scripts
- π¨ Asset Generation: Calls Volcengine's TTS, text-to-image, and image-to-video models to generate corresponding assets
- ποΈ Video Composition: Combines multiple assets into complete scene videos
- π― Final Assembly: Merges multiple scene videos into a complete novel interpretation video
novel_video/
βββ config/ # Configuration files
β βββ config.yaml # Main configuration file
βββ src/ # Source code
β βββ core/ # Core modules
β β βββ config.py # Configuration management
β β βββ logger.py # Logging management
β β βββ database.py # Database management
β βββ services/ # Service modules
β β βββ doubao_service.py # Doubao API service
β β βββ volcengine_service.py # Volcengine base service
β β βββ tts_service.py # TTS service
β β βββ image_gen_service.py # Image generation service
β β βββ video_gen_service.py # Video generation service
β βββ processors/ # Processor modules
β β βββ video_processor.py # Video processor
β β βββ novel_processor.py # Novel processor
β β βββ subtitle_service.py # Subtitle service
β βββ scheduler/ # Scheduler modules
β βββ task_scheduler.py # Task scheduler
β βββ task_queue.py # Task queue
β βββ task_worker.py # Task worker threads
βββ data/ # Data directory
β βββ input/ # Input files
β βββ output/ # Output files
β βββ temp/ # Temporary files
β βββ database/ # Database files
βββ logs/ # Log files
βββ assets/ # Asset files
β βββ fonts/ # Font files
β βββ bgm/ # Background music
β βββ templates/ # Template files
βββ main.py # Main program entry
βββ requirements.txt # Dependencies list
βββ README.md # Project documentation
- π¦ Batch Processing: Supports batch processing of large numbers of novel files
- β‘ Task Scheduling: Multi-threaded task scheduling with concurrent processing support
- π Progress Tracking: Real-time tracking of task execution progress
- π‘οΈ Error Handling: Comprehensive error handling and retry mechanisms
- π Logging Management: Detailed logging and monitoring
- π§ Intelligent Storyboarding: AI-based intelligent storyboard script generation
- π Multi-modal Synthesis: Perfect integration of TTS, image generation, and video generation
- π¬ High-Quality Output: Support for multiple video formats and resolutions
- πΊ Subtitle Support: Automatic subtitle generation and composition
- π§ Configuration Management: Flexible configuration file management
- πΎ Database Storage: Persistent storage of task status and file information
- ποΈ File Management: Automatic file cleanup and storage management
- π API Monitoring: Detailed API call logging and monitoring
- π Python 3.8+
- π¬ FFmpeg (for video processing)
- πΎ Sufficient disk space (for video file storage)
- π₯ Clone the repository
git clone <repository-url>
cd novel_video- π Install dependencies
pip install -r requirements.txt- π Configure environment variables
Create a
.envfile and configure the following variables:
# Doubao unified API configuration
DOUBAO_API_KEY=your_doubao_api_key
DOUBAO_APP_ID=your_doubao_app_id- βοΈ Configure Doubao API Configure Doubao large language model, TTS, text-to-image, and image-to-video APIs according to Volcengine official documentation:
- π§ Doubao Large Language Model API Documentation
- π€ Doubao TTS API Documentation
- π¨ Doubao Text-to-Image API Documentation
- π¬ Doubao Image-to-Video API Documentation
- π€ Submit a new task
python main.py --input novel.txt --output output_dir- π Check system status
python main.py --status- π List all tasks
python main.py --list-tasks- π Check task status
python main.py --task-id task_id- π Retry failed task
python main.py --task-id task_id --retry- π» Daemon mode
python main.py --daemonpython main.py# Process all txt files in the directory
for file in data/input/*.txt; do
python main.py --input "$file"
done# Project configuration
project:
name: "novel_video_generator"
version: "1.0.0"
# File path configuration
paths:
input_dir: "data/input"
output_dir: "data/output"
temp_dir: "data/temp"
logs_dir: "logs"
# Task scheduling configuration
scheduler:
max_concurrent_tasks: 3
task_timeout: 3600
retry_attempts: 3
# Video processing configuration
video:
fps: 30
resolution: [1920, 1080]
codec: "libx264"
bitrate: "5000k"
# Storyboard configuration
storyboard:
max_scenes_per_chapter: 10
min_scene_duration: 5
max_scene_duration: 30Used for novel analysis and storyboard script generation. API key and endpoint need to be configured in the configuration file.
Doubao series services use unified API keys, including:
- π§ Doubao Large Language Model Service: Novel analysis and storyboard script generation
- π€ Doubao TTS Service: Text-to-speech conversion
- π¨ Doubao Text-to-Image Service: Text-to-image generation
- π¬ Doubao Image-to-Video Service: Image-to-video generation
Specific API calling methods need to be adjusted according to Volcengine's official documentation.
logs/novel_video_YYYY-MM-DD.log: Main log filelogs/error_YYYY-MM-DD.log: Error log file
The system uses SQLite database to store task status and file information. You can view it using:
sqlite3 data/database/novel_video.dbThe system provides detailed performance monitoring information, including:
- π API call statistics
- β±οΈ Task execution time
- π» Resource usage
-
π« API call failures
- π Check API key configuration
- π Verify network connection
- π Check API quota limits
-
π¬ Video generation failures
- π₯ Check FFmpeg installation
- πΎ Ensure sufficient disk space
- π Check temporary file permissions
-
β° Task timeouts
- βοΈ Adjust task timeout configuration
- π» Check system resource usage
- β‘ Optimize concurrency settings
Enable detailed logging:
# Modify log level in configuration file
logging:
level: "DEBUG"- π Create a new service class in the
src/services/directory - π Inherit from
VolcengineServiceor create an independent service class - βοΈ Implement corresponding API calling methods
- π Integrate the new service in
NovelProcessor
- π Create a new processor in the
src/processors/directory - βοΈ Implement corresponding processing methods
- π Register new task types in the task scheduler
- π Modify the
config/config.yamlfile - π§ Use
config.get()in code to retrieve configuration - π Support environment variable overrides
This project is licensed under the MIT License. See the LICENSE file for details.
We welcome contributions! Please feel free to submit Issues and Pull Requests to improve the project.
If you have questions or suggestions, please contact us through:
- π Submit a GitHub Issue
- π§ Send an email to the project maintainer