Save Space without Compromising Quality

Emily Techscribe Avatar

·

Shrinking Videos with video-diet: Save Space without Compromising Quality

Are you running out of storage space because of your collection of old movies, videos, and music files? Are you looking for a solution to compress your videos and audios without compromising quality? Look no further, because video-diet is here to help you reclaim valuable disk space.

video-diet is a powerful tool that can significantly reduce the size of your videos and audios by encoding them using the High Efficiency Video Coding (hevc) codec. This innovative codec offers a remarkable compression ratio without compromising visual or audio quality.

Why video-diet?

The creator of video-diet, a fellow storage space enthusiast, was constantly struggling with a shortage of disk space due to a large collection of old movies, videos, and music files. However, upon stumbling upon the hevc codec, they discovered a game-changing solution. By converting a 3GB video file into a mere 300MB, with no noticeable loss in quality, the converter impressed them enormously. Inspired by this discovery, they decided to build a tool that could help them convert their entire collection of video and audio files effectively. Thus, video-diet was born.

You might be wondering what makes the hevc codec so special. High Efficiency Video Coding (hevc), also known as H.265, is a video compression standard that offers superior compression efficiency compared to its predecessor, H.264. This means that you can significantly reduce the size of your video and audio files without sacrificing quality. With video-diet, you can shrink your media files and free up valuable storage space on your hard drive.

Installation

To get started with video-diet, you first need to install the tool. The installation process is simple and can be done via pip. Just run the following command in your terminal:

console
$ pip install video-diet

FFMPEG

Before you can use video-diet, make sure you have FFMPEG installed on your system. FFMPEG is a versatile and powerful multimedia framework that handles the conversion of audio and video files. The installation process for FFMPEG depends on your operating system.

For Linux

If you are using a Linux machine, you can install FFMPEG using your favorite package manager. Here are the installation commands for Arch and Debian/Ubuntu:

For Arch:
console
sudo pacman -S ffmpeg

For Debian/Ubuntu:
console
sudo apt-get install ffmpeg

For Windows

For Windows users, download the Windows version of FFMPEG from the official FFMPEG website (https://ffmpeg.org/download.html). Unzip the downloaded file and rename the folder to “FFmpeg”. Copy the folder to your “C:\” drive and add the “C:\FFmpeg\bin” path to your system’s environment variables. To verify the installation, open a new command prompt window and type the following command:

console
ffmpeg --version

If installed correctly, it should display the version information of FFMPEG.

Usage

Once you have installed video-diet and FFMPEG, you are ready to start shrinking your videos and audios. video-diet offers several options for converting individual files or entire folders.

For a File

To convert a single file, run the following command:

console
video-diet file test.mp4

This option preserves the original file while creating a compressed version.

For a Folder

To convert all the files in a folder, use the following command:

console
video-diet folder ~/Videos

This option replaces the original files with the compressed versions.

Ignoring Files or Folders

If there are specific files or folders that you want to exclude from the conversion process, you can use the --ignore-extension and --ignore-path options.

To ignore files with a specific extension, use the --ignore-extension flag followed by the extension. For example, to ignore all .mp4 files in the folder “~/Videos”, run the following command:

console
video-diet folder ~/Videos --ignore-extension .mp4

To ignore files within a specific folder, use the --ignore-path flag followed by the path to the folder. For example, to ignore all files in the subfolder “~/Videos/subfolder”, run the following command:

console
video-diet folder ~/Videos --ignore-path ~/Videos/subfolder

Note

Please keep in mind that the video conversion process can take some time, depending on the properties of the original videos. The conversion time may be longer than the duration of the video itself.

For Developers

If you are a developer interested in contributing to video-diet or exploring its underlying code, here are some instructions to get started.

First, you need to install Poetry, a dependency and virtual environment management tool for Python. Run the following command to install Poetry:

OSX / Linux / Bash on Windows installation instructions:

console
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python

Windows PowerShell installation instructions:

console
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python

Once Poetry is installed, navigate to the project directory and run poetry install to install the project’s dependencies. After that, run poetry shell to activate the virtual environment.

To test the code, run the command video-diet.

For more details on contributing to the project, refer to the CONTRIBUTING.md file in the project repository.

Good luck with your journey of optimizing your storage space with video-diet! If you have any questions or feedback, feel free to reach out to the project’s creator. Happy shrinking! 😉

Leave a Reply

Your email address will not be published. Required fields are marked *