Search code examples
node.jsffmpegbinarybufferarraybuffer

Buffer type video width and height nodejs


I have a buffer array which is a video. I'm trying to figure out a way with which I can extract its width and height. I've tried a couple of packages but they are not working. If somebody can help me out I would be super grateful.

This is a snapshot of the buffer array that I have

<Buffer 00 00 00 20 66 74 79 70 6d 70 34 32 00 00 02 00 69 73 6f 6d 69 73 6f 32 61 76 63 31 6d 70 34 31 00 00 00 08 66 72 65 65 00 02 9b 36 6d 64 61 74 00 00 ... 177458 more bytes>

Solution

  • Solved

    I was not able to figure out a way to get width and height from the buffer. What I did was I saved the buffer temporarily and then used get-video-dimension packages to extract the width and height. Please keep in mind when saving the video, you need to append the extension when creating the file and then save buffer in it.