A simple CLI tool designed to optimize different media files (pictures and videos) through a user-friendly interface, with keyboard-navigable menus, progress bars and extensive options to tweak its behavior and output quality.
For pictures:
- Input: 55 high-quality, 6240x4160 JPEG pictures taken with a DSLR camera, totalling 1.17 GiB.
- Options: size=original, format=original, quality=80
- Output: 256.57 MiB (78.5% less)
For videos:
- Input: 2 high-quality, 3840x2160 MPEG-4/H.264 videos recorded with a smartphone, totalling 460.37 MiB
- Options: size=original, quality=22 (no noticeable difference), preset=medium
- Output: 100.47 MiB (78.2% less)
Python dependencies are managed by the project, so you just need to follow the instructions below to use the tool.
However, there are some external dependencies that you will need to install manually for your system:
- Required only for video optimization:
- FFmpeg (>= 6.0)
- x265 encoder (FFmpeg distributable might include it)
Warning
I created this tool to reduce the size of pictures and videos, saving space for storage in cloud services and regular display usage, where high-accuracy data and ultrafine detail are not necessary.
Therefore, in most cases, lossy compression is used for these kinds of files.
If you want to optimize your pictures and videos for the same reason as I do, go ahead and use this tool. If, on the contrary, you need to retain high-detail data for editing, publishing or similar usages, using this tool to reduce the size of the source material is highly discouraged.
Currently, the recommended and most convenient way of using Media Optimizer is by downloading the distributable version.
You can find the latest version in the releases section. Make sure to choose the correct version for your OS. If you can't find a version for your specific OS or system architecture, no worries: you can build the distributable version yourself from the source code (see next section).
The distributable version is a portable executable, so you can use it directly from your terminal. For convenience, you might want to put the executable in a directory that is included in your PATH, which will allow you to run Media Optimizer without having to navigate to the directory that contains the executable.
Warning
Distributable versions are experimental. If you experience any issues while using them, please report them in the issues section.
In that case, it's also adviced that you opt for building the executable from source in your own machine, which will most likely fix those issues.
If you prefer, you can build the distributable version yourself from the source code:
-
Install the project manager,
uv: astral-sh/uv -
Clone the repository and install the necessary dependencies.
git clone https://github.com/gabrielrf96/media-optimizer.git cd media-optimizer uv sync2.1. If you're on an Apple Silicon Mac, make sure
uv synchas installed an arm64 version of Python in the virtualenv. That should be the case, but if you have an x86_64 version installed that matches the required version, uv might try to use that instead:file .venv/bin/python # The result should be something similar to: # .venv/bin/python: Mach-O 64-bit executable arm64 # If it's not, you can try re-syncing with the # --managed-python flag: rm -rf .venv uv sync --managed-python
-
Run the build command:
uv run devtools.py build
Once the build command finishes, you will be able to find the ready-to-use executable in the
dist/directory.
If you don't like running executables, there is also the less convenient but equally functional possibility of running Media Optimizer directly from the source:
-
Install the project manager,
uv: astral-sh/uv -
Clone the repository and install the necessary dependencies.
git clone https://github.com/gabrielrf96/media-optimizer.git cd media-optimizer uv sync --no-dev2.1. If you're on an Apple Silicon Mac, check out step 2.1. of the "Building from source" section to make sure you're building an arm64 executable.
-
Run the tool:
uv run media_optimizer.py
Done! The result is the same as running the distributable version.
Check out the specific instructions in the development guidelines document.
Media Optimizer relies on some third-party tools to provide its functionality.
This project is possible thanks to the developers and maintainers of all those dependencies.
Distributable versions of Media Optimizer are bundled with binaries of some third-party tools, and include a copy of all their licenses for reference and attribution, complying with the legal requirements of said licenses.
Media Optimizer requires some external dependencies to be installed on your system in order to function properly, as stated in the "Dependencies" section:
- FFmpeg
- x265 encoder (bundled with FFmpeg)
If you experience any kind of trouble while using this tool, please feel free to report any bugs or problems by opening an issue.
Made by Gabriel Rodríguez
www.gabrielrf.dev



