| September 9, 2009 12:00 AM PDT | |
Overview
The Unified Media Classes (UMC) are a set of unified C++ interfaces for building the standard blocks of a media application, including codecs, renderers, splitters, etc. UMC include abstract base classes, on the basis of which cross-platform and cross-OS derivative classes are built as well as OS-dependent renderers and readers.
This guide shows you to use some basic UMC class to build simple decoder and encoder. For more information, user can refer to the UMC sample code Reference Manual at sample code folder \audio-video-codecs\doc and UMC sample code applications at \audio-video-codecs\application.
The contents are integrated to latest IPP UMC sample and the UMC sample in Intel IPP samples for Parallel Studio 2011 if you are Intel Parallel Studio user.
Creating a simple decoder
UMC::VideoDecoder class provides basic interfaces for video decoders. It includes methods that perform initialization of the decoder, decompression of the frame, and destroying of the decoder, etc. Users need to use derived class from UMC::VideoDecoder (e.g UMC::H263VideoDecoder,UMC::H264VideoDecoder, UMC::MPEG4VideoDecoder) to complete a video decoding process.
The following are some steps to use a UMC decoder:
1. Set decoding parameters UMC::VideoDecoderParams
2. Initialize an VideoDecoder class with UMC::VideoDecoderParams
3. Start to get the decoded frame by calling GetFrame() function in VideoDecoder class
4. Get buffered decoded frames left by decoder by calling GetFrame() with NULL input pointer.
The sample code bellow decodes a raw H.264 video stream in “cVideoData”, put decoded YUV data into “cYUVData” buffer, and set image size and decoded frame number. Please click here to get full sample code.
void DecodeStream( Ipp8u *cVideoData,int VideoDataSize,
Ipp8u *cYUVData, int& imgWidth, int & imgHeight, int & frameNumber )
{
UMC::Status status; UMC::MediaData DataIn; UMC::VideoData DataOut;
UMC::VideoDecoderParams Params;
UMC::H264VideoDecoder H264Decoder;
int frameSize=0;
DataIn.SetBufferPointer(cVideoData,VideoDataSize);
DataIn.SetDataSize(VideoDataSize);
//use default paramter, threading number=1
Params.m_pData = &DataIn; Params.lFlags=0; Params.numThreads=1;
if(status = H264Decoder.Init(&Params)!=UMC::UMC_OK)
return;
H264Decoder.GetInfo(&Params);
imgWidth=Params.info.clip_info.width; imgHeight=Params.info.clip_info.height;
frameSize = imgWidth*imgHeight*3/2;
DataOut.Init(imgWidth,imgHeight,UMC::YV12,8);
DataOut.SetBufferPointer(cYUVData,frameSize);
int exit_flag=0; frameNumber=0;
do{ status = H264Decoder.GetFrame(&DataIn, &DataOut);
if (status == UMC::UMC_OK){
cYUVData += (frameSize);
DataOut.SetBufferPointer(frameSize);
frameNumber++;
}
if((status !=UMC::UMC_OK)||(frameNumber >=MAXFRAME))
exit_flag = 1;
}while (exit_flag!=1);
do{ status = H264Decoder.GetFrame(NULL, &DataOut);
if (status == UMC::UMC_OK) {
cYUVData += (frameSize);
DataOut.SetBufferPointer(cYUVData,frameSize);
frameNumber++;
}
}while(status == UMC::UMC_OK);
return;
}
Building a simple encoder
UMC::VideoEncoder class provides interfaces for video encoders. To complete UMC a video encoding process, users need to use derived class from UMC::VideoEncoder (e.g UMC::H264VideoEncoder,UMC::MEPG2VideoEncoder, UMC::MPEG4VideoEncoder) to compress input data.
The following are some basic steps to use a UMC encoder:
1.Set encode parameters UMC::VideoEncoderParams or its derived class
2.Initializes a VideoEncoder class.
3.Get each encoded frame by calling VideoEncoder function GetFrame(). Encoding is performed frame by frame
The example code bellow encodes the YUV data in the memory buffer “cYUVData “ into H.264 video streaming. The encoded h.264data is put into “cVideoData”. Please check here to get the complete sample code.
void EncodeStream(Ipp8u *cYUVData, int imgWidth, int imgHeight, int frameNumber,
Ipp8u *cVideoData,int &VideoDataSize )
{
UMC::Status status;
UMC::MediaData DataOut; UMC::VideoData DataIn;
UMC::H264EncoderParams Params;
UMC::H264VideoEncoder H264Encoder;;
int FrameSize;
Params.key_frame_controls.method=1;
Params.info.clip_info.height=imgHeight;
Params.info.clip_info.width=imgWidth;
Params.info.bitrate = 1000000;
Params.numThreads = 1;
if((status = H264Encoder.Init(&Params))!=UMC::UMC_OK)
return;
FrameSize = imgWidth*imgHeight*3/2;
DataIn.Init(imgWidth,imgHeight,UMC::YV12,8);
DataIn.SetBufferPointer(cYUVData,FrameSize);
DataIn.SetDataSize(FrameSize);
DataOut.SetBufferPointer(cVideoData,MAXVIDEOSIZE);
VideoDataSize=0;
int nEncodedFrames=0;
while ( nEncodedFrames < frameNumber)
{
status = H264Encoder.GetFrame(&DataIn, &DataOut);
if (status == UMC::UMC_OK)
{
nEncodedFrames++;
VideoDataSize+=DataOut.GetDataSize();
DataOut.MoveDataPointer(DataOut.GetDataSize());
cYUVData+=FrameSize;
DataIn.SetBufferPointer(cYUVData,FrameSize);
DataIn.SetDataSize(FrameSize);
}
}
return;
}
Using a splitter
Intel IPP UMC splitter provides users ability to separates audio, video, and auxiliary elementary streams (ES) from several file formats (MPEG TS stream, MP4 and AVI). The splitter class needs to receive data from UMC::DataReader interface.
The following are some basic steps to use a UMC splitter:
1. Set splitter parameters UMC::SplitterParams
2. call Init() function to perform initialization of the splitter according to the input parameter.
3. Call GetInfo() method to collect information on the processed stream.
4. Call Run() function to run the internal processing thread(s).
4. Call GetNextData() and CheckNextData() methods to obtain the next data chunk from the stream.
The example code bellow uses MP4 splitter to read H.264 video data from the input file. Please click here to get the complete sample code. This sample uses MP4 splitter to separate H.264 video and uses H.264 decoder to decode the video stream.
void EncodeStream(vm_char * inputfilename, vm_char * outputfilename )
{
Ipp32u videoTrack=0; int exit_flag =0;
UMC::Status status;
UMC::MediaData in; UMC::VideoData out;
UMC::FIOReader reader; UMC::FileReaderParams readerParams;
UMC::SplitterParams splitterParams; UMC::SplitterInfo * streamInfo;
UMC::MP4Splitter Splitter;
UMC::VideoStreamInfo *videoInfo=NULL;
UMC::VideoDecoder * videoDecoder; UMC::VideoDecoderParams videoDecParams;
UMC::FWVideoRender fwRender; UMC::FWVideoRenderParams fwRenderParams;
readerParams.m_portion_size = 0;
vm_string_strcpy(readerParams.m_file_name, inputfilename);
if((status = reader.Init(&readerParams))!= UMC::UMC_OK)
return;
splitterParams.m_lFlags = UMC::VIDEO_SPLITTER;
splitterParams.m_pDataReader = &reader;
if((status = Splitter.Init(splitterParams))!= UMC::UMC_OK)
return;
Splitter.GetInfo(&streamInfo);
for (videoTrack = 0; videoTrack < streamInfo->m_nOfTracks; videoTrack++) {
if (streamInfo->m_ppTrackInfo[videoTrack]->m_Type == UMC::TRACK_H264)
break;
}
videoInfo = (UMC::VideoStreamInfo*)(streamInfo->m_ppTrackInfo[videoTrack]->
m_pStreamInfo);
if(videoInfo->stream_type!=UMC::H264_VIDEO)
return;
videoDecParams.info = (*videoInfo);
videoDecParams.m_pData = streamInfo->m_ppTrackInfo[videoTrack]->m_pDecSpecInfo;
videoDecParams.numThreads = 1;
videoDecoder = (UMC::VideoDecoder*)(new UMC::H264VideoDecoder());
if((status = videoDecoder->Init(&videoDecParams))!= UMC::UMC_OK)
return;
fwRenderParams.out_data_template.Init(videoInfo->clip_info.width, videoInfo->clip_info.height,
videoInfo->color_format);
fwRenderParams.pOutFile = outputfilename;
if(status = fwRender.Init(&fwRenderParams)!= UMC::UMC_OK)
return;
Splitter.Run();
do{
do{
if (in.GetDataSize() < 4) {
do{ status= Splitter.GetNextData(&in,videoTrack);
if(status==UMC::UMC_ERR_NOT_ENOUGH_DATA)
vm_time_sleep(5);
}while(status==UMC::UMC_ERR_NOT_ENOUGH_DATA);
if(((status != UMC::UMC_OK) && (status != UMC::UMC_ERR_END_OF_STREAM))||
(status == UMC::UMC_ERR_END_OF_STREAM)&& (in.GetDataSize()<4)) {
exit_flag=1;
}
}
fwRender.LockInputBuffer(&out);
videoDecoder->GetFrame(&in,&out);
fwRender.UnLockInputBuffer(&out);
fwRender.RenderFrame();
}while(!exit_flag&&(status ==UMC::UMC_ERR_NOT_ENOUGH_DATA||status==UMC::UMC_ERR_SYNC));
}while (exit_flag!=1);
do{
fwRender.LockInputBuffer(&out);
status = videoDecoder->GetFrame(NULL,&out);
fwRender.UnLockInputBuffer(&out);
fwRender.RenderFrame();
}while(status == UMC::UMC_OK);
}
Using a muxer
Intel IPP UMC sample code provides MPEG2 and MP4 muxer classes, which enable users to multiplex audio, video and other elementary streams (ES) into a container.
The following are some steps to use a UMC Muxer class:
1. Set muxer parameter UMC::MPEG2MuxerParams or UMC::MP4MuxerParams
2. Call Init() function to initialize Muxer according to the input parameter.
3. Call PutVideoData()/PutAudioData() to copy video or audio data into output buffer.
4. Call Close() to flushes all samples remaining in the internal buffers, closes the muxer.
The example code bellow uses MPEG2 TS muxer to put H.264 video stream into TS stream. Check here to get full sample code.
void EncodeStream (Ipp8u *cYUVData, int imgWidth, int imgHeight, int frameNumber,
vm_char * tsFileName) { UMC::Status status; UMC::MediaData DataOut, MuxData; UMC::VideoData DataIn; UMC::H264EncoderParams Params; UMC::H264VideoEncoder H264Encoder; UMC::MPEG2Muxer Muxer; UMC::MPEG2MuxerParams MuxerParams; Ipp8u *cMaxVideoData=NULL;
int FrameSize; UMC::VideoStreamInfo VideoInfo; UMC::FileWriter Writer; UMC::FileWriterParams WriterParams; strcpy(WriterParams.m_file_name, tsFileName); Writer.Init(&WriterParams); MuxerParams.m_lpDataWriter = &Writer; MuxerParams.m_SystemType = UMC:: MPEG2_TRANSPORT_STREAM; MuxerParams.m_nNumberOfTracks = 1; MuxerParams.pTrackParams = new UMC::TrackParams[MuxerParams.m_nNumberOfTracks]; VideoInfo.clip_info.height=imgHeight; VideoInfo.clip_info.width=imgWidth; VideoInfo.stream_type=UMC::H264_VIDEO; VideoInfo.color_format=UMC::YV12; VideoInfo.interlace_type=UMC::PROGRESSIVE; VideoInfo.bitrate=1000000; VideoInfo.streamPID=0; MuxerParams.pTrackParams[0].type = UMC::VIDEO_TRACK; MuxerParams.pTrackParams[0].info.video = &VideoInfo; MuxerParams.pTrackParams[0].bufferParams.m_prefInputBufferSize=2000000; MuxerParams.pTrackParams[0].bufferParams.m_prefOutputBufferSize=2000000; if((status =Muxer.Init(&MuxerParams))!=UMC::UMC_OK) return; Params.info.clip_info.height=imgHeight; Params.info.clip_info.width=imgWidth; Params.info.bitrate = 1000000; Params.numThreads = 1; if((status = H264Encoder.Init(&Params))!=UMC::UMC_OK) return;
FrameSize = imgWidth*imgHeight*3/2; cMaxVideoData= ippsMalloc_8u(MAXAFRAMESIZE); DataIn.Init(imgWidth,imgHeight,UMC::YV12,8); DataIn.SetBufferPointer(cYUVData,FrameSize); DataIn.SetDataSize(FrameSize); DataOut.SetBufferPointer(cMaxVideoData,MAXAFRAMESIZE); int nEncodedFrames=0; while ( nEncodedFrames < frameNumber) { status = H264Encoder.GetFrame(&DataIn, &DataOut);
if (status == UMC::UMC_OK) {
nEncodedFrames++;
MuxData.SetBufferPointer((Ipp8u*)DataOut.GetBufferPointer(),DataOut.GetDataSize());
memcpy(MuxData.GetDataPointer(),DataOut.GetDataPointer(), DataOut.GetDataSize());
MuxData.SetDataSize(DataOut.GetDataSize());
MuxData.SetTime(nEncodedFrames*((double)1.0)/30);
do { status = Muxer.PutVideoData(&MuxData); if (UMC::UMC_ERR_NOT_ENOUGH_BUFFER == status) vm_time_sleep(5); }while (UMC::UMC_ERR_NOT_ENOUGH_BUFFER == status);
cYUVData+=FrameSize;
DataIn.SetBufferPointer(cYUVData,FrameSize);
DataIn.SetDataSize(FrameSize);
DataOut.SetBufferPointer(cMaxVideoData,MAXAFRAMESIZE); } } Muxer.Close(); return; }
YUV(I420) and Y, U, V seperate plane
Please note, here the YUVData (I420) is stored in single consecutive array. And if your YUV data are stored in 3 planar array, then you may amend the above code by UMC function SetPlanePointer(*p, iPlanceNumber) for Y, U, V plane,
for example, in encoder sample,
Change DataIn.SetBufferPointer(cYUVData,imgWidth*imgHeight*3/2); to // Compared to I420 (YUV) plans are in YV12 (YVU) //LPBYTE pSrcY = cYUVData; //LPBYTE pSrcU = pDestY + (imgWidth * imgHeight); //LPBYTE pSrcV = pDestU + ((imgWidth * imgHeight) / 4); DataIn.SetPlanePointer(pSrcY, 0); // Y DataIn.SetPlanePointer(pSrcU, 1); // U DataIn.SetPlanePointer(pSrcV, 2); // V
Do you need more help?
This article applies to: Intel® Integrated Performance Primitives Knowledge Base
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (29) 
| June 3, 2009 7:42 PM PDT
Chao Y (Intel)
|
Pradeep, Have you downloaded the full sampe or just copy & past the code from the webpage? It looks that you missed some head file here. thanks, Chao |
| June 3, 2009 7:49 PM PDT
Pradeep |
I used the full sample file. Thanks, Pradeep |
| June 4, 2009 10:16 AM PDT
Pradeep |
I would appreciate if you could point me to the missing information in the sample encoder file. Thanks, Pradeep |
| June 16, 2009 1:28 AM PDT
Ying H (Intel)
|
Hi Pradeep, The parameter H264EncoderParams is defined in the header file "umc_h264_video_encoder.h". Could you pleae check if the line #include "umc_h264_video_encoder.h" are in your code? Regards, Ying |
| June 16, 2009 9:36 AM PDT
DEN |
I am trying to play MPEG4 DIVX4 video stream using “Creating a simple decoder”, but something goes wrong. Sample of my stream (~700kb) can be downloaded here: http://www.sendspace.com/file/05i13q The only change I made is I replaced UMC::H264VideoDecoder with UMC::MPEG4VideoDecoder. I've got an error on UMC::MPEG4VideoDecoder::GetFrame. The error depends on the output color format I request. This is strange - the stream is pure MPEG4 DIVX4 stream, why IPP can't decode it? Or maybe “Creating a simple decoder” is incomplete and I should add some additional initialization? Btw, VLC Player plays that stream fine. |
| June 16, 2009 6:18 PM PDT
Chao Y (Intel)
|
DEN, any other place to download the stream? The URL does not looks to work here: http://www.sendspace.com/file/05i13q |
| June 16, 2009 6:49 PM PDT
DEN | Chao Yu, sure, try this direct link: www. insidecpp.ru/stream.bin |
| June 16, 2009 7:54 PM PDT
Chao Y (Intel)
| This looks to be a corrupted stream. When I tried other tools (e.g FFMPEG), it reported many errors. Is this expected? |
| June 19, 2009 11:15 AM PDT
boggy550326
| In simple decoder sample, the whole H264 data are read into a big buffer and then passed to decoder.This works fine. In my case, I have to read the H264 data in a loop in 64k block and decode them, the generated YUV data has some lost frames. |
| June 21, 2009 5:24 AM PDT
Chao Y (Intel)
| This example code are simple code. For more complex example on using UMC, you can refer to the "simpleplayer" application in the UMC example. |
| July 22, 2009 11:59 PM PDT
Richard Koslik |
Hello, is there also a working example for delphi language? I can't find any delphi dll wrapper units in the "ipp-samples" package for decoding MPEG4 or H264. Only a simple image processing example which does not use the required dll for decoding... In my application i need to display RAW MPEG4 frames(24bit) from a stream. I have already the frame in memory and need now to decode... Can anybody help please? Thanks in advise, richard. |
| August 15, 2009 10:13 AM PDT
Heidarian
|
ِDear I created new console app. project in VS 2008 and added simpledecoder.cpp to project, and also add the following directory to include path of project: ..audio-video-codecscoreumcinclude ..audio-video-codecscodech264_decinclude ..audio-video-codecscorevminclude (nothing else added to "Executable files" and "Library files") when I build the project in debug mode I got 17 errors of LNK2019 type, some of them are as follow: 1>simpledecoder.obj : error LNK2019: unresolved external symbol "public: virtual int __thiscall UMC::H264VideoDecoder::GetFrame(class UMC::MediaData *,class UMC::MediaData *)" (?GetFrame@H264VideoDecoder@UMC@@UAEHPAVMediaData@2@0@Z) referenced in function "void __cdecl DecodeStream(unsigned char *,int,unsigned char *,int &,int &,int &)" (?DecodeStream@@YAXPAEH0AAH11@Z) 1>simpledecoder.obj : error LNK2019: unresolved external symbol "public: virtual int __thiscall UMC::VideoData::SetBufferPointer(unsigned char *,unsigned int)" (?SetBufferPointer@VideoData@UMC@@UAEHPAEI@Z) referenced in function "void __cdecl DecodeStream(unsigned char *,int,unsigned char *,int &,int &,int &)" (?DecodeStream@@YAXPAEH0AAH11@Z) Could anyone tell me what is the problem? Should I add any more path? Thanks in advance |
| August 15, 2009 10:15 AM PDT
Heidarian
|
ِDear I created new console app. project in VS 2008 and added simpledecoder.cpp to project, and also add the following directory to include path of project: ..audio-video-codecscoreumcinclude ..audio-video-codecscodech264_decinclude ..audio-video-codecscorevminclude (nothing else added to "Executable files" and "Library files") when I build the project in debug mode I got 17 errors of LNK2019 type, some of them are as follow: 1>simpledecoder.obj : error LNK2019: unresolved external symbol "public: virtual int __thiscall UMC::H264VideoDecoder::GetFrame(class UMC::MediaData *,class UMC::MediaData *)" (?GetFrame@H264VideoDecoder@UMC@@UAEHPAVMediaData@2@0@Z) referenced in function "void __cdecl DecodeStream(unsigned char *,int,unsigned char *,int &,int &,int &)" (?DecodeStream@@YAXPAEH0AAH11@Z) 1>simpledecoder.obj : error LNK2019: unresolved external symbol "public: virtual int __thiscall UMC::VideoData::SetBufferPointer(unsigned char *,unsigned int)" (?SetBufferPointer@VideoData@UMC@@UAEHPAEI@Z) referenced in function "void __cdecl DecodeStream(unsigned char *,int,unsigned char *,int &,int &,int &)" (?DecodeStream@@YAXPAEH0AAH11@Z) Could anyone tell me what is the problem? Should I add any more path? Thanks in advance |
| August 15, 2009 10:17 AM PDT
Heidarian
|
ِDear I created new console app. project in VS 2008 and added simpledecoder.cpp to project, and also add the following directory to include path of project: ..audio-video-codecscoreumcinclude ..audio-video-codecscodech264_decinclude ..audio-video-codecscorevminclude (nothing else added to "Executable files" and "Library files") when I build the project in debug mode I got 17 errors of LNK2019 type, some of them are as follow: 1>simpledecoder.obj : error LNK2019: unresolved external symbol "public: virtual int __thiscall UMC::H264VideoDecoder::GetFrame(class UMC::MediaData *,class UMC::MediaData *)" (?GetFrame@H264VideoDecoder@UMC@@UAEHPAVMediaData@2@0@Z) referenced in function "void __cdecl DecodeStream(unsigned char *,int,unsigned char *,int &,int &,int &)" (?DecodeStream@@YAXPAEH0AAH11@Z) Could anyone tell me what is the problem? Should I add any more path? Thanks in advance |
| August 24, 2009 9:36 AM PDT
Michael |
Why does the simple player, this example, and mpeg2 encoder encode swizzle of color streams - also known as BROKEN. Heres my test code. //Open mpg FILE *pFile = fopen("C:/MPEG2.mpg", "rb"); //Get length of file fseek(pFile, 0, SEEK_END); fpos_t nFilePos; fgetpos(pFile, &nFilePos); //Reset it and allocate fseek(pFile, 0, SEEK_SET); Ipp8u *cYUVData = ippsMalloc_8u(static_cast<unsigned int>(nFilePos)); //unsigned char *pVidInBuf = new unsigned char[]; //Read into it size_t unBytesRead = fread(cYUVData, static_cast<unsigned int>(nFilePos), 1, pFile); #define MAXVIDEOSIZE 100000000 #define MAXYUVSIZE 200000000 Ipp8u *cVideoData = ippsMalloc_8u(MAXVIDEOSIZE); // //Encoder int nWidth = 720; int nHeight = 480; UMC::Status status; MediaData DataOut; VideoData DataIn; MPEG2VideoEncoder enc; MPEG2EncoderParams Params; Params.info.clip_info.width = nWidth; Params.info.clip_info.height = nHeight; Params.info.bitrate = 4000000; Params.info.framerate = 30; status = enc.Init(&Params); if(status != UMC_OK) { return 0; } //set data in //oops twice... i think mpeg is yuv420. DataIn.Init(nWidth, nHeight, UMC::YUV420, 8); DataIn.SetBufferPointer(cYUVData, nWidth * nHeight * 3 / 2); DataIn.SetDataSize(nWidth*nHeight*3/2); //wondering if the div 2 is a alignment or something DataOut.SetBufferPointer(cVideoData, MAXVIDEOSIZE); int VideoDataSize=0; int nEncodedFrames=0; int frameNumber = 22; while ( nEncodedFrames < frameNumber) { status = enc.GetFrame(&DataIn, &DataOut); if (status == UMC::UMC_OK) { nEncodedFrames++; VideoDataSize+=DataOut.GetDataSize(); DataOut.MoveDataPointer(DataOut.GetDataSize()); cYUVData+=nWidth*nHeight*3/2; DataIn.SetBufferPointer(cYUVData,nWidth*nHeight*3/2); DataIn.SetDataSize(nWidth*nHeight*3/2); } } FILE *pfOut = fopen("C:/out.mpg", "wb"); //oops lollers int nWriteCount = fwrite(cVideoData, VideoDataSize, 1, pfOut); fclose(pfOut); |
| August 31, 2009 12:57 AM PDT
YanQin |
Hi, I manage to encode h.264 video with the sample code of simple encoder. However the colour of the encoded video is not correct. May I know how could i solve the problem? Thanks in advance |
| October 13, 2009 7:38 PM PDT
Chao Y (Intel)
|
Heidarian, For the linkage errors, it looks that you missed a few UMC libraries. You can follow the example project file at udio-video-codecsapplicationsimple_playersimple_player.sln 1>simpledecoder.obj : error LNK2019: unresolved external symbol "public: virtual int __thiscall UMC::H264VideoDecoder::GetFrame(class UMC::MediaData *,class UMC::MediaData *)" (?GetFrame@H264VideoDecoder@UMC@@UAEHPAVMediaData@2@0@Z) referenced in function "void __cdecl DecodeStream(unsigned char *,int,unsigned char *,int &,int &,int &)" (?DecodeStream@@YAXPAEH0AAH11@Z) Open solution file, right click the Solution, Check "Common Properties""Project Dependencies", Select "simple_player" project, you can find that it depends on other UMC libraries. Thanks, Chao |
| October 13, 2009 7:50 PM PDT
Chao Y (Intel)
|
YanQin, For the question: "I manage to encode h.264 video with the sample code of simple encoder. However the colour of the encoded video is not correct. May I know how could i solve the problem?" What is the input video format? This sample code assume the input data is YUV420. For each frame, Y data first, then U and V. Regards, Chao |
| February 11, 2010 12:45 AM PST
Boris |
Hi, What exactly does the following code do? if (UMC::UMC_ERR_NOT_ENOUGH_BUFFER == status) vm_time_sleep(5); What does it wait for? The sample code does not seem to make any more buffer available, so it seems that whenever there is not enough buffer, it will sleep() forever, albeit in a number of tiny naps :). Or am I missing something important? Thank you in advance and Best regards, Boris |
| March 2, 2010 11:53 PM PST
Chao Y (Intel)
|
Hi Boris, This is used to sync with Splitter. Splitter creates additional threading to get the data. When decoder can not get enough data from splitter, "sleep" a while and wait splitter to get the data. Thanks, Chao |
| March 5, 2010 2:25 AM PST
Boris |
Hi Chao, I understand what this code does in the splitter (although I must admit, I did not take a close look at the splitter while asking the question, otherwise I would have been more precise about the context). My question was about its use in the muxer which seems single-threaded, at least in this sample (where only one track is processed). Thanks and Best regards, Boris |
| May 1, 2010 4:37 PM PDT
mike vasiljevs |
Regarding the muxer, it should be possible to have theoretically few writers (e.g. one writing to udp socket another to the file) in a list. I was just wondering if there is any danger in doing this kind of thing? E.g. thread problems? Many thanks mike |
| May 26, 2010 5:25 PM PDT
Manoj |
Hi, I am using Muxer sample application to convert .264 file into .ts file. I am getting black scree when I play the output .ts file. To debug the code, I wrote .264 data into a file before passing it to MPEG2Ts, and It plays fine. So, I have problem in Transport stream code. Could you please help me to know if there is any modification I need to do to make muxer work. I would also like to know if there is any sample Muxer application code which could write both audio and video file into transport stream. |
| November 10, 2010 2:05 PM PST
timatintel
|
I have an task where I am receiving I and P frames from a .264 HW encoder and need to store these in an mp4 container. It looks like the ipp-samplesaudio-video-codecsapplicationumc_video_enc_con could be a good starting point for this project; keep the container creation parts and feed it from the HW instead of the SW encoder. If anyone knows why this won't work, please let me know why. Also, any suggestions on a better approach to solve this problem would be appreciated. Tim |
| November 11, 2010 12:43 AM PST
Gaiger Chen
| Thank you, Chao, that is very useful. |
| November 11, 2010 6:07 PM PST
Chao Y (Intel)
|
Hi Tim, IPP sample code does not use the hardware accelerate. You can check Intel media SDK for that usage. Thanks, Chao |
| June 9, 2011 4:19 PM PDT
Peter M |
I am trying to read and decode video data from a .ts file, which FFMPEG recognizes as a mpeg transport stream, with stream 0 being h.264-compressed 1280x720 video, and stream 1 as aac audio (0 (?) channels, s16). This file can be played by simple player application, but umc_h264_dec_con will not open/transcode it. The code exits at an attempt to initialize the H264Decoder ("Video Decoder creation failed"). Could you please offer any insight? |
| June 13, 2011 6:23 PM PDT
Peter M | Never mind, I figured it out. All the information I needed was in simple_player application code, albeit wrapped in gazillion layers... |
Trackbacks (0)
Leave a comment 
To obtain technical support, please go to Software Support.



Pradeep
In the above simple encoder inside the function EncodeStream, you mention the following initialization:
UMC::H264EncoderParams Params;
UMC::H264VideoEncoder H264Encoder;
But when I run i get the following error:
error C2039: 'H264EncoderParams' : is not a member of 'UMC'
error C2065: 'H264EncoderParams' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'Params'
error C2065: 'Params' : undeclared identifier
error C2039: 'H264VideoEncoder' : is not a member of 'UMC'
.....
Please let me know the reason.
Thanks,
Pradeep