Intel-Media-SDK / MediaSDK

The Intel® Media SDK
MIT License
935 stars 459 forks source link

MFXVideoENCODE_Reset failed when encoder is inited with mfxExtAvcTemporalLayers #2695

Closed DragonDanceGo closed 3 years ago

DragonDanceGo commented 3 years ago

Hi, I use MediaSDK to build h264 encoder and call MFXVideoENCODE_Reset to do dynamic format change of mfxVideoENCODE, but I have following problems If I init mfxVideoENCODE without setting mfxExtAvcTemporalLayers, I can successfully call MFXVideoENCODE_Reset to dynamic change bitrate, profile, frame size etc during encoding If I init mfxVideoENCODE with setting mfxExtAvcTemporalLayers like "{0,1,0,0,0,0,0,0}" or "{0,1,2,0,0,0,0,0}" or "{0,1,2,4,0,0,0,0}", MFXVideoENCODE_Reset always return MFX_ERR_INVALID_VIDEO_PARAM, no matter what new encoder paramter I set So how to dynamic change encoder format when temporal layer is enabled? thanks

daleksan commented 3 years ago

Hi @DenWolf can you take a look?

kovakimy commented 3 years ago

Hi @DragonDanceGo, In general, MFXVideoENCODE_Reset should work with Temporal Layers feature. Returning error status “MFX_ERR_INVALID_VIDEO_PARAM” means that something is wrong with Encoding parameters set at all (maybe not related to Temporal Layers directly).

Below are several tips what should be tried/checked: First of all, presented programming of “mfxExtAvcTemporalLayers” like "{0,1,0,0,0,0,0,0}" or "{0,1,2,0,0,0,0,0}" or "{0,1,2,4,0,0,0,0}" is not correct – it should be "{1,0,0,0,0,0,0,0}" or "{1,2,0,0,0,0,0,0}" or "{1,2,4,0,0,0,0,0}". Also, inside the “Reset” function there is the same full-parameters-scope checking as originally in “Init” function, so need to check correctness for all Reset parameters. Then, better to clarify the reason/use-case of Reset calling – is it related to Temporal Layers setting change (ex: change number of layers) or just another encoding parameters (ex: resolution, bitrate, ..) – current information will be helpful. Also note: if application has called the Reset without IDR directly and actual Reset for the frame not in the Base Layer – returning error MFX_ERR_INVALID_VIDEO_PARAM is expected.

Thanks & Regards, Kristina

kovakimy commented 3 years ago

Hi @DragonDanceGo - If you still have any questions, please, let me know and reopen this ticket.

Thanks & Regards, Kristina