Metadata-Version: 2.1
Name: mediaify
Version: 1.2.2
Summary: Media encoding made simple
Author-email: Ben Brady <benbradybusiness@gmail.com>
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Multimedia
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
Classifier: Topic :: Multimedia :: Video
Classifier: Topic :: Multimedia :: Video :: Conversion
Classifier: Typing :: Typed
Requires-Dist: ffmpeg-python~=0.2.0
Requires-Dist: pillow~=9.5.0
Requires-Dist: python_magic~=0.4.27
Requires-Dist: python-magic-bin; sys_platform == 'win32'
Requires-Dist: numexpr
Requires-Dist: mypy ==0.982 ; extra == "test"
Requires-Dist: pytest >=7.1.3,<8.0.0 ; extra == "test"
Project-URL: Source, https://github.com/Ben-Brady/mediaify
Provides-Extra: test

# Mediaify

Media encoding made simple. Encode media without the hassle by describing the output declaratively!

## [Simple](./examples/simple.py)

```python
import mediaify

with open('ricardo.gif', 'rb') as f:
    data = f.read()

mediaify.batch_encode_animation(data)
>>> [
  ImageFile(51x64, image/webp, 402.0B),
  ImageFile(102x128, image/webp, 808.0B),
  ImageFile(205x256, image/webp, 2.5KiB),
  ImageFile(241x300, image/webp, 3.3KiB),
  AnimationFile(241x300, 6.4s 128 frames, 20.00fps, image/gif, 390.9KiB)
]
```

| 1 | 2 | 3 | 4 | 5 |
| - | - | - | - | - |
| ![](https://raw.githubusercontent.com/Ben-Brady/mediaify/master/examples/output/fractal-0.webp) | ![](https://raw.githubusercontent.com/Ben-Brady/mediaify/master/examples/output/fractal-1.webp) | ![](https://raw.githubusercontent.com/Ben-Brady/mediaify/master/examples/output/fractal-2.webp) | ![](https://raw.githubusercontent.com/Ben-Brady/mediaify/master/examples/output/fractal-3.webp) | ![](https://raw.githubusercontent.com/Ben-Brady/mediaify/master/examples/output/fractal-4.gif) |


## [Highly Customisable](./examples/customisable.py)

```python
import mediaify
from mediaify.configs import (
    WEBPImageEncodeConfig,
    ImageConfig,
    UnencodedConfig,
)

encoding_config = [
    WEBPImageEncodeConfig(
        height=64,
        width=64,
        quality=50
    ),
    WEBPImageEncodeConfig(
        height=256,
        width=256,
        quality=70
    ),
    WEBPImageEncodeConfig(
        height=512,
        width=512,
        quality=80
    ),
    UnencodedConfig()
]


with open('./landscape.webp', 'rb') as f:
    data = f.read()


mediaify.batch_encode_image(data, encoding_config)
>>> [
  ImageFile(64x33, image/webp, 802.0B),
  ImageFile(256x134, image/webp, 9.9KiB),
  ImageFile(512x268, image/webp, 39.0KiB),
  ImageFile(1600x840, image/webp, 277.6KiB)
]
```

| 1 | 2 | 3 | 4 |
| - | - | - | - |
| ![](https://raw.githubusercontent.com/Ben-Brady/mediaify/master/examples/output/landscape-0.webp) | ![](https://raw.githubusercontent.com/Ben-Brady/mediaify/master/examples/output/landscape-1.webp) | ![](https://raw.githubusercontent.com/Ben-Brady/mediaify/master/examples/output/landscape-2.webp) | ![](https://raw.githubusercontent.com/Ben-Brady/mediaify/master/examples/output/landscape-3.webp) |

## [Multimedia Support](./examples/customisable.py)

```python
import mediaify

mediaify.encode_file("./heavy.mp4")
>>> VideoFile(1280x720, 13.834s, 24fps, audio, video/mp4, 3.2MiB)

mediaify.encode_file("./ricardo.gif")
>>> AnimationFile(241x300, 6.4s 128 frames, 20.00fps, image/gif, 390.9KiB)

mediaify.encode_file("./landscape.webp")
>>> ImageFile(1600x840, image/webp, 277.6KiB)
```

# Installation

[https://pypi.org/project/mediaify/](https://pypi.org/project/mediaify/)

```bash
python -m pip install mediaify
```

## Dependencies

- ffmpeg
  - Ensure ffmpeg is on PATH, try running `ffmpeg` to check
  - Debain/Ubuntu: `sudo apt-get install ffmpeg`
  - Other: [https://ffmpeg.org/download.html](https://ffmpeg.org/download.html)
- libmagic
  - Windows: N/A, installed automatically
  - Debian/Ubuntu: `sudo apt-get install libmagic1`
  - Homebrew: `brew install libmagic`
  - macports: `port install file`

# Documentation

Unfinished.

