Skip to content

πŸŽ₯ An AI-powered novel video generation system that automatically converts text novels into high-quality videos using Doubao's LLM, TTS, image generation, and video generation APIs with intelligent storyboarding and multi-modal content synthesis.

License

Notifications You must be signed in to change notification settings

stephengineer/NovelVideo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

47 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 Novel Video Generator System

πŸ€– AI-powered novel-to-video conversion platform

πŸ“– Project Overview

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:

  1. πŸ“š Novel Analysis: Uses DeepSeek large language model to analyze novel content and generate storyboard scripts
  2. 🎨 Asset Generation: Calls Volcengine's TTS, text-to-image, and image-to-video models to generate corresponding assets
  3. 🎞️ Video Composition: Combines multiple assets into complete scene videos
  4. 🎯 Final Assembly: Merges multiple scene videos into a complete novel interpretation video

πŸ—οΈ System Architecture

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

✨ Features

πŸš€ Core Features

  • πŸ“¦ 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

πŸŽ₯ Video Generation

  • 🧠 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

βš™οΈ System Management

  • πŸ”§ 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

πŸš€ Installation and Configuration

πŸ“‹ Requirements

  • 🐍 Python 3.8+
  • 🎬 FFmpeg (for video processing)
  • πŸ’Ύ Sufficient disk space (for video file storage)

πŸ“¦ Installation Steps

  1. πŸ“₯ Clone the repository
git clone <repository-url>
cd novel_video
  1. πŸ“š Install dependencies
pip install -r requirements.txt
  1. πŸ”‘ Configure environment variables Create a .env file and configure the following variables:
# Doubao unified API configuration
DOUBAO_API_KEY=your_doubao_api_key
DOUBAO_APP_ID=your_doubao_app_id
  1. βš™οΈ Configure Doubao API Configure Doubao large language model, TTS, text-to-image, and image-to-video APIs according to Volcengine official documentation:

🎯 Usage

πŸ’» Command Line Usage

  1. πŸ“€ Submit a new task
python main.py --input novel.txt --output output_dir
  1. πŸ“Š Check system status
python main.py --status
  1. πŸ“‹ List all tasks
python main.py --list-tasks
  1. πŸ” Check task status
python main.py --task-id task_id
  1. πŸ”„ Retry failed task
python main.py --task-id task_id --retry
  1. πŸ‘» Daemon mode
python main.py --daemon

πŸ–₯️ Interactive Mode

python main.py

πŸ“¦ Batch Processing

# Process all txt files in the directory
for file in data/input/*.txt; do
    python main.py --input "$file"
done

βš™οΈ Configuration

πŸ”§ Main Configuration Items

# 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: 30

πŸ”Œ API Service Configuration

🧠 Doubao Large Language Model API

Used for novel analysis and storyboard script generation. API key and endpoint need to be configured in the configuration file.

🌐 Doubao API Services

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.

πŸ“Š Monitoring and Logging

πŸ“ Log Files

  • logs/novel_video_YYYY-MM-DD.log: Main log file
  • logs/error_YYYY-MM-DD.log: Error log file

πŸ’Ύ Database Monitoring

The system uses SQLite database to store task status and file information. You can view it using:

sqlite3 data/database/novel_video.db

πŸ“ˆ Performance Monitoring

The system provides detailed performance monitoring information, including:

  • πŸ“ž API call statistics
  • ⏱️ Task execution time
  • πŸ’» Resource usage

πŸ”§ Troubleshooting

❗ Common Issues

  1. 🚫 API call failures

    • πŸ”‘ Check API key configuration
    • 🌐 Verify network connection
    • πŸ“Š Check API quota limits
  2. 🎬 Video generation failures

    • πŸŽ₯ Check FFmpeg installation
    • πŸ’Ύ Ensure sufficient disk space
    • πŸ”’ Check temporary file permissions
  3. ⏰ Task timeouts

    • βš™οΈ Adjust task timeout configuration
    • πŸ’» Check system resource usage
    • ⚑ Optimize concurrency settings

πŸ› Debug Mode

Enable detailed logging:

# Modify log level in configuration file
logging:
  level: "DEBUG"

πŸ‘¨β€πŸ’» Development Guide

πŸ”§ Adding New Services

  1. πŸ“ Create a new service class in the src/services/ directory
  2. πŸ”— Inherit from VolcengineService or create an independent service class
  3. βš™οΈ Implement corresponding API calling methods
  4. πŸ”Œ Integrate the new service in NovelProcessor

🎯 Extending Processors

  1. πŸ“ Create a new processor in the src/processors/ directory
  2. βš™οΈ Implement corresponding processing methods
  3. πŸ“‹ Register new task types in the task scheduler

βš™οΈ Custom Configuration

  1. πŸ“ Modify the config/config.yaml file
  2. πŸ”§ Use config.get() in code to retrieve configuration
  3. 🌍 Support environment variable overrides

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

🀝 Contributing

We welcome contributions! Please feel free to submit Issues and Pull Requests to improve the project.

πŸ“ž Contact

If you have questions or suggestions, please contact us through:

  • πŸ› Submit a GitHub Issue
  • πŸ“§ Send an email to the project maintainer

⚠️ Note: Using this system requires appropriate API keys and quotas. Please ensure compliance with each service provider's terms of use.

About

πŸŽ₯ An AI-powered novel video generation system that automatically converts text novels into high-quality videos using Doubao's LLM, TTS, image generation, and video generation APIs with intelligent storyboarding and multi-modal content synthesis.

Topics

Resources

License

Stars

Watchers

Forks

Languages