Skip to main content

Media encoding made simple

Project description

Mediaify

Media encoding made simple.

Simple

import mediaify

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

mediaify.batch_encode_animation(data)
>>> [
  ImageFile(128x128, image/webp, 6.2KiB),
  ImageFile(500x500, image/webp, 55.1KiB),
  AnimationFile(500x500, 0.6s, 0.05fps, image/webp, 23.4KiB),
  AnimationFile(500x500, 0.6s, 0.05fps, image/gif, 1.0MiB)
]

Output

1 2 3 4 5

Highly Customisable

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)
]

Output:

1 2 3 4

Multimeader Support

import mediaify

with open("./heavy.mp4") as f:
  data = f.read()

with open("./fractal.mp4") as f:
  data = f.read()

mediaify.load_media(data)
>>>

Installation

https://pypi.org/project/mediaify/

python -m pip install mediaify

Dependencies

  • ffmpeg
  • libmagic
    • Windows: N/A, installed automatically
    • Debian/Ubuntu: sudo apt-get install libmagic1
    • Homebrew: brew install libmagic
    • macports: port install file

Documentation

Unfinished.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mediaify-1.2.0.tar.gz (9.8 kB view hashes)

Uploaded Source

Built Distribution

mediaify-1.2.0-py3-none-any.whl (15.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page