Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

h263enc.Init returns UMC_FAILED_TO_INITIALIZE

runew
Beginner
486 Views

I've made an video encoder application based on the IPP sample "umc_video_enc_con", but when trying to use the h263 encoder I get an initialization failure in the following method:

H263VideoEncoder::Init(BaseCodecParams* init)

The following call:

int h263status = h263enc.Init(h263Params);

returns UMC_FAILED_TO_INITIALIZE

I'm not sure how to proceed from here. When do one get this error?I guess some of the parameters are invalid, but how can I determine which?

-Rune

0 Kudos
8 Replies
runew
Beginner
486 Views

Hi and thanks for the reply!

Here's the members (hope I've got the most of them):

H263VideoEncoder::Init
Width = 768
Height = 576
NumOfFrames = 45
TimeResolution = 30000
TimeIncrement = 1001
quantIVOP, quantPVOP, quantBVOP = 0
IVOPdist, PVOPdist = 1
PVOPsearchWidth, PVOPsearchHeight = 15
MEalgorithm = 1
MEaccuracy = 2
advPred = 0
deblockFilt = 0
calcPSNR = 0
advIntra = 0
UMV = 0
*bsBuffer = 1
bsBuffSize = 1
RateControl = 1
BitRate = 4500
SceneChangeThreshold = 50

-Rune

0 Kudos
runew
Beginner
486 Views

Ok, I'll set the size accordingly. I messed up a little when I dumped the data members the last time. Here's the correct list:

H263VideoEncoder::Init

Width = 768
Height = 576
NumOfFrames = 41
TimeResolution = 30000
TimeIncrement = 1001
quantIVOP = 7
quantPVOP = 7
quantBVOP = 0
IVOPdist = 10
PVOPdist = 1
PVOPsearchWidth = 15
PVOPsearchHeight = 15
MEalgorithm = 1
MEaccuracy = 2
advPred = 0
deblockFilt = 0
calcPSNR = 0
advIntra = 0
UMV = 0
bsBuffer = 1
bsBuffSize = 1
RateControl = 1
BitRate = 4500
SceneChangeThreshold = 50

-R

0 Kudos
runew
Beginner
486 Views

Hi again Nikolay!

The change of size made the initialization go ok! My problem now is to create legal .avi files. You helped me before by providing me with a "simple muxer" that among other things set the FourCC right. Here's the link to your post:

http://software.intel.com/en-us/forums/showthread.php?t=52907#39823

I've just used the same with the H.263 encoder and tried setting FourCC to "H263", "M263" & "I263", but neither seem to work. Is there a(nother) trick to make this work?

Sorry, I'm pretty new to this...

-Rune

0 Kudos
runew
Beginner
486 Views

Sorry. Still no go. I've tried to play the resulting avi on my development PC (which normally plays almost anything). I'm not sure if the reason is a faulty 4CC or not. I've tried all the H263-related 4CCs I know (H263, M263 & I263). The complete code for the muxer is now as this:

int

SimpleMuxer(char *filename, char *AVIfilename, int width, int height, int fps)

