Community
cancel
Showing results for 
Search instead for 
Did you mean: 
pushkar_p
Beginner
67 Views

Trouble decoding streaming MPEG4

I'm using the UMC MPEG4 decoder code from simple player application to decode streaming MPEG4. I receive the frame in a buffer on the network and pass this to the decoder and also a output buffer where I want to receive the decoded frame.

Earlier I was using IPP 3.0 sample code but now trying to upgrade the decoder to 5.3.

But the decoder's GetFrame(...) method fails with UMC_ERR_NOT_ENOUGH_DATA.

Am I missing some steps here?

I init the decoder as follows:

UMC::MPEG4VideoDecoder m_Decoder;
UMC::MediaData m_FrameIn;
UMC::VideoData m_FrameOut;

UMC::VideoStreamInfo VideoInfo;
VideoInfo.stream_type = UMC::MPEG4_VIDEO;

UMC::Status umcRes = UMC::UMC_OK;
UMC::VideoDecoderParams VDecParams;

VDecParams.info.stream_type = VideoInfo.stream_type;
VDecParams.info = VideoInfo;
VDecParams.lFlags = 0;//FLAG_VDEC_CONVERT | FLAG_VDEC_REORDER;
VDecParams.numThreads = 1;//numThreads;
VDecParams.pPostProcessing = NULL;//&rColorConverter;

umcRes = m_Decoder.Init(&VDecParams);

Then in a loop I decode as follows:

m_FrameIn.SetBufferPointer(
a_arrInputBuffer.getUnsafeArrayPtr(),
a_arrInputBuffer.getLength() );

m_FrameIn.SetDataSize(a_arrInputBuffer.getLength());

m_FrameOut.Init(352, 240, UMC::YUV420);

m_FrameOut.SetBufferPointer(
a_arrOutputBuffer.getUnsafeArrayPtr(),
a_arrOutputBuffer.getLength() );

m_FrameOut.SetDataSize(a_arrOutputBuffer.getLength());

m_Decoder.GetFrame(&m_FrameIn, &m_FrameOut);

For clarity I have deleted the error checking code from the post but I do check error codes for each function call. The a_arrInputBuffer is the frame I collect on the network.

Funny thing is sometimes the code works (i.e. decoding successful) and sometimes it doesn't.

TIA.

0 Kudos
2 Replies
pushkar_p
Beginner
67 Views

Hi Nikolay,

I don't think I will be able to send you the MP4 file because it is actually streaming data over the net.

I was able to port my application to VS 2008 and now I can step into the UMC samples source code. By stepping I was able to find that GetFrame() actually fails because the internal call to InsideInit() fails.

In the for(;;) loop in MPEG4VideoDecoder::InsideInit()it can find the start/code ptr

mp4_SeekStartCodeOrShortPtr(...)

but it doesn't match any of the video object or visual object codes it expects. Thus MPEG4VideoDecoder::InsideInit() fails with UMC_ERR_SYNC return code.

Interestingly this clip used to be decoded by the MP4 decoder available in IPP 3.0. I've read that some simple profiles in MP4 are ~ H.263. Could it be that this is actually a H.263 and since now IPP has a separate H.263 decoder, the MP4 decoder fails to decode them?

pushkar_p
Beginner
67 Views

Hello Nikolay,

It seems the 0x00 0x00 0x80 is not coming for each frame. I looked at our old code again and found that this header sequencecomes in the config string (got from the sdp file I guess). When I passed this config data to the MP4 decoder init method it worked.

One last question should this header come in each frame?

Reply