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

Using MPEG-4 Decoder

sdhays
Beginner
4,747 Views
I'm trying to build my own application based on the UMC framework from the IPP Media Samples, v5.0.017. I can play AVI and MP4 files using simple_player, and MJPEG AVIs play fine with the UMC example (from the UMC manual). But when I change the UMC example to use MPEG4VideoDecoder instead of MJPEGVideoDecoder, the program runs, seeming to process every frame, however not one frame is decoded for rendering. I'm not surprised that the MPEG4 decoder needs to be treated differently from the MJPEG decoder, but after searching for the last 3 days through simple_player.cpp, avsync.cpp, codec_pipeline.cpp, and umc_mpeg4_video_decoder.cpp, I'm still at a loss as to what I should do to get the MPEG4 decoder to work.

Any suggestions would be greatly appreciated!
Scott


P.S. As further note for when Intel updates the documentation: FIOReader is not built by default on Linux for IA32. The UMC example depends on FIOReader and thus cannot be built without modification. Changing FIOReader to FileReader works, but I don't know what difference (if any) this makes.

Message Edited by sdhays@neon.com.tw on 01-19-2006 06:35 PM

0 Kudos
43 Replies
rhy
Beginner
2,418 Views
Hi Scott,



I am currently trying to decode the mpeg4 byte stream that comes directly from the GetFrame() method of the ipp mpeg-4 encoder, so we might look for the same thing.
Currently I am on the verge of dissecting codec_pipeline to find out how to feed the decoder correctly so it produces complete images.

However, when I feed the MPEG-4 decoder with what I get from the encoder, the decoder just produces some bytes of unusable data.



I guess what plays into it, is the way data comes in to the decoder. I am currently thinking this way:
* The MPEG-4 Stream does not consist of complete images side-by-side like the MJPEG stream does.

* This means that the MPEG-4 decoder needs some 'brain' containing the last image to produce the next image with the new bits of information coming in.

* Either this 'brain' is in the decoder itself, or it must be in the pipeline.


One thing I will try now for testing is to feed only I-Frames to the decoder, practically emulating MJPEG with that.


Rhy

Message Edited by Rhy on 01-20-2006 01:49 AM

0 Kudos
Vladimir_Dudnik
Employee
2,418 Views

Hi Scott,

well, seems we have documentation issue here, it need to be addressed to the next release.

Thanks,
Vladimir

0 Kudos
sdhays
Beginner
2,418 Views
Hi, Rhy. Did you ever get the MPEG-4 decoder to work separate from CodecPipeline?

Scott
0 Kudos
Vladimir_Dudnik
Employee
2,418 Views

Hi Scott,

as a variant, I can suggest you to take a look on umc-manual.pdf file, chapter 3, Base Classess, Example of UMC Base Classes Usage. There is a simple example of Motion JPEG decoder from AVI to YUV file. It should not be too difficult to replace MJPEG related staff with MPEG4 staff. Just formal approach should work, replace included header files and change object names and you should get very simple MPEG4 decoder.

Regards,
Vladimir

0 Kudos
sdhays
Beginner
2,418 Views
That's exactly what I did, but it didn't work which is why I posted in the first place. It's my understanding that Rhy was having trouble getting it to work as well. So, I'm wondering what other steps are necessary for the MPEG4 decoder.

Scott
0 Kudos
Vladimir_Dudnik
Employee
2,418 Views

Hi Scott,

Sorry, I forget to mention, in case of MPEG4 you need to replace YUY2 to YV12 in decoder initialization. Wetested this and it is work. Let me know if I need to upload modified sample here

Regards,
Vladimir

0 Kudos
sdhays
Beginner
2,418 Views
Thanks, Vladimir. I tried your suggestion, changing VDecPrams.cformat to UMC::YV12. This still just gives me an empty output file. Could you please attach your working example so that I can see what I'm doing wrong?

Thanks again for your help!
Scott
0 Kudos
Vladimir_Dudnik
Employee
2,418 Views

Scott,

you changed code on

page 3-99, line 18

VDecParams.cformat = UMC::

YUY2; -> VDecParams.cformat = UMC::YV12;

and this does not work for MPEG4VideoDecoder?
Ok, I'll attach sample in day or two.
Regards,
Vladimir
0 Kudos
Vladimir_Dudnik
Employee
2,418 Views
Please find modified umc_doc_example in attached archive. In this sample all references to MJPEG were changed to MPEG4 and initialization was corrected for MPEG4 decoder. Please try and we will be glad to get any feedback from you regarding UMC media sample and MPEG4 decoder
Regards,
Vladimir

Message Edited by vdudnik on 02-10-2006 11:07 AM

0 Kudos
sdhays
Beginner
2,418 Views