{

AVISTREAMINFO strhdr;

PAVIFILE pfile;

PAVISTREAM ppavi;

int nFrames =0;

HRESULT hr;

BITMAPINFOHEADER bmpInfoHdr;

memset(&bmpInfoHdr, 0,

sizeof(bmpInfoHdr));

bmpInfoHdr.biSize =

sizeof(bmpInfoHdr);

#ifdef

USE_H263

bmpInfoHdr.biCompression = mmioFOURCC(

'H', '2', '6', '3');

#else

bmpInfoHdr.biCompression = mmioFOURCC('D', 'I', 'V', 'X');

#endif

bmpInfoHdr.biWidth = width;

bmpInfoHdr.biHeight = height;

bmpInfoHdr.biBitCount = 24;

bmpInfoHdr.biPlanes = 1;

AVIFileInit();

if (hr = AVIFileOpen(&pfile, AVIfilename, OF_WRITE | OF_CREATE, NULL) != 0)

return MUX_ERR_AVI_FOPEN;

memset(&strhdr, 0,

sizeof(strhdr));

strhdr.fccType = streamtypeVIDEO;

#ifdef

USE_H263

strhdr.fccHandler = mmioFOURCC(

'H', '2', '6', '3');

#else

strhdr.fccHandler = mmioFOURCC('D', 'I', 'V', 'X');

#endif

strhdr.dwScale = 1;

strhdr.dwRate = fps;

strhdr.dwSuggestedBufferSize = width * height;

SetRect(&strhdr.rcFrame, 0, 0, width, height);

if (hr = AVIFileCreateStream(pfile, &ppavi, &strhdr) != 0)

return MUX_ERR_AVI_CR_STRM;

if (hr = AVIStreamSetFormat(ppavi, nFrames, &bmpInfoHdr, sizeof(bmpInfoHdr)) != 0)

return MUX_ERR_AVI_SET_FRMT;

FILE *fp = fopen(filename,

"rb");

if (!fp)

return MUX_ERR_MPG4_OPEN;

int tmp1 = fseek(fp, 0, SEEK_END);

long length = ftell(fp);

int tmp2 = fseek(fp, 0, SEEK_SET);

BYTE *tmp_buf =

new BYTE[length];

int tmp3 = fread(tmp_buf, 1, length, fp);

bool first = true;

int i = 0, j = 0, frameCount = 0, frameLength;

for (;;)

{

for (; i < length; i ++)

{

#ifdef

USE_H263

// Find Picture start code

if (tmp_buf == 0x00 && tmp_buf[i+1] == 0x00 && (tmp_buf[i + 2] & 0xFC) == 0x80)

#else

// find VOP or GOV start code

if (tmp_buf == 0x00 && tmp_buf[i+1] == 0x00 && tmp_buf[i+2] == 0x01 && tmp_buf[i+3] == 0xB6 ||

tmp_buf == 0x00 && tmp_buf[i+1] == 0x00 && tmp_buf[i+2] == 0x01 && tmp_buf[i+3] == 0xB3)

#endif

{

if (first)

first =

false;

else

break;

}

}

frameLength = i - j;

if (hr = AVIStreamWrite(ppavi, frameCount, 1, (LPBYTE) (tmp_buf+j), frameLength, AVIIF_KEYFRAME, NULL, NULL) != 0)

return MUX_ERR_AVI_STRM_WRITE;

frameCount ++;

j = i;

i += 4;

if (i >= length)

break;

}

fclose(fp);

delete [] tmp_buf;

AVIStreamClose(ppavi);

if (pfile != NULL)

AVIFileRelease(pfile);

AVIFileExit();

return 0; // OK

}

---

The exported video file can be found here:

http://www.htfhome.com/2007/e4/video/H263_test.avi

-Rune

0 Kudos
runew
Beginner
486 Views

I'm about to give up now....

What I'm desperately trying to do, is to export a video to a format that can natively be read by all newer Windows versions (XP and up).

I've been through the mpeg4 encoder and now the H.263 encoder, so I guess the time has come to ask the question: Are ANY of the IPP encoders capable of this? I thought it was obvious, but I have come to learn that nothing is obvious in this (video codec) world...

-Rune

0 Kudos
Vladimir_Dudnik
Employee
486 Views

Hi Rune,

If stadard installation of Windows do not support H.264 or MPEG4 or MPEG2 format, is it IPP encoders fault? If Microsoft implementation of H.263 do not follow ISO/IEC standard is it IPP issue? You may need to write requirements in your software that some particular decoder (for example DivX in case of MPEG4)should be installed on target system in order to work with your video data.

Regards,
Vladimir

0 Kudos
runew
Beginner
486 Views

Hi Vladimir!

I'm deeply sorry if I have offended you guys, as that certainly wasn't intentional Sad smiley [:(]. You have been veryhelpful to mee (unlike for instance Microsoft).

If I'm frustrated with anything, it's Microsoft and the reduced native support of video formats/codecs in Vista. I'm just trying to figure out ANY way of exporting a reasonably well compressed video that can natively be read by XP and up. If this isn't possible with IPP, that's surely not IPP's fault! But it means that I'll have to start all over again... It's my and only my fault that I didn't write my goal with the application up front. If I had done that, I would probably have spared myself a couple of weeks work...

Thanks for all your help!

-Rune

0 Kudos
Vladimir_Dudnik
Employee
486 Views

Hi Rune,

that's ok. If you still have a power to fight with that issue you may try motion JPEG encoder, though we do not provide specific example in IPP, but it is quite easy: you need to compress every frame with JPEG encoder (IPP JPEG encoder with simple interface you can take from JPEGView sample, w_sample_jpeg package) and than to feed it to AVI muxer you have. FourCC code mjpg should work. As far as I know, motion jpeg is supported on any Windows system by default.

Regards,
Vladimir

0 Kudos
Reply