Giter VIP home page Giter VIP logo

vidio's Introduction

vidio video format

its video, but simple

why

its basically like ppm but video, the format is literally raw bytes, nothing else:

(2 bytes)   unsigned char magic[2]         (should usually be 'vi', but its ignored)
(4 bytes)   unsigned fps                   (frames per second)
(4 bytes)   unsigned width                 (width of the canvas)
(4 bytes)   unsigned height                (height of the canvas)
(whn bytes) unsigned char frames[n][w][h]  (all of your framas)
 ^^^ w = width; h = height; n = frames_count
     all data in this array is a continuous  arrat of rgb values:
     e.g. {
             255, 255, 255,
             0,   0,   0,
             255, 0,   0,
          }

and its very easily convertable to other simple media formats, for example PPM P6 format, renderer/converter comes already implemented and the default lib is fully compatible with C89, also, this format is very extensible, at first i thought i might add support for alpha values but then thought theyre quite useless in this case, if you will just add alpha field to the VidioPixel struct:

typedef struct {
    unsigned char red, green, blue, alpha;
} VidioPixel;

thats all you need to add support for alpha, just make sure to also have alpha in your data array when generating:

{
    255, 255, 255, a,
    0,   0,   0,   a,
    255, 0,   0,   a,
}

or, well, in the pyhton test script:

bytearray((255, 255, 255, a) * 100 * 100 * 60)  # 60 100x100 frames

but if youll use vidio_render_frame_to_ppm, you should adapt it to use your new format

why not ?

its not a widely supported, established format of video, i only added fps option for future when ill actually be implementing viewing video on some viewer, maybe mpv ? well see :)

still wanna see what you generated ?

run this

$ mpv "mf://frames/*.ppm" -mf-fps <fps>

this will show you your whole video

lib

see include for the source code of the library :)

example usage

example usage can be found in the src folder, you can generate your own blank, fully white vidio file using the test.py script, it will generate a test.vi file which you can then pass to vidio.elf after compiling with ./build.sh :

$ python3 scripts/test.py

$ rm -rf frames && ./build.sh -r test.vi

$ mpv frames/

make sure frames directory is never present, im too lazy to add checking for it in the example

the example python script also implements another view on the format, if you want something to reference very quickly, take a look at the test script :)

vidio's People

Stargazers

 avatar

Watchers

 avatar

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.