Topview Logo
  • Create viral videos with
    GPT-4o + Ads library
    Use GPT-4o to edit video empowered by Youtube & Tiktok & Facebook ads library. Turns your links or media assets into viral videos in one click.
    Try it free
    gpt video

    I Automated YouTube Shorts with Python

    blog thumbnail

    Introduction

    When scrolling through YouTube Shorts, I stumbled upon videos showcasing random facts about the world. One of them featured the immortal jellyfish, a fascinating creature defying the boundaries of life and death. I realized how easily these videos could be automated with minimal effort. Thus, I embarked on a project using Python, leveraging the MoviePy library. I named this project "Money Printer" as it aimed to generate videos effortlessly. Here's a breakdown of how I automated the process:

    Initially, I designed a simple front end where users could input their video ideas, which would then trigger the automatic video generation. Utilizing Python's CGT library, I had it create a video script derived from the user's idea. Next, I relied on the JPT-generated search terms to find suitable stock videos, utilizing the Pexels API for its user-friendliness and cost-effectiveness. However, a hurdle arose with the varying resolutions of the Pexels API videos. To address this, I manually cropped the videos using MoviePy to avoid issues with rendering.

    For text-to-speech, I opted for a TikTok TTS unofficial API from GitHub to avoid the robotic sound of other APIs due to budget constraints. Assembly AI facilitated the transcription of the generated speech, offering timestamps and saving the subtitles in SRT format. Leveraging MoviePy once more, I seamlessly burned the subtitles into the video by concatenating the original file with the SRT file.

    Upon completion, the application could successfully automate the process, culminating in the creation of an output MP4 video. The final results showed promising engagement on YouTube Shorts, validating the efficiency and effectiveness of the automation bot.


    Keywords

    • YouTube Shorts
    • Python automation
    • MoviePy library
    • Pexels API
    • Text-to-speech
    • Assembly AI
    • Automation bot

    FAQ

    • What tools were used to automate the YouTube Shorts creation process?

      • The project utilized Python with the MoviePy library for video editing, CGT for video scripting, Pexels API for stock videos, a TikTok TTS unofficial API for text-to-speech, and Assembly AI for transcription.
    • How did the project handle the issue of variable video resolutions from the Pexels API?

      • To overcome the challenge of differing resolutions in Pexels API videos, the creator opted to manually crop the videos using MoviePy instead of resizing them, ensuring a consistent output without rendering errors.
    • What was the outcome of testing the automated clips on a YouTube channel?

      • The automated videos garnered a significant number of views on YouTube Shorts, indicating the success and viability of the automation bot for content creation.

    One more thing

    In addition to the incredible tools mentioned above, for those looking to elevate their video creation process even further, Topview.ai stands out as a revolutionary online AI video editor.

    TopView.ai provides two powerful tools to help you make ads video in one click.

    Materials to Video: you can upload your raw footage or pictures, TopView.ai will edit video based on media you uploaded for you.

    Link to Video: you can paste an E-Commerce product link, TopView.ai will generate a video for you.

    You may also like