https://github.com/3urobeat/mp4sizer
📽 Easily compress a folder full of mp4 files to reach a target size!
https://github.com/3urobeat/mp4sizer
compress compression converter discord linux moviepy mp4 python video
Last synced: 8 months ago
JSON representation
📽 Easily compress a folder full of mp4 files to reach a target size!
- Host: GitHub
- URL: https://github.com/3urobeat/mp4sizer
- Owner: 3urobeat
- License: gpl-3.0
- Created: 2021-01-28T19:19:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-29T12:56:49.000Z (over 1 year ago)
- Last Synced: 2024-11-24T16:49:39.354Z (over 1 year ago)
- Topics: compress, compression, converter, discord, linux, moviepy, mp4, python, video
- Language: Python
- Homepage:
- Size: 72.3 KB
- Stars: 20
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# mp4sizer
Automatically let a python script compress a folder full of mp4 files for you.
Just provide a file size in MB which your video files should reach and the script will take care of the rest.
It is also possible to easily change the framerate and resolution of all clips.
**Use case example:** Get a bunch of video clips below 8 MB to be able to send them on Discord.
Â
## Download & Install:
You can either use a build (easy) or use it from source (a bit more complicated).
### Use a build:
[Download the latest release](https://github.com/3urobeat/mp4sizer/releases) for your platform and extract the folder.
> On Linux you have to run the executable from/in a Terminal.
### Use from Source:
Make sure to have [Python 3](https://www.python.org/downloads/) (`Windows x86-64 executeable installer`) installed.
If you are using Linux then you should be able to download python3 from your distribution's packet manager.
[Download this script](https://github.com/3urobeat/mp4sizer/archive/master.zip) and extract the folder.
Open up a terminal in the new folder and install the dependencies using pip, preferably inside a python virtual environment:
```bash
python -m venv ./venv
# On Linux
./venv/bin/pip install moviepy opencv-python colorama
# On Windows
.\venv\Scripts\pip.exe install moviepy opencv-python colorama
```
Â
## Usage:
Put all your mp4 files to compress into the `files` folder.
> Note: Please avoid putting clips into the folder that are already below your target size as they can get bigger after compressing.
Start the script and input the file size in MB you would like your clips to have.
To see more options type `help`. This will show how you can also change the framerate and resolution of your files for example.
When running the binary from a terminal (which you do on Linux), the syntax looks like this:
`./mp4sizer [options]`, e.g. `./mp4sizer 8 --res 1920x1080`
When not running the binary but the source file, make sure to use the venv python binary from the previous step instead:
`./venv/bin/python mp4sizer.py [options]`, e.g. `./venv/bin/python mp4sizer.py 8 --res 1920x1080`
The script will now try to get all your clips as close to the target file size you chose and output them into the `compressed` folder.
> Disclaimer: If your output files look bad afterwards please consider cutting them shorter or raising your target file size.
Â
## Additional information:
`moviepy` does seem to only support CPU Encoding (at least for me on Linux) so bigger files might take longer.