[RELEASE] Python Video Watermark

hiutaky

Registered Member
Joined
Sep 27, 2023
Messages
96
Reaction score
158
To get traffic to my new Porn Tube I needed a way to automate the way I add Watermarks to my Videos, so here's a script in Python using Flask and MoviePy to automate the whole process and get your video watermarked in minutes.

Flask library provide the ability to create a web-server accessible via Browser, while MoviePy help us manipulating video files.

The script right now works only with external sources, let's see how it works:
  1. Accessing che 127.0.0.1:5000 page, user can compile a Form providing info like: Source URL, Duration in Seconds, Watermark Label, Final Video Name and the preferred Codec
  2. On submitted, the script download the video and save it into the script folder
  3. The videos is cut based on the duration
  4. The Watermark is Generated and applied to the source video
  5. The final version is saved into the Script Folder using the provided name
The script right now is very simple, but quite effective.

Based on your Hardware you can choose 3 different codecs: libx264 (using CPU), h264_amf ( AMD GPUs ), h264_nvec ( NVIDIA GPUs ). Since I use it on Mac I use only libx264, providing me an average of 45 its/sec ( not that bad for a 8 core laptop ).

Feel free to edit and customize the code as you prefer.

How to use the script:
First ensure you've python3 installed, then create a folder named watermarker ( or whatever you want ), create a new file named start.py and paste the code into it.

Now we can install the libraries, so open a Terminal into the Folder and run:
pip install flask && pip install moviepy

Once the libraries are installed, we can run the script:
python3 start.py

The webserver will be started, and at that point you can access the index page at this address 127.0.0.1:5000. Compile the form and submit it. After some minutes you video will be completed. You can wait the page to complete the loading process or check the terminal log.

NOTICE: I've tested this script on MacOS, Ubuntu e Win 11. Check if you've intalled the FFMpeg library and ImageMagick otherwise MoviePy will give you back and error.


Code: PasteBin
 
I'm currently working a new version with React Interface and Pyhton as backend. Can be used via API or UI as well.
I love the photoshop like design
1697117441048.png
 
Back
Top