Community
cancel
Showing results for 
Search instead for 
Did you mean: 
franknatoli
New Contributor I
89 Views

MPEG4VideoEncoder vs H264VideoEncoder

What is the difference between MPEG4VideoEncoder and H264VideoEncoder?

I need to write a fragmented MPEG-4 file with H.264 encoded data. I am constructing my own MPEG-4 boxes that precede the fragmented MOOF and MDAT box pairs. I am filling the MDAT with output of the H264VideoEncoder. But on readback, with H264VideoDecoder, there is a complaint that profile_idc is zero and the stream is declared invalid.

Should I be using MPEG4VideoEncoder?

0 Kudos
3 Replies
Ying_H_Intel
Employee
89 Views

Hi franknotoli,

Have you own yourselfsplitter to extract the H.264 encoded data from the mp4 box?
A small IPP splitter sample at http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample...

In general, if your original encoded data is H.264, then H264VideoDecoder should be used. If your original encoded is mpeg4 format, then MPEG4VideoDecoderis used.The decoders and encoders are used in pairs with same format.

In addition, As I known "Fragmented MPEG4"is not supported by current IPP umc sample.The H264VideoDecoder only accept elementary stream.Soprior to feed the stream to IPP decoder, youmay also need to add some functionality to deframented the streamwhich is extractedfromthe "Fragmened MPEG4" file.

Best Regards,
Ying
franknatoli
New Contributor I
89 Views

I have written my own splitter, but that was necessary to solve a different problem. UMC standard splitter does indeed support fragmented MPEG-4 files [with H.264 encoded data] but hangs when SetTimePosition is called. As long as you read sequentially, there is no problem. The splitter I wrote works correctly on fragmented files both sequentially and after reposition via SetTimePosition.

I have done additional research since my original post. H264VideoEncoder sometimes applies a 00-00-01 prefix to the encoded stream that it creates, and sometimes does not. This appears to be affected by the presence or absence of m_pDecSpecInfo in VideoEncoderParams when calling H264VideoEncoder::Init.

But H264VideoDecoder does NOT like 00-00-01 prefix. It thinks it's decoding the rest of the stream, and is confused by the 00-00-01 prefix.

Could you or someone at Intel please comment on what Init parameters on the H264VideoEncoder side result in a stream that H264VideoDecoder is willing to work with? In particular, what M_pDecSpecInfo data should or should not be provided?

Thanks.
Ying_H_Intel
Employee
89 Views

Hello Franknatoli,

We dicussed your issue with the UMC developers. They give the below comments:

There are two possible mode of using H.264 decoder: decoding of pure video stream and "H.264 at mp4 container".

First one expects present of NAL unit start code (00 00 01). H.264 at MP4 mode doesn't use NAL unit start codes. You can choose mode by special initialization option (init->info.stream_subtype == AVC1_VIDEO means "H.264 at MP4 container" mode. init->info.stream_subtype != AVC1_VIDEO is pure video mode).


Regarding the SetTimePosition(), is it the same thread in http://software.intel.com/en-us/forums/showthread.php?t=71175? seems the fix code isavaiable and will berelease in IPP70. (the latest one IPP 6.1.4)

Best Regards,
Ying


Reply