Thank you for posting your sample, but unfortunately it produces the same results as my own update to the UMC example. It seems to decode, but it simply doesn't save anything to output.yuv. I've compiled this on Windows and Linux (on Linux, I changed FIOReader calls to FileReader calls). The results were the same. I used AVI files with MPEG4 data from different encoders, including one generated by video_enc_con. All of the AVI files I tested work with simple_player but not with the sample program. Very strange.

I did have to make some changes to the Visual Studio project in order to get this sample to build. But that shouldn't make a difference since I just added include lines to the compiler command and library paths to the linker command. I didn't touch the source code except for when I tried it on Linux (as mentioned above).

If you have any other suggestions, please let me know. Thanks again for helping me out with this!

Scott

Message Edited by sdhays@neon.com.tw on 02-15-2006 04:32 PM

0 Kudos
jordimitja
Beginner
2,418 Views
I tested also the umc_doc_examples.zip in Windows XP but my problem is that this sample crash in the first GetNextVideoData():

// decoding & rendering loop (frame by frame)
while(umcRes == UMC::UMC_OK || umcRes == UMC::UMC_NOT_ENOUGH_DATA)
{
umcRes = avi_spl.GetNextVideoData(&in); -> crash !!!
if (umcRes != UMC::UMC_OK)
break;

The error returned in release version is:
runtime error R6016
- not enough space for thread data

I tried to decode an avi generated with XVID or DIVX codec and I dont known if this is the problem, Can I decode videos encoded with these codecs with the IPP MPEG-4 decoder?

Could you help me, please ?

Thanks you very much in advance !!

PS: I attach you the video that Im using in my tests

Jordi.
0 Kudos
jordimitja
Beginner
2,418 Views

I solved the problem, Im using visual c++ 6 and I see that I forgot in the project setting ->code generation-> use runtime library, select multithreaded DLL insteadof single threaded.

Im sorry if I spent your time.

0 Kudos
sdhays
Beginner
2,418 Views
So when you decode the file you posted, you get a file "output.yuv" that has your decoded video? No matter what file I try this with (including the one you posted), decoding SEEMS to work, but I always just end up with an empty (size 0) output.yuv.

Scott
0 Kudos
jordimitja
Beginner
2,418 Views
I obtain the same result that you say in your mail a output.yuv file with size 0. I tried to get the output data with out.GetDataPointer() but I see that this pointer is NULL. With the sample player it works correctly but not with all the MPEG-4 avi files that I tested, I have any problems getting the avi information from some avi files. When I run the sample player shows:

Stream Type : AVI
Video Info :
-Video Type : UNDEF
-Resolution : 0x0
-Frame Rate : 0.00
Audio Info :
-Audio Type : UNDEF
-S.Frequency : 0
-Num.Channel : 0
-BitPerSample: 0

Could you test it please and tell me what is it wrong in this file? Is the avifile header wrong ?

I attached a bad avifile.
0 Kudos
sdhays
Beginner
2,418 Views
I'm sorry that it's not working for you, but I'm glad to hear that I'm not the only one having trouble getting this sample to work. ;-) I tried your AVI. I get the same result, but remuxing it with ffmpeg let it play okay, albeit a bit fast. So the problem, whatever it is, is in you AVI header.

Scott
0 Kudos
jordimitja
Beginner
2,418 Views
Ok, Thank you very much for your test. I see also that If I reencode this avi using the Virtualdub the generated avi works perfectly. The problem its that I have a lot of avis (I generated this avis using the project avifile lib from sourceforge) and I tested these avis with a lot of players and I never had any problems. I would like to known what is it wrong in the header? You can test this avi with any video player and it works perfectly.

Jordi.
0 Kudos
walkdeath
Beginner
2,418 Views
I've the same problem. Is there something wrong with ipp5.0?
0 Kudos
walkdeath
Beginner
2,418 Views
But strangly, the simpleplayer can play mpeg4-encoded avi file well... I don't know why...
0 Kudos
sdhays
Beginner
2,418 Views
Vladimir, can you confirm that this sample works for you on MPEG4 AVI's? None of us seem to be able to get it to work. From my debugging, it seems that it's the MPEG4 decoder that's not producing anything, not any other part of the tool chain, but I still don't see why. This is much more strange if it works for you but not for us.

Thanks,
Scott
0 Kudos
Vladimir_Dudnik
Employee
2,285 Views
Hi Scott,
I'm sorry, was busy last days, I watched discussion but had no time to answer. Yes, certainly, we tested this sample on several AVI files with MPEG4 content. The issue can be related with limitations in AVI splitter, it will be improved in new version, IPP v5.1, which is coming soon. Could you please attach some AVI file which you can't decode with the sample? So, we can test and probably find workaround before next release.
Regards,
Vladimir
0 Kudos
Reply