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

Simple_player in Ipp-samples\\audio-video-codecs\\application...

Gaiger_Chen
New Contributor I
2,142 Views
Hi

I have builded the example code of ipp-samples\\audio-video-codecs\\application\\simple_player.

I would like to use the player to play H.264 movie, (Xmen.mkv )

I typed :

simple_player.exe Xmen.mkv.

the error message said :
"Failed to initialize splitter."

then the player is stop.

by my traced, the is failed on

umcRes = rpSplitter->Init(*lpSplParams);
the umcRes is UMC_ERR_INVALID_STREAM

What should I do to play the H.264 format movie??

Is the movie format simple_player doest not support ?

By KM player, the movie information is :


General
Complete name : C:\\Documents and Settings\\gaigerchen\\My Documents\\IPP ref\\ipp-samples\\audio-video-codecs\\application\\simple_player\\Xmen.mkv
Format : Matroska
File size : 1.67 GiB
Duration : 1h 47mn
Overall bit rate : 2 223 Kbps
Encoded date : UTC 2009-08-18 02:08:20
Writing application : mkvmerge v1.7.0 ('What Do You Take Me For') built on Apr 28 2006 17:20:19
Writing library : libebml v0.7.7 + libmatroska v0.8.0
Video #1
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 1 frame
Muxing mode : Container profile=Unknown@3.1
Codec ID : V_MPEG4/ISO/AVC
Duration : 1h 47mn
Bit rate : 1 859 Kbps
Nominal bit rate : 1 900 Kbps
Width : 1 024 pixels
Height : 576 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 fps
Resolution : 8 bits
Colorimetry : 4:2:0
Scan type : Progressive
Bits/(Pixel*Frame) : 0.131
Stream size : 1.39 GiB (84%)
Writing library : x264 core 67 r1139M 1024283
Encoding settings : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=6 / psy_rd=1.0:0.0 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / chroma_qp_offset=-2 / threads=6 / nr=0 / decimate=1 / mbaff=0 / bframes=0 / keyint=250 / keyint_min=25 / scenecut=40 / rc=2pass / bitrate=1900 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
Language : English
Audio #2
ID : 2
Format : AC-3
Format/Info : Audio Coding 3
Codec ID : A_AC3
Duration : 1h 47mn
Bit rate mode : Constant
Bit rate : 320 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Surround: L R, LFE
Sampling rate : 48.0 KHz
Stream size : 246 MiB (14%)



thank you.
0 Kudos
33 Replies
Chao_Y_Intel
Moderator
569 Views

Hi,

the umc_video_enc_con creates a raw H.264 file, not the file in the .mp4 contain ( it you use .h264 as the file extension). You need to check if the decoder you use can support raw H.264 video file.

Thanks,
Chao
0 Kudos
Gaiger_Chen
New Contributor I
569 Views
Hi Chao:


How should I do, to modify the umc_video_enc_con, let the output be mp4?


I know it is a big project, could you just give me a start point ?


I would like to modify the umc_video_enc_con become a vedeo stream encoder for video conferencing,

keeps encoding the video which is from the camera, then transmission to another computer, decode by (modified) umc_h264_dec_con or Media_SDK or hardware..etc.



thank you. :)
0 Kudos
Chao_Y_Intel
Moderator
569 Views


Hi,

You can check the muxer example at this article:

http://software.intel.com/en-us/articles/getting-started-with-intel-ipp-unified-media-classes-sample/

I also attached a MP4 muxer example, which takes raw YUV data as input, encode with H.264 video and MP4 container.

Thanks,
Chao

0 Kudos
Gaiger_Chen
New Contributor I
569 Views

Hi Chao:

the article is extremely useful to me. thank you lots.

That it is what I really want.


thank you.





0 Kudos
Gaiger_Chen
New Contributor I
569 Views
Hi Chao:


I have modify your sample code for my appliecation.

may I ask, does the H264VideoEncoder just supporting input format as gray, yuv420 and yuv 422 only ?


I find the H264EncoderParams chroma_format_idc is just three:

0 monochrome (starting from High profile)
1 YUV420
2 YUV422 (starting from High422 profile).


I would like let my input is RGB24 or RGB32, then encode as h264 format.


=================================================================

#define EIGHT_BITS 8
#define NUM_OF_LOGICAL_PROCESSOR 0
#define PIXELSIZE3 3
#define PIXELSIZE4 4


int H264EncodeStream(void *pDst,int *H264Size, void *pSrc, int width, int height, int frameNumber, ColorFormat fmt, int bitrate)
{

UMC::Status status;
UMC::MediaData DataOut; UMC::VideoData DataIn;
UMC::H264EncoderParams Params;
UMC::H264VideoEncoder H264Encoder;
UMC::ColorFormat ufmt;

int frameSize;

Ipp8u *pInputData, *pVideoData;
int srcSize, dstSize;

pInputData = (Ipp8u*)pSrc;
pVideoData = (Ipp8u*)pDst;
*H264Size = dstSize = 0;

switch(fmt)
{
case GRAY:
ufmt = UMC::GRAY;
Params.chroma_format_idc = 0;
frameSize = width*height;
break;

case YUV420:
ufmt = UMC::YV12;
frameSize = width*height*3/2;
break;

case YUV422:
ufmt = UMC::YUV422;
frameSize = width*height*2;
break;

case YUV444:
ufmt = UMC::YUV444;
frameSize = width*height*PIXELSIZE3;
break;

case RGB24:
ufmt = UMC::RGB24;
frameSize = width*height*PIXELSIZE3;
break;

case RGB32:
ufmt = UMC::RGB32;
frameSize = width*height*PIXELSIZE4;
break;

default:
return -2;
}/*switch fmt*/

Params.profile_idc = UMC::H264_MAIN_PROFILE;
Params.key_frame_controls.method= UMC::H264_KFCM_INTERVAL;
Params.info.clip_info.width = width;
Params.info.clip_info.height = height;
Params.info.bitrate = bitrate;
Params.numThreads = NUM_OF_LOGICAL_PROCESSOR;

if((status = H264Encoder.Init(&Params))!=UMC::UMC_OK)
return -1;


DataIn.Init(width, height, ufmt, EIGHT_BITS);
DataIn.SetBufferPointer( pInputData, frameSize);
DataIn.SetDataSize(frameSize);

DataOut.SetBufferPointer(pVideoData, frameSize*frameNumber);

int nEncodedFrames = 0 ;
while ( nEncodedFrames < frameNumber)
{
status = H264Encoder.GetFrame(&DataIn, &DataOut);
if (status == UMC::UMC_OK)
{
nEncodedFrames++;

dstSize+=DataOut.GetDataSize();
DataOut.MoveDataPointer(DataOut.GetDataSize());

pVideoData+= frameSize;
DataIn.SetBufferPointer(pVideoData, frameSize);
DataIn.SetDataSize(frameSize);
}
}/*while nEncodedFrames < frameNumber*/
*H264Size = dstSize;

return 0;
}/*H264EncodeStream*/

=====================================================================



If I set the pSrc is RGB pixel array data, output is wrong.

How should I do to modify my code....? I would like not use IPP to comversion my input data as YUV420..

it need additional costing....

is UMC native supports RGB24/RGB32 as H264 encoder input ?


thank you.
0 Kudos
Vladimir_Dudnik
Employee
569 Views
Hello,

UMC video encoder sample does not support color conversion and downsampling steps as a part of processing loop. That mean you need to implement that conversion at your application before you call UMC encoder.

Regards,
Vladimir
0 Kudos
Chao_Y_Intel
Moderator
569 Views


For RGB format, the following two IPP functions can help to convert into YUV space first,

ippiBGRToYCrCb420_8u_C3P3R();
or

ippiRGBToYCbCr420_8u_C3P3R()

Thanks,
Chao

0 Kudos
Gaiger_Chen
New Contributor I
569 Views
Hi

thankyou two, that is same as I guess, H264 encoder do not support RGB as input data directly.
0 Kudos
Gaiger_Chen
New Contributor I
569 Views
HI

I have I integral your exmaple as a library, that is :

DECODE_EXPORTS_API int H264Decode_Init(int BuffSize = 5*MEGABYTE);

DECODE_EXPORTS_API int H264DecodeStream(int Decoder, void *pDst, int *width, int *height, int *frameNumber,
void *pSrc, int videoDataSize, ColorFormat fmt = RGB24);
DECODE_EXPORTS_API void H264Decode_Close(int Decoder);

input is from the simple encoder, it is a series of image.

The full code is in the attachment.


I found that, the decoder just could decode when the function H264DecodeStream been called at first.
After first image, it would fail in the line :

status = h264Decoder->decoder->GetFrame(NULL, h264Decoder->dataOut);

the status would be UMC_ERR_INVALID_STREAM.

I think it is becouse UMC::H264VideoDecoder does not been reset, but using Reset() function is still
not work.

what should it do to modify the code to let the H264DecodeStream could be call many time and still work ? thank you again.
0 Kudos
Chao_Y_Intel
Moderator
569 Views


Hi,

Could you please also attached the related the .h file, which can help to reproduce your problem here?

Also, in this code, H264DecodeStream looks only be called once. Is there any code that can actually show the problem, and please also attached the test stream.

Thanks,
Chao

0 Kudos
Gaiger_Chen
New Contributor I
569 Views
HI Chao:

Sorry I just non-clear code Completely.

I have modify the input and output, the input is h264 file, output is bmp.

you should add those projects: h264_dec, color_space_converter, umc, vm and vm_plus.

the start up project is ConsoleRun.


thank you.
0 Kudos
Chao_Y_Intel
Moderator
569 Views

Hi,

In the code, you are decoding multiple stream data. You need to use multiple instance of H.264. See attached sample.

Reset() change the decoder status to an initialized instance. Not the status before the initialization

Thanks,
Chao

0 Kudos
Gaiger_Chen
New Contributor I
569 Views
HI

I found that the UMC::VideoDecoderParams params could not be re-use, so H264DecodeStream

would not work from this function is called more than a second.

I found that it is just use

params.pPostProcessing = NULL;

in the H264DecodeStream

then H264DecodeStream could be called multi-time with right output.

anyway, thank you.
0 Kudos
Reply