MP4 Library

Guillaume Piolat guillaume.piolat at gmail.com
Thu Sep 12 00:44:17 UTC 2024


On Wednesday, 11 September 2024 at 16:23:16 UTC, Andrea Fontana 
wrote:
>
> ```
> import std;
>
> void main()
> {
>
>    // A mp4 1fps (-r 1) with standard settings
>    auto pp = pipeShell("ffmpeg -y -r 1 -f png_pipe -c:v png -i 
> - -c:v libx264 -crf 24 test.mp4", Redirect.all);
>
>    // Feed frames from stdin
>    pp.stdin.rawWrite(std.file.read("/path/to/your/frame1.png"));
>    pp.stdin.rawWrite(std.file.read("/path/to/your/frame2.png"));
>    pp.stdin.rawWrite(std.file.read("/path/to/your/frame3.png"));
>
>    // Flush & close stdin
>    pp.stdin.flush();
>    pp.stdin.close();
>
>    // Wait for ffmpeg to finish the job
>    pp.pid.wait();
> }
> ```
>
> Andrea

If you want to create a .y4m file without ffmpeg, here is old 
code (probably doesn't really build anymore):
- https://github.com/p0nce/y4m-d let's you create a .y4m
- https://github.com/p0nce/y4m-tools for manipulating such files
- in particular, creating a YUV frame necessitate conversion from 
sRGB such as in 
https://github.com/p0nce/y4m-tools/blob/master/shader-capture/source/app.d#L359


More information about the Digitalmars-d mailing list