Jan 9, 2018 at 10:00am UTC
I developed code below to convert jpeg to avi, but it does not work.
Could you help me?
hr = AVIFileOpen(&pFile, file_name, OF_WRITE | OF_CREATE, 0);
strhdr.fccType = streamtypeVIDEO;
strhdr.fccHandler = 0;
strhdr.dwScale = 10;
strhdr.dwRate = 1000;
strhdr.dwSuggestedBufferSize = cbImage;
SetRect(&strhdr.rcFrame, 0, 0, newX, newY);
hr = AVIFileCreateStream(pFile, &ps, &strhdr);
hr = AVIMakeCompressedStream( &psCompressed, ps, &opts, 0);
bitmapheader.biWidth = newX ;
bitmapheader.biHeight = newY;
bitmapheader.biPlanes = 1;
bitmapheader.biBitCount = 24;
bitmapheader.biSizeImage = cbImage;
bitmapheader.biSize = bfSize;
hr = AVIStreamSetFormat(psCompressed, 0, &bitmapheader, headersize);
hr = AVIStreamWrite( psCompressed, 0, 1, ptImg, cbImage, AVIIF_KEYFRAME, 0, 0);
hr = AVIStreamRelease(psCompressed);
hr = AVIStreamRelease(ps);
hr = AVIFileRelease(pFile);
Jan 9, 2018 at 11:17am UTC
You want to create an AVI file consisting of a single frame, and the source image of that frame is a JPEG file? Is that right?
Jan 9, 2018 at 3:02pm UTC
I think you just decompose the jpg back to logically a "2-d" image of pixels (these are usually just a unsigned char * in code) in insert that as a frame (X however long you want to show it, may require inserting same frame many times).
Last edited on
Jan 9, 2018 at 3:03pm UTC