How to encode AVC1 for Flashplayer

How to encode AVC1 for Flashplayer

I encode NV12 to AVC1 using Media SDK, the AVC1 bitstreams can decoded well using h264 decoder such as LEADTOOLS H.264 Decoder, but cannot decoded using Flashplayer. I think there's something I missed when I initialize mfxVideoParam.What should I do to make Flashplayer work?

Codes as follows:

MFXVideoENCODE* m_pmfxENC;
mfxVideoParam m_mfxEncParams; 

m_mfxEncParams.mfx.CodecId                 = MFX_CODEC_AVC;

m_mfxEncParams.mfx.CodecProfile                = MFX_PROFILE_AVC_PROGRESSIVE_HIGH;
m_mfxEncParams.mfx.TargetUsage                = MFX_TARGETUSAGE_BALANCED;
m_mfxEncParams.mfx.TargetKbps                  = 125000;
m_mfxEncParams.mfx.MaxKbps                     = 125000;
m_mfxEncParams.mfx.RateControlMethod       = MFX_RATECONTROL_VBR;
ConvertFrameRate(25, &m_mfxEncParams.mfx.FrameInfo.FrameRateExtN, &m_mfxEncParams.mfx.FrameInfo.FrameRateExtD);

m_mfxEncParams.mfx.GopPicSize               = pInParams->nKFrameInterval;
m_mfxEncParams.mfx.GopRefDist                = 1;
m_mfxEncParams.mfx.GopOptFlag               = MFX_GOP_STRICT;
m_mfxEncParams.mfx.IdrInterval                   = 0;
m_mfxEncParams.mfx.NumRefFrame            = 0;
m_mfxEncParams.mfx.EncodedOrder            = 0;


m_mfxEncParams.mfx.FrameInfo.FourCC            = MFX_FOURCC_NV12;
m_mfxEncParams.mfx.FrameInfo.ChromaFormat = MFX_CHROMAFORMAT_YUV420;
m_mfxEncParams.mfx.FrameInfo.PicStruct         = MFX_PICSTRUCT_PROGRESSIVE;

m_mfxEncParams.mfx.FrameInfo.Width  = MSDK_ALIGN16(352);
m_mfxEncParams.mfx.FrameInfo.Height = MSDK_ALIGN16(288) ;

m_mfxEncParams.mfx.FrameInfo.CropX   = 0;
m_mfxEncParams.mfx.FrameInfo.CropY  = 0;
m_mfxEncParams.mfx.FrameInfo.CropW = 352;
m_mfxEncParams.mfx.FrameInfo.CropH  = 288;


Best regards, Rocky

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Most players only work with container formats, not elementary streams.  The Media SDK encoder only outputs elementary streams.  This must be muxed into a container format.  Examples of this can be found in sample_full_transcode and the ffmpeg integration example in the tutorial package.

Regards, Jeff

Leave a Comment

Please sign in to add a comment. Not a member? Join today