Skip to content

marvinvr/auto-yt-shorts

Repository files navigation

project-logo

AUTO-YT-SHORTS

license last-commit repo-top-language repo-language-count

Developed with the software and tools below.

tqdm YAML SciPy OpenAI Python Docker GitHub%20Actions FastAPI


Table of Contents

Overview

Auto-yt-shorts is an open-source project designed to automate the process of generating engaging short videos for platforms like YouTube and TikTok. Leveraging AI models and APIs, it enables the effortless creation of video content by suggesting topics, generating voiceovers, adding subtitles, and incorporating stock footage. With features like automatic uploads, background song selection, and parallel execution, auto-yt-shorts offers a valuable solution for content creators seeking a seamless video production workflow.

Note: This project has been created out of curiosity and for educational purposes. It is not intended for commercial use or to infringe on any copyrights, and it is not actively being used to generate AI-generated videos.


Demo

The YouTube channel below showcases the auto-yt-shorts project in action, a few examples of the videos generated using the AI model, and the process of uploading them to the platform.

==> QuickQuirks YouTube Channel


Features

Feature Description
βš™οΈ Architecture The project utilizes a modular architecture with components for video generation, processing, and uploading. It leverages Python environment setup with Docker, FastAPI for web services, and OpenAI for content generation.
πŸ”Œ Integrations Key integrations include OAuth 2.0 for YouTube uploads, Pexels for stock videos, OpenAI for content generation, and AssemblyAI for audio processing. External dependencies like scipy and httplib2 enhance functionality.
🧩 Modularity The codebase is modular with distinct modules for metadata, video processing, AI content generation, and upload functionalities.
⚑️ Performance Efficiency is maintained through parallel execution for video processing, allowing for faster content generation. The use of Docker containers aids in resource management and scalability of the application.
πŸ“¦ Dependencies Key dependencies include oauth2client, FastAPI, OpenAI, and Docker for environment setup and execution. External libraries like pillow and opencv-python enhance image and video processing capabilities.

Repository Structure

└── auto-yt-shorts/
    β”œβ”€β”€ .github
    β”‚   └── workflows
    β”œβ”€β”€ Dockerfile
    β”œβ”€β”€ config.py
    β”œβ”€β”€ docker-compose.yml
    β”œβ”€β”€ environment.yml
    β”œβ”€β”€ example.env
    β”œβ”€β”€ fonts
    β”‚   └── bold_font.ttf
    β”œβ”€β”€ main.py
    β”œβ”€β”€ requirements.txt
    β”œβ”€β”€ test.http
    β”œβ”€β”€ upload_video.py
    └── utils
        β”œβ”€β”€ audio.py
        β”œβ”€β”€ llm.py
        β”œβ”€β”€ metadata.py
        β”œβ”€β”€ stock_videos.py
        β”œβ”€β”€ tiktok.py
        β”œβ”€β”€ video.py
        └── yt.py

Modules

.
File Summary
config.py Defines settings and API keys for controversial topic generation, OpenAI model selection, minimum/maximum search terms, and API keys for Pexels, AssemblyAI, and News API. Creates directories for temporary and output files, background songs, and secondary video content.
requirements.txt Manages project dependencies such as OpenAI and FastAPI to facilitate AI video generation, processing, and uploading functionalities within the auto-yt-shorts repository's ecosystem. The file ensures seamless integration of critical libraries for efficient execution of tasks.
environment.yml Defines dependencies and environment setup for Python project auto-yt-shorts. Specifies required packages and their versions, ensuring compatibility and consistent development environment for the repository.
Dockerfile Builds a Docker container for auto-yt-shorts project, setting up Python environment and executing necessary commands. Copies project files, installs dependencies, and initiates the main script within a Python virtual environment.
test.http Generate_videos/.
upload_video.py Enables uploading videos to YouTube with OAuth 2.0 authentication and customizable metadata. Implements retry logic and resumable uploads for reliability. Facilitates seamless integration with the parent repositorys video processing workflow.
docker-compose.yml Orchestrates Docker containers for the auto-yt-shorts service, configuring volumes and environment variables. Exposes port 8000 for external access.
main.py Generates and processes video content based on user input, leveraging parallel execution for efficiency. Handles video metadata, stock footage selection, voiceover generation, and automatic upload to the platform.
utils
File Summary
metadata.py Creates and stores metadata for a video, moving the video file to designated output location and saving metadata in JSON format.
llm.py Generates engaging TikTok video ideas, titles, and descriptions based on user input topics. Utilizes OpenAIs language model to suggest captivating content elements in a conversational manner. Enhances creativity in content creation for short-form videos.
yt.py Enables automatic and manual video uploads to YouTube. Automatically uploads video with specified details. Prepares videos for manual upload by organizing into folders with relevant metadata. Organized and streamlined YouTube video upload functionalities in the repository architecture.
tiktok.py Enables TikTok video uploads using AuthBackend for authentication and upload_video function. Facilitates captioning and customizing upload settings.
audio.py Generates voiceovers and selects random background songs for videos using OpenAI API and local files. Provides functionalities for creating audio files and selecting music assets in the auto-yt-shorts repository structure.
stock_videos.py Retrieves stock videos based on search terms using Pexels API. Integrates with the parent repositorys architecture via config and video utils. Implements video search and retrieval functionalities for further processing.
video.py Generates subtitles and combines videos into a single clip with burnt-in subtitles and background music. Includes functionality to save videos from URLs and add secondary content.

Getting Started

Locally

System Requirements:

  • Python: version 3.12

Installation

From source

  1. Clone the auto-yt-shorts repository:
$ git clone https://github.com/marvinvr/auto-yt-shorts
  1. Change to the project directory:
$ cd auto-yt-shorts
  1. Update the environment file:
$ cp example.env .env
  1. Update the .env file with your API keys and other credentials.

  2. Prefill the music and secondary_video directories with background music and secondary video content. The tool will automatically select and use these files.

  3. Setup and Authenticate with YouTube using the OAuth 2.0 flow:

Follow the instructions in the YouTube Data API documentation to create a project and obtain OAuth 2.0 credentials.

$ python upload_video.py
  1. Install the dependencies:
$ pip install -r requirements.txt

Usage

From source

Run auto-yt-shorts using the command below:

$ python main.py

With Docker

Start the Docker container using the command below:

$ docker compose up

The application will be accessible at http://localhost:8000. You can send a POST request to the /generate_videos endpoint with the required parameters to generate a video.


Contributing

Contributions are welcome! Here are several ways you can contribute:

  • Report Issues: Submit bugs found or log feature requests for the auto-yt-shorts project.
  • Join the Discussions: Share your insights, provide feedback, or ask questions.
Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your github account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone https://github.com/marvinvr/auto-yt-shorts
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to github: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
Contributor Graph


License

This project is protected under the MIT License. For more details, refer to the LICENSE file.


Acknowledgments

  • This project was inspired by the MoneyPrinter repository. Some of the code and ideas were adapted from this project.

About

Automatically generate Youtube Shorts using AI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published