Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • xiaozhaAugust 8, 2011 1:23 AM PDT   
    how to set the parameters of framesurface

    the functions MFXVideoENCODE_EncodeFrameAsync()  "5", namely MFX_WRN_INCOMPATIBLE_VIDEO_PARAM , why?
    my code :

    mfxSession *sSession= new mfxSession();
    mfxVersion vVersion={MFX_VERSION_MINOR, MFX_VERSION_MAJOR};
    if(MFX_ERR_NONE!= MFXInit(MFX_IMPL_AUTO,&vVersion,sSession))
    return -1;
    mfxIMPL implStyle = MFX_IMPL_AUTO;
    MFXQueryIMPL( *sSession, &implStyle );
    switch(implStyle)
    {
    case MFX_IMPL_SOFTWARE:
       std::cout<<"software";
    break;
    case MFX_IMPL_HARDWARE:
    std::cout<<"hardware";
    break;
    default:
    std::cout<<"wrong";
    break;
    }
    mfxVideoParam *par=new mfxVideoParam();
    par->AsyncDepth=0;
    par->Protected=0;
    par->IOPattern=MFX_IOPATTERN_IN_SYSTEM_MEMORY;
    par->mfx.CodecId=MFX_CODEC_AVC;
    par->mfx.TargetKbps=100;
    par->mfx.EncodedOrder=0;
    par->mfx.FrameInfo.Height=480;
    par->mfx.FrameInfo.Width=704;
    par->mfx.FrameInfo.FrameRateExtD=2;
    par->mfx.FrameInfo.FrameRateExtN=200;
    par->mfx.FrameInfo.FourCC=MFX_FOURCC_NV12;
    par->mfx.FrameInfo.ChromaFormat=MFX_CHROMAFORMAT_YUV420;
    par->mfx.FrameInfo.PicStruct=MFX_PICSTRUCT_FIELD_TFF;
    par->mfx.FrameInfo.CropX=0;
    par->mfx.FrameInfo.CropY=0;
    par->mfx.FrameInfo.CropW=704;
    par->mfx.FrameInfo.CropH=480;
    mfxStatus retOfInit=MFXVideoENCODE_Init(*sSession,par);//here retOfInit equals 0, which means no error;
       
    mfxFrameSurface1 *frsf=new mfxFrameSurface1();//
    memcpy(&frsf->Info,&par->mfx.FrameInfo,sizeof(mfxFrameInfo));
    frsf->Info.Height=480;
    frsf->Info.Width =704;
    frsf->Info.FourCC=MFX_FOURCC_NV12;
    frsf->Info.ChromaFormat=MFX_CHROMAFORMAT_YUV420;
    frsf->Info.PicStruct=MFX_PICSTRUCT_FIELD_TFF;//I don't understand this parameter.
    mfxU8* Y=new mfxU8[704*480];
    mfxU8* UV= new mfxU8[704*240];
      
    for(int i=0;i<704*480;i++)
      Y[i]=80;
    for(int i=0;i<704*240;i++)
      UV[i]=150;
    frsf->Data.Y=Y;
    frsf->Data.UV=UV;
    frsf->Data.Locked=0;
    frsf->Data.Pitch=704;
    mfxBitstream *bs=new mfxBitstream();
    bs->Data=new mfxU8[1000000];
    bs->MaxLength=1000000;
    mfxSyncPoint syn;
    int r= MFXVideoENCODE_EncodeFrameAsync(*sSession,NULL,frsf,bs,&syn);
    //r equals 5 and there is no data in bs. I wanna know if some parameters are not correct.

    I am a new guy in programming and h.264, and english, :(. Right here  hoping for answers. thx.



    Petter Larsson (Intel)August 8, 2011 9:34 AM PDT
    Rate
     
    how to set the parameters of framesurface

    Hi xiaozha,

    The primary issue you're facing is that there is not enough space in the bit stream buffer. Please increase the size to about 5MB and try again. You can also get an estimate of the requried size by calling GetVideoParam on the encoder and look at the mfx.BufferSizeInKB parameter.

    Besides this, there are many somewhat strange parameter vales used in your code, such as the values selected as frame rate and target bit rate. I recommend exploring if these are the actual values you want to use?

    Also, I would highly suggest performing a mem zero on the allocated parameter structures and bit stream. 

    Additionally, you will likely get varning MFX_WRN_INCOMPATIBLE_VIDEO_PARAMS when calling encoder init since the rate control value has not been set. Encoder will select a valid value for you, but this is probably not what you want?

    The Media SDK encode sample has more details on how to setup an encode pipeline.

    Regards,
    Petter


    xiaozhaAugust 8, 2011 6:58 PM PDT
    Rate
     
    how to set the parameters of framesurface

    thanks a lot :)  I am going to try more.

Forum jump:  

Intel Software Network Forums Statistics

17,025 users have contributed to 48,319 threads and 172,758 posts to date.

In the past 24 hours, we have 11 new thread(s) 54 new posts(s), and 47 new user(s).

In the past 3 days, the most popular thread for everyone has been Optimalization of sine function\'s taylor expansion The most posts were made to Most likely, the issue is that The post with the most views is Optimalization of sine function\'s taylor expansion

Please welcome our newest member redfruit83


For more complete information about compiler optimizations, see our Optimization Notice.