Metadata-Version: 2.4
Name: diet-video
Version: 0.1.16rc0
Summary: Reduce the size of videos and audio files by re-encoding them.
Author: javier
Author-email: javier <javiale2000@gmail.com>
License-Expression: GPL-3.0-only
Requires-Dist: enlighten>=1.6.2
Requires-Dist: ffmpeg-python>=0.2.0
Requires-Dist: filetype>=1.0.7
Requires-Dist: pexpect>=4.8.0 ; sys_platform != 'win32'
Requires-Dist: ansicon>=1.89.0 ; sys_platform == 'win32'
Requires-Dist: typer>=0.3.2
Requires-Dist: wexpect>=4.0.0 ; sys_platform == 'win32'
Requires-Python: >=3.13
Project-URL: Repository, https://github.com/JavierOramas/video-diet
Description-Content-Type: text/markdown

# Diet-Video

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg?label=license)](https://www.gnu.org/licenses/gpl-3.0) [![Last commit](https://img.shields.io/github/last-commit/JavierOramas/video-diet.svg?style=flat)](https://github.com/JavierOramas/video-diet/commits) [![GitHub commit activity](https://img.shields.io/github/commit-activity/m/JavierOramas/video-diet)](https://github.com/JavierOramas/video-diet/commits) [![Github Stars](https://img.shields.io/github/stars/JavierOramas/video-diet?style=flat&logo=github)](https://github.com/JavierOramas/video-diet) [![Github Forks](https://img.shields.io/github/forks/JavierOramas/video-diet?style=flat&logo=github)](https://github.com/JavierOramas/video-diet) [![Github Watchers](https://img.shields.io/github/watchers/JavierOramas/video-diet?style=flat&logo=github)](https://github.com/JavierOramas/video-diet) [![GitHub contributors](https://img.shields.io/github/contributors/JavierOramas/video-diet)](https://github.com/JavierOramas/video-diet/graphs/contributors)

This is a fork of the original video-diet that is no longer being updated.

This project aims to reduce the spaces of your videos and audios encoding it on `hevc`.

## Why video-diet?
The answer is easy. I have a lot old-movies/videos and music/audios taking a lot of space in the hard-drive.
So I'm always short on disk space, the by accident discover de `hevc` codec. when i need to shrink a video of `3GB`
to upload it to `Telegram`, the convertion take my 3GB movie and returned a 300 MB with the same quality 😱. So I
decided that I would convert all my video and audio files , but they are a lot, so I build this tool for it.

More info about `hevc`:

https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding


## Installation

<div class="termy">

```console
$ uv tool install .
```

</div>

This installs the `diet-video` command. To run it from a checkout without
installing it globally, use `uv run diet-video`.

## FFMPEG

In order to run the project you must install `ffmpeg`.

### For Linux
In any linux machine you can get it from your favorite package manager.

For arch:
```console
sudo pacman -S ffmpeg
```

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

## For Windows

Download a windows ffmpeg build here https://ffmpeg.org/download.html. Unzip it and change the folder name to `FFmpeg`. Copy the folder into `C:\` and then add the path `C:\FFmpeg\bin` to the enviroment variables of the system. 

To check correct instalation open a new instance of cmd and type:
```console
ffmpeg --version`.
```

## Example

### For a file

```bash
diet-video file test.mp4
```
This option conserve the original file

### For a folder
```bash
diet-video folder ~/Videos
```
This option replaces the original file for the converted files

Converted files are marked with the `Processed with diet-video` metadata
comment. Future `folder` runs detect that marker and skip those files, so they
are not converted again.

#### Ignoring files on the folder
```bash
diet-video folder ~/Videos --ignore-extension .mp4
```
This option ignores all the .mp4 files on ~/Videos

```bash
diet-video folder ~/Videos --ignore-path ~/Videos/subfolder
```
This option ignores all the files on ~/Videos/subfolder

To deliberately process an already marked file with the `file` command, pass
`--force`.

## AV1 Support

To use AV1 instead of hevc add --codec av1 to the commnads above and that will use libaom-av1 instad of libx265 to encode the files 

## Note

The video conversion can take some time. Depending on the original video properties; the conversion time can be longer than the video.

## For developers

### Requirements

Install [uv](https://docs.astral.sh/uv/getting-started/installation/), then run:

```console
$ uv sync
```

The project requires Python 3.13 or newer. `uv` will download a compatible
Python version automatically when one is not already available.

Run the command with `uv run diet-video` and the test suite with
`uv run pytest`.

See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.

Good luck 😉.

Project Structure based on awesome tutorial by @tiangolo at https://typer.tiangolo.com/tutorial/package
