AMFComponent::Init Return AMF_FAIL On Rx5700
Hi, I'v Created a video Encoder ,that work perfectly on Rx 580. But not work on Rx5700. here are some of my main code: ' AMF_THROW_IF(g_AMFFactory.GetFactory()->CreateContext(&m_amfContext)); AMF_THROW_IF(m_amfContext->InitDX11(m_d3dRender->GetDevice())); AMF_THROW_IF(g_AMFFactory.GetFactory()->CreateComponent(m_amfContext, AMFVideoEncoderVCE_AVC, &m_amfEncoder)); m_amfEncoder->SetProperty(AMF_VIDEO_ENCODER_USAGE, AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY); m_amfEncoder->SetProperty(AMF_VIDEO_ENCODER_B_PIC_PATTERN, 0); m_amfEncoder->SetProperty(AMF_VIDEO_ENCODER_QUALITY_PRESET, AMF_VIDEO_ENCODER_QUALITY_PRESET_SPEED); m_amfEncoder->SetProperty(AMF_VIDEO_ENCODER_TARGET_BITRATE, 30*1000000); m_amfEncoder->SetProperty(AMF_VIDEO_ENCODER_FRAMESIZE, ::AMFConstructSize(width, height)); m_amfEncoder->SetProperty(AMF_VIDEO_ENCODER_FRAMERATE, ::AMFConstructRate(60, 1)); //here is the unexpected method //Return AMF_OK on Rx 580 //Return AMF_FAIL on Rx 5700 AMF_RESULT res = m_amfEncoder->Init(amf::AMF_SURFACE_RGBA, width, height); ' The Api document does not mentioned the Return code AMF_FAIL of the Init();
The code looks ok for me. Few things:
- what is resolution?
- which driver version do you use? Please try the latest.
- please send me AMF debug log.
- It would help if you can reproduce the issue by modifying SimpleEncoder sample and send the cpp file to me.
-
The resolution is 2880*1440
-
Driver version is latest 19.7.4
-
How & Where can I get the AMF Debug log
-
The SimpleEncoder Can be executed properly
Debug log is in the debug output if you run your app under Visual Studio debugger. Alternatively you can configure AMFTrace interface to write to a file. If the sample works, check your device creation code and compare with DeviceDX11.cpp from samples. Another thing: please check if any SetProperty call returns a error. There are many internal differences between 580 and 5700 , for example more rigorous parameter checking. To figure things out I need the AMF debug log.
I'v Checked the SetProperty
AMF_THROW_IF(m_amfEncoder->SetProperty(AMF_VIDEO_ENCODER_FRAMESIZE, ::AMFConstructSize(width, height))); //2880*1440, Return 1
Why can't I set this resolution
I need to see AMF log but probably because you have to set profile and level first.
Hi, here is the AMF log, Resolution 2560x1440. Ps. When I Use Resolution 1920x1080, that will Init Success I'v Got the MinMax Resolution, by GetInputCaps() [ServerLog] [info] WidthMin=112,WidthMax=4096,HeightMin=16, HeightMax=2176, When I Excute the SimpleEncoder ,And Define ENABLE_4K, I Got the same Error: 2019-08-06 17:31:13.034 558 [DriverParameterUVEH264Adapter] Error: ..........\runtime\src\components\EncoderUVE\DriverParameterUVEH264Adapter.cpp(308):AMF_ERROR 1 : AMF_FAIL: Failed to set UVEH264 param(2). err 0x80000002 ' 2019-08-05 13:38:26.633 4B08 [UVEEncoderTrace] Debug: InitUVE() created UVEH264 Encode using priority=1 2019-08-05 13:38:26.633 4B08 [AMFEncoderUVE] Info: SetProperty Profile:257 2019-08-05 13:38:26.633 4B08 [AMFEncoderUVE] Debug: AMFEncoderUVEH264Impl::SetParameter(Profile),257 2019-08-05 13:38:26.633 4B08 [AMFEncoderUVE] Info: SetProperty ProfileLevel:42 2019-08-05 13:38:26.633 4B08 [AMFEncoderUVE] Debug: AMFEncoderUVEH264Impl::SetParameter(ProfileLevel),42 2019-08-05 13:38:26.633 4B08 [AMFEncoderUVE] Info: SetProperty Usage:1 2019-08-05 13:38:26.633 4B08 [AMFEncoderUVE] Info: SetProperty BPicturesPattern:0 2019-08-05 13:38:26.633 4B08 [AMFEncoderUVE] Debug: AMFEncoderUVEH264Impl::SetParameter(BPicturesPattern),0 2019-08-05 13:38:26.633 4B08 [AMFEncoderUVE] Info: SetProperty QualityPreset:1 2019-08-05 13:38:26.633 4B08 [AMFEncoderUVE] Debug: AMFEncoderUVEH264Impl::SetParameter(QualityPreset),1 2019-08-05 13:38:26.633 4B08 [AMFEncoderUVE] Info: UVEH264ApplySpeedQualityPreset is 10 2019-08-05 13:38:26.634 4B08 [AMFEncoderUVE] Info: SetProperty TargetBitrate:30000000 2019-08-05 13:38:26.634 4B08 [AMFEncoderUVE] Debug: AMFEncoderUVEH264Impl::SetParameter(TargetBitrate),30000000 2019-08-05 13:38:26.634 4B08 [AMFEncoderUVE] Info: SetProperty FrameSize:2560,1440 2019-08-05 13:38:26.634 4B08 [AMFEncoderUVE] Debug: AMFEncoderUVEH264Impl::SetParameter(FrameSize),2560 2019-08-05 13:38:26.634 4B08 [DriverParameterUVEH264Adapter] Error: ..........\runtime\src\components\EncoderUVE\DriverParameterUVEH264Adapter.cpp(308):AMF_ERROR 1 : AMF_FAIL: Failed to set UVEH264 param(2). err 0x80000002 2019-08-05 13:38:26.634 4B08 [EncoderH264PropertySet] Debug: ~EncoderUVEH264PropertySet(): destroyed '
Hello, @MikhailAMD ,help!
Please try to set profile level to 5.1. Here is the the spec: https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC For your parameters number of macroblocks per second are calculated like this: (2560/16)*(1440/16)*60 = 864000 which matches level 5.1 The default level is 4.2
OK,Solved, Simply Change the level can not work, The property AMF_VIDEO_ENCODER_USAGE must locate befor AMF_VIDEO_ENCODER_PROFILE_LEVEL, that is confused.
Thanks for letting know. I will work with codec team to simplify this.