Automate Video Editing with Python: Add Dynamic Top & Bottom Text to Shorts
Overview
We will learn how to add dynamic text on both the top and bottom of a video, similar to what you often see on Instagram Reels or YouTube Shorts, where a title appears at the top and a call-to-action message appears at the bottom.
Using Python, we will:- Split a long video into multiple short parts
- Convert each part into a vertical (9:16) format
-
Add dynamic top text with an auto-incrementing part number
-
Add custom bottom text for engagement or promotion
Why Add Text on Top and Bottom of Videos?
If you regularly watch Instagram Reels or YouTube Shorts, you may have noticed that:-
The top text usually shows the title or part number
-
The bottom text is often used for a message like “Watch full video”, “Follow for more”, or “Don’t miss this”
- Viewer retention
- Content clarity
- Engagement and clicks
What This Python Script Does
This Python script processes a single long video and converts it into multiple short vertical videos.
Key features of the script:- Cuts the video into fixed-duration parts (for example, 10 seconds each)
-
Resizes the video to fit a 1080×1920 (9:16) vertical format
- Places the video in the center with a clean black background
-
Adds top text with a dynamic number (Part 1, Part 2, Part 3, etc.)
-
Adds bottom text for a custom message
- Exports each part as a separate video file
Technologies Used
This project is built using the following Python libraries:-
Python – Core programming language
-
MoviePy – Video processing and editing
-
Pillow (PIL) – Text rendering and image handling
-
NumPy – Image array processing
Where to Add the YouTube Video (Important)
Below this section, you should embed your YouTube video so readers can visually understand how the script works and see the final output.Paste your YouTube embed code here
Adding the video here helps users:
- Understand the result clearly
- Follow the explanation step-by-step
- Learn faster with a real demo
Complete Python Code
Below is the complete Python script used in this project.
You can copy it, modify it, and use it for your own automation workflow.
Make sure to update:
- Input video file name
- Output folder
- Text content
- Font path (based on your system)
How Dynamic Numbering Works
One important feature of this script is dynamic numbering.
Each time a new short video is created:
- A number is added automatically at the end of the top text
- The number increases with every new video part
This is very useful when converting long videos into multiple parts because viewers can easily follow the sequence.
Final Thoughts
This Python-based approach is a powerful way to automate short-form content creation. If you:
- Create YouTube Shorts
- Upload Instagram Reels
- Work with video highlights
- Want to save hours of manual editing
Then this script can significantly improve your workflow. Take your time to go through the code and the YouTube video. If anything is unclear or if you want additional features like subtitles, animations, or background blur, feel free to leave a comment.hai.
Updating from the Previous Version (Git Pull – V2)
If you followed the previous article and already cloned the repository from GitHub, you do not need to clone it again.
You can simply update your existing project by pulling the latest version of the code.
The Version 2 (V2) update includes:
- Dynamic top text with auto-incrementing part numbers
- Bottom text overlay for call-to-action messages
- Improved layout for vertical (9:16) videos
- Cleaner and more structured code
To get the latest version, navigate to your project folder and run:
This command will fetch the updated V2 code directly into your existing setup.
Cloning the Repository (If You Don’t Have the Code)
If you did not follow the previous article or do not have the repository cloned yet, you can start fresh by cloning the project from GitHub. Use the following command:- The full Python video automation script
- All dependencies and project structure
- The latest V2 implementation with text overlay features
Admin
User Reviews & Comments
Share your experience with this Blog. Your feedback helps our community make informed decisions!
Share Your Experience
Help others by sharing your thoughts about this Blog.
Related Blogs
Explore more Blogs in the same language
Automating Long Video Splitting into Short Clips Using Python
Python
Learn how to automatically split long videos into short clips using Python. Create reels-ready videos with free, local video automation for Instagram and Facebook.
No Reviews Yet
Be the first to share your experience with this Blog!