hiutaky
Registered Member
- Sep 27, 2023
- 96
- 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:
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:
Once the libraries are installed, we can run the script:
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
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:
- 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
- On submitted, the script download the video and save it into the script folder
- The videos is cut based on the duration
- The Watermark is Generated and applied to the source video
- The final version is saved into the Script Folder using the provided name
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 moviepyOnce the libraries are installed, we can run the script:
python3 start.pyThe 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