My C program generates raw frames, using either a pixel matrix or a linear pixel vector (I prefer the matrix for efficiency); but I also want to generate a video by merging