This project is a video processing application using OpenCV inside a Docker container.
It applies a grayscale filter, overlays an image (overlay.png), and displays custom text centered in yellow on the video.
The overlay image blinks every 2 seconds in the bottom-right corner.
- ✅ Converts video to grayscale.
- ✅ Adds an overlay image (
overlay.png) in the bottom-right corner. - ✅ The overlay blinks every 2 seconds.
- ✅ Displays custom text centered in yellow (max 10 characters).
- ✅ Fully Dockerized – No need to install dependencies manually!
- Docker installed on your system.
- A video file (
input_video.mp4) placed inside theassets/folder. - An overlay image (
overlay.png) inside theassets/folder.
video-editor/
│── src/
│ ├── main.py # Runs the video processing
│ ├── video_editor.py # Video editing logic (OpenCV)
│── assets/
│ ├── input_video.mp4 # Input video file (required)
│ ├── overlay.png # Image to overlay (required)
│── requirements.txt # Python dependencies
│── Dockerfile # Docker setup
│── README.md # Documentationgit clone https://github.com/dbfarias/video-editor.git
cd video-editor2️⃣ Build the Docker Image
docker build -t video-editor .3️⃣ Run the Container
docker run --rm -v "$(pwd)/assets:/app/assets" video-editor "MyText"Example:
docker run --rm -v "$(pwd)/assets:/app/assets" video-editor "Hello!"After execution, the processed video will be saved as:
assets/output.mp4The project uses the following Python libraries:
opencv-python
numpy
pillow
ffmpeg-python1. Opens the input video (input_video.mp4).
2. Converts each frame to grayscale.
3. Loads the overlay image (overlay.png) and resizes it to fit in the bottom-right corner.
4. Makes the overlay blink every 2 seconds.
5. Displays a custom text (up to 10 characters) in yellow, centered on the video.
6. Saves the processed video as output.mp4.
• The overlay.png image must be smaller than the video resolution.
• If overlay.png has transparency, it will be smoothly blended with the video.
• If no text is provided, a default text (DefaultTXT) will be used.
📌 Troubleshooting
❓ “Could not broadcast input array” error?
This happens if overlay.png has an alpha channel (RGBA) but the video is only RGB. This is automatically handled in the latest version of video_editor.py.
❓ Docker volume error (invalid reference format)?
Try adding quotes around $(pwd) when running the container:
docker run --rm -v "$(pwd)/assets:/app/assets" video-editor "Hello!"