GithubHelp home page GithubHelp logo

notpushkin / glitzz Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 1.0 4 KB

A video generator in Python. Don't ask me why.

License: ISC License

Python 100.00%
video-processing video-editor pillow pil ffmpeg

glitzz's Introduction

Glitzz

A video generator in Python. Don't ask me why.

from PIL import ImageDraw
from glitzz import Glitzz


app = Glitzz(initial_color="#27365d")


@app.frame
def draw_frame(canvas, position, duration):
    """
    `canvas` is a PIL image. It's your canvas, draw on it
    `position` is current frame's time in seconds
    `duration` is length of the clip
    """
    draw = ImageDraw.Draw(canvas)
    draw.line((0, 0) + frame.size, fill="white")
    draw.line((0, frame.size[1], frame.size[0], 0), fill="white")
    return canvas

if __name__ == "__main__":
    print("Serving at port 8000. Run: ")
    print("    %s" % app.get_ffmpeg_command())
    app.run()

This creates a 10-second video with frames like this:

This is art

Let's run it:

$ python yourapp.py  # `python -m glitzz` to just run the default demo
Serving at port 8000. Run:
    ffmpeg -framerate 25 -f image2 -i http://localhost:8000/%d.bmp -vframes 250 filename.mp4
$ ffmpeg ...
Copyright (c) 2000-2017 the FFmpeg developers
Input #0, image2, from 'http://localhost:8000/%d.bmp'
Output #0, mp4, to 'filename.mp4'
Stream mapping:
  Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))
Press [q] to stop, [?] for help
...

glitzz's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

suuuuumod

glitzz's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.