Skip to main content

Media encoding made simple

Project description

Mediaify

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

Simple

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

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)
]
1 2 3 4

Multimedia Support

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/

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mediaify-1.2.2-py3-none-any.whl (15.8 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