y4m-d 1.0.1

File loader/emitter for Y4M, a convenient uncompressed video format.

To use this package, put the following dependency into your project's dependencies section:


What's this?

y4m-d is a tiny library to load/save Y4M video files. Y4M files are the simplest uncompressed video files that also contain meta-data (width, height, chroma subsampling, etc...) which makes a better solution than .yuv files.

High bit-depth are supported with any depth from 8 to 16 bits/sample. However y4m-d does not handle endianness or shifted bits in samples. Frames are read/written as is.

libavformat uses native endian for both reading and writing and align significant bits to the left. This means the Y4M format depends on the producer machine. So until probing is implemented it's up to you to take care of this.




import y4md;

void main(string[] args)
    auto input = new Y4MReader("input-file.y4m");

    writefln("Input: %s %sx%s %sfps %s bits/sample", inputFile, input.width, input.height,
             cast(double)(input.framerate.num) / (input.framerate.denom),

    ubyte[] frameBytes;
    while ( (frameBytes = input.readFrame()) !is null)
        // Do something with frame data in frameBytes[]

    // Output a 1920x1080p25 8-bit stream in stdout
    auto output = new Y4MWriter(stdout, 1920, 1080, Rational(25, 1), 8); 
    frameBytes = new ubyte[output.frameSize()];
    for (int i = 0; i < 100; ++i)
        // write something in frameData...


Authors:Guillaume Piolat / p0nce

Dependencies: none

1.0.1 2016-Jun-01
1.0.0 2016-May-31
0.3.0 2014-Aug-17
0.2.1 2014-Apr-27
0.2.0 2014-Apr-27
Show all 7 versions

statistics are temporarily disabled.