Improper image header error with raw pixel data
Posted: 2016-10-20T16:45:57-07:00
I'm using Magick++ to compress frames from a video file in order to reduce the overall size. The frames are extracted with FFMPEG and are raw pixel RGB data (8-bits). For the first 300 or so frames, the code runs with no problem, but it gets to a point where I'm getting a ErrorCorruptImage exception thrown.
terminate called after throwing an instance of 'Magick::ErrorCorruptImage'
what(): main: improper image header `' @ error/sct.c/ReadSCTImage/189
I don't know why it's trying to read a SCT image. There should be no image header with raw RGB data. Any insight is appreciated. The code snippet is shown below. The error is triggered on the last line. Essentailly, the raw frame data is stored in buffer and i'm making a blob from the already buffered data.
Thanks
terminate called after throwing an instance of 'Magick::ErrorCorruptImage'
what(): main: improper image header `' @ error/sct.c/ReadSCTImage/189
I don't know why it's trying to read a SCT image. There should be no image header with raw RGB data. Any insight is appreciated. The code snippet is shown below. The error is triggered on the last line. Essentailly, the raw frame data is stored in buffer and i'm making a blob from the already buffered data.
Code: Select all
Magick::Blob blob;
blob.updateNoCopy(buffer, 640*480*3);
Magick::Image image;
image.depth(8);
image.size("640x480");
image.magick("RGB");
image.read(blob);