Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: PAHighMotionQualityBoostMode=1 Now Breaks My Encoder [RX6950XT] #495

Open
LingWinny opened this issue Aug 22, 2024 · 38 comments
Open
Labels

Comments

@LingWinny
Copy link

LingWinny commented Aug 22, 2024

Describe the bug
As soon as I put PAHighMotionQualityBoostMode=1 in my lines (EnablePreAnalysis=true PASceneChangeDetectionEnable=false PAPerceptualAQMode=1 PATemporalAQMode=1 PACAQStrength=2 EnableVBAQ=false MaxNumRefFrames=3 BReferenceEnable=1 MaxConsecutiveBPictures=1 BPicturesPattern=1) it makes my whole PC lag. Cannot close obs64.exe I have to End Task.

I just want to note that earlier this year I was using PAHighMotionQualityBoostMode=1 with my other lines without issues and it was the best I could make H264 look.

To Reproduce
Steps to reproduce the behavior:

  1. Set the following properties 'CBR, 8000 Bitrate, Keyframe Int. 2, Preset Quality, Profile High, Max B-Frames 1
    AMF/FFmpeg options: EnablePreAnalysis=true PAHighMotionQualityBoostMode=1 PASceneChangeDetectionEnable=false PAPerceptualAQMode=1 PATemporalAQMode=1 PACAQStrength=2 EnableVBAQ=false MaxNumRefFrames=3 BReferenceEnable=1 MaxConsecutiveBPictures=1 BPicturesPattern=1'
  2. Start recording and notice how the preview lags and the whole PC isn't responsive.
  3. Submit input frame and see error

Setup (please complete the following information):

  • OS: [Windows 11]
  • Driver Version: [24.7.1]
  • GPU [RX 6950 XT]
  • Which component has the issue [H264]

Debug Log (please upload or paste):

No Data

Expected behavior
Expected a nice smooth stream as it was before.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@LingWinny LingWinny added the bug label Aug 22, 2024
@rhutsAMD
Copy link
Collaborator

Could you please provide the other settings used for your recording such as the resolution and framerate?

@LingWinny
Copy link
Author

LingWinny commented Aug 22, 2024 via email

@Ryu0833
Copy link

Ryu0833 commented Sep 8, 2024

PAHighMotionQualityBoostMode=1 it work only if you change the "PAEngineType" to dx11 or dx12 but well use more cpu i dont know why.
PAEngineType=1=>dx11
PAEngineType=4=>dx12

@LingWinny
Copy link
Author

LingWinny commented Sep 8, 2024 via email

@LingWinny
Copy link
Author

Update

PAEngineType=4 and PAHighMotionQualityBoostMode=1 works for desktop but as soon as you load into a game and record a test, it skips frames like crazy. Literally unusable.. Hopefully we can find a way to fix this because that would put AMD closer to NVIDIA in terms of encoding in H264.

AMF Settings:

EnablePreAnalysis=true PAEngineType=4 PAHighMotionQualityBoostMode=1 PASceneChangeDetectionEnable=false PAPerceptualAQMode=1 PATemporalAQMode=1 PACAQStrength=2 EnableVBAQ=false RateControlPreanalysisEnable=0 MaxNumRefFrames=4 BReferenceEnable=1 MaxConsecutiveBPictures=1 BPicturesPattern=1

OBS settings:

1664x936
60FPS
8000 Bitrate
Keyframe Int 2
Quality
High
Max B-Frames 1
Bicubic
NV12
Rec. 709
Full Color Range
Above Normal Priority

@Johl7
Copy link

Johl7 commented Sep 8, 2024

PAHighMotionQualityBoostMode=1 it work only if you change the "PAEngineType" to dx11 or dx12 but well use more cpu i dont know why. PAEngineType=1=>dx11 PAEngineType=4=>dx12

1=Host(uses cpu resources) 4=OpenCL

''Host(1)
DX11(3)
OpenCL(4)
Vulkan(10)
DX12(11)''

@LingWinny
Copy link
Author

LingWinny commented Sep 8, 2024 via email

@Johl7
Copy link

Johl7 commented Sep 8, 2024

Interesting, I'll play around with these PAEngineTypesOn Sep 8, 2024 2:53 p.m., Johl @.> wrote: PAHighMotionQualityBoostMode=1 it work only if you change the "PAEngineType" to dx11 or dx12 but well use more cpu i dont know why. PAEngineType=1=>dx11 PAEngineType=4=>dx12 1=host(uses cpu resources) 4=OpenCL ''Host(1) DX11(3) OpenCL(4) Vulkan(10) DX12(11)'' —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.>

tldr is tho, PAHMQB doesnt seem to be suitable for real time encoding, on past drivers it would only work if paired with lookahead, but 'recently' there was a change that made it to work(probably?) even without, and thats why it causes overloading issues now.

It might run well on RDNA3, i dunno, mines a 6650 XT.

@LingWinny
Copy link
Author

LingWinny commented Sep 8, 2024 via email

@LingWinny
Copy link
Author

Interesting, I'll play around with these PAEngineTypesOn Sep 8, 2024 2:53 p.m., Johl @.> wrote: PAHighMotionQualityBoostMode=1 it work only if you change the "PAEngineType" to dx11 or dx12 but well use more cpu i dont know why. PAEngineType=1=>dx11 PAEngineType=4=>dx12 1=host(uses cpu resources) 4=OpenCL ''Host(1) DX11(3) OpenCL(4) Vulkan(10) DX12(11)'' —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: _@**.**_>

tldr is tho, PAHMQB doesnt seem to be suitable for real time encoding, on past drivers it would only work if paired with lookahead, but 'recently' there was a change that made it to work(probably?) even without, and thats why it causes overloading issues now.

It might run well on RDNA3, i dunno, mines a 6650 XT.

what's more interesting is that I was running using PAHMQB without the Lookahead in 23.12.1 drivers and prior drivers without any problems and now yeah... impossible to do so. I have an RX6950XT

@Ryu0833
Copy link

Ryu0833 commented Sep 8, 2024

@LingWinny it been always working with Lookahead when lookahead=0 PAHMQP dont work

@LingWinny
Copy link
Author

LingWinny commented Sep 9, 2024 via email

@lextra2
Copy link

lextra2 commented Sep 10, 2024

PAHighMotionQualityBoostMode=1 it work only if you change the "PAEngineType" to dx11 or dx12 but well use more cpu i dont know why. PAEngineType=1=>dx11 PAEngineType=4=>dx12

Incorrect.
Here are the correct types

  • Host/CPU (1)
  • DX11 (3)
  • OpenCL (4)
  • Vulkan (10)
  • DX12 (11)

@LingWinny
You need to format your posts. They're unreadable.
The fact that PAHMQP worked without lookahead in previous drivers means it would auto-disable if you used it without.

While newer drivers most likely set a minimum amount of lookahead instead of the auto-disable.

@LingWinny
Copy link
Author

PAHighMotionQualityBoostMode=1 it work only if you change the "PAEngineType" to dx11 or dx12 but well use more cpu i dont know why. PAEngineType=1=>dx11 PAEngineType=4=>dx12

Incorrect. Here are the correct types

  • Host/CPU (1)
  • DX11 (3)
  • OpenCL (4)
  • Vulkan (10)
  • DX12 (11)

@LingWinny You need to format your posts. They're unreadable. The fact that PAHMQP worked without lookahead in previous drivers means it would auto-disable if you used it without.

While newer drivers most likely set a minimum amount of lookahead instead of the auto-disable.

Sorry, I will reply here instead of Email from now on.

@lextra2
It really worked before without lookahead, It's not placebo as I did throughout testing (talking weeks and even months) testing the H264 encoder from AMD. Lookahead always made things worst for the encoder in my case.

@lextra2
Copy link

lextra2 commented Sep 15, 2024

@lextra2 It really worked before without lookahead, It's not placebo as I did throughout testing (talking weeks and even months) testing the H264 encoder from AMD. Lookahead always made things worst for the encoder in my case.

Mhh, maybe motion estimation was set differently with 2023 driver if high motion quality mode was enabled?

Try
HalfPixel=false QuarterPixel=false EnablePreAnalysis=true PAEngineType=4 PASceneChangeDetectionEnable=false PALookAheadBufferDepth=11 PAHighMotionQualityBoostMode=1

@LingWinny
Copy link
Author

@lextra2 It really worked before without lookahead, It's not placebo as I did throughout testing (talking weeks and even months) testing the H264 encoder from AMD. Lookahead always made things worst for the encoder in my case.

Mhh, maybe motion estimation was set differently with 2023 driver if high motion quality mode was enabled?

Try HalfPixel=false QuarterPixel=false EnablePreAnalysis=true PAEngineType=4 PASceneChangeDetectionEnable=false PALookAheadBufferDepth=11 PAHighMotionQualityBoostMode=1

This is wayyyy blockier with those settings.

Here's the best settings I could've come up with in terms of quality with the newer drivers and I even tested without PA.

EnablePreAnalysis=true PAEngineType=4 PASceneChangeDetectionEnable=false PAPerceptualAQMode=1 PATemporalAQMode=1 PACAQStrength=2 EnableVBAQ=false RateControlPreanalysisEnable=0 MaxNumRefFrames=4 BReferenceEnable=1 MaxConsecutiveBPictures=1 BPicturesPattern=1

Unfortunately, doesn't work with PAHighMotionQualityBoostMode=1 anymore. I was using the settings shown above + PAHMQB before and it was really smooth looking. I'd say close to on par with NVIDIA's Pascal.

But it's the best AMD's H264 can do for now... which is pretty bad.. reminds me of the first NVIDIA's encoders in terms of quality which is pretty bad in 2024..

@Ryu0833
Copy link

Ryu0833 commented Sep 16, 2024

@LingWinny hello for your setting"EnablePreAnalysis=true PAEngineType=4 PASceneChangeDetectionEnable=false PAPerceptualAQMode=1 PATemporalAQMode=1 PACAQStrength=2 EnableVBAQ=false RateControlPreanalysisEnable=0 MaxNumRefFrames=4 BReferenceEnable=1 MaxConsecutiveBPictures=1 BPicturesPattern=1" there some point you wann to change for some commend to work

  1. PATemporalAQMode=1 it work with PALookAheadBufferDepth<0 (11=short 21=miduim 41=long), and when PATemporalAQMode=1 and using PAPerceptualAQMode=1 the PACAQStrength=2 well be ignored.when using them both or one of 'PAPerceptualAQMode=1 PATemporalAQMode=1',EnableVBAQ=false well be ignored. and PATemporalAQMode=1 it is suitable for non-gaming applications so it will hurt the performance, if you use it in gaming try PATemporalAQMode=2.

  2. EnableVBAQ=true work good when using rc=HQCBR,HQVBR,CQP when dont this rc EnableVBAQ=false it good for get the best quality.

  3. RateControlPreanalysisEnable=0 yes it have good impact on performance maybe low in video quality but is not noticeable

*my suggestion is :

  1. without using "PreAnalysis":
    RateControlPreanalysisEnable=0 EnableVBAQ=false BPicturesPattern=1(try 2) HighMotionQualityBoostEnable=true(optional)

  2. if you want using "PreAnalysis" remember it will hurt performance:
    A) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PAPerceptualAQMode=1 PACAQStrength=0(or1) AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false

B) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PALookAheadBufferDepth=20
PATemporalAQMode=2 AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false

C) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PALookAheadBufferDepth=20
PATemporalAQMode=2 PAPerceptualAQMode=1 AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false

try and choose the setting give you the best video quality
for PAHighMotionQualityBoostMode=1 it still bug the encoder. thare is HighMotionQualityBoostEnable it work fin and good with Bframes and not good "PreAnalysis"

i hope it helps you get the best video quality

@LingWinny
Copy link
Author

@LingWinny hello for your setting"EnablePreAnalysis=true PAEngineType=4 PASceneChangeDetectionEnable=false PAPerceptualAQMode=1 PATemporalAQMode=1 PACAQStrength=2 EnableVBAQ=false RateControlPreanalysisEnable=0 MaxNumRefFrames=4 BReferenceEnable=1 MaxConsecutiveBPictures=1 BPicturesPattern=1" there some point you wann to change for some commend to work

  1. PATemporalAQMode=1 it work with PALookAheadBufferDepth<0 (11=short 21=miduim 41=long), and when PATemporalAQMode=1 and using PAPerceptualAQMode=1 the PACAQStrength=2 well be ignored.when using them both or one of 'PAPerceptualAQMode=1 PATemporalAQMode=1',EnableVBAQ=false well be ignored. and PATemporalAQMode=1 it is suitable for non-gaming applications so it will hurt the performance, if you use it in gaming try PATemporalAQMode=2.
  2. EnableVBAQ=true work good when using rc=HQCBR,HQVBR,CQP when dont this rc EnableVBAQ=false it good for get the best quality.
  3. RateControlPreanalysisEnable=0 yes it have good impact on performance maybe low in video quality but is not noticeable

*my suggestion is :

  1. without using "PreAnalysis":
    RateControlPreanalysisEnable=0 EnableVBAQ=false BPicturesPattern=1(try 2) HighMotionQualityBoostEnable=true(optional)
  2. if you want using "PreAnalysis" remember it will hurt performance:
    A) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PAPerceptualAQMode=1 PACAQStrength=0(or1) AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false

B) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PALookAheadBufferDepth=20 PATemporalAQMode=2 AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false

C) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PALookAheadBufferDepth=20 PATemporalAQMode=2 PAPerceptualAQMode=1 AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false

try and choose the setting give you the best video quality for PAHighMotionQualityBoostMode=1 it still bug the encoder. thare is HighMotionQualityBoostEnable it work fin and good with Bframes and not good "PreAnalysis"

i hope it helps you get the best video quality

My streaming is very fast paced.. Without PA it just cannot keep up. I have tested these for months now. My settings were the best I could do. PATemporalAQMode=1-2 PAPerceptualAQMode=1 PACAQStrength=0-1 are the only ones that may seem placebo to me. AdaptiveMiniGOP=true hurts the quality.

Thank you for the infos though !

@lextra2
Copy link

lextra2 commented Sep 17, 2024

@Ryu0833

EnableVBAQ=true work good when using rc=HQCBR,HQVBR,CQP when dont this rc EnableVBAQ=false it good for get the best quality.

AMF_PA_PAQ_MODE and AMF_PA_TAQ_MODE cannot work with VBAQ (AMF_VIDEO_ENCODER_ENABLE_VBAQ) features. When AMF_PA_PAQ_MODE or AMF_PA_TAQ_MODE is enabled, VBAQ settings are ignored.

Source

"HQ" presets use AMF_PA_TAQ_MODE_2 and therefore vbaq will do nothing in those presets

@LingWinny
Copy link
Author

@LingWinny hello for your setting"EnablePreAnalysis=true PAEngineType=4 PASceneChangeDetectionEnable=false PAPerceptualAQMode=1 PATemporalAQMode=1 PACAQStrength=2 EnableVBAQ=false RateControlPreanalysisEnable=0 MaxNumRefFrames=4 BReferenceEnable=1 MaxConsecutiveBPictures=1 BPicturesPattern=1" there some point you wann to change for some commend to work

  1. PATemporalAQMode=1 it work with PALookAheadBufferDepth<0 (11=short 21=miduim 41=long), and when PATemporalAQMode=1 and using PAPerceptualAQMode=1 the PACAQStrength=2 well be ignored.when using them both or one of 'PAPerceptualAQMode=1 PATemporalAQMode=1',EnableVBAQ=false well be ignored. and PATemporalAQMode=1 it is suitable for non-gaming applications so it will hurt the performance, if you use it in gaming try PATemporalAQMode=2.
  2. EnableVBAQ=true work good when using rc=HQCBR,HQVBR,CQP when dont this rc EnableVBAQ=false it good for get the best quality.
  3. RateControlPreanalysisEnable=0 yes it have good impact on performance maybe low in video quality but is not noticeable

*my suggestion is :

  1. without using "PreAnalysis":
    RateControlPreanalysisEnable=0 EnableVBAQ=false BPicturesPattern=1(try 2) HighMotionQualityBoostEnable=true(optional)
  2. if you want using "PreAnalysis" remember it will hurt performance:
    A) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PAPerceptualAQMode=1 PACAQStrength=0(or1) AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false

B) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PALookAheadBufferDepth=20 PATemporalAQMode=2 AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false

C) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PALookAheadBufferDepth=20 PATemporalAQMode=2 PAPerceptualAQMode=1 AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false

try and choose the setting give you the best video quality for PAHighMotionQualityBoostMode=1 it still bug the encoder. thare is HighMotionQualityBoostEnable it work fin and good with Bframes and not good "PreAnalysis"

i hope it helps you get the best video quality

After testing PAQ=0-1 TAQ=0-1-2 PACAQ=0-1-2 in every combination I could. My settings were still better looking for what I do. Thanks anyways !

@Ryu0833
Copy link

Ryu0833 commented Sep 17, 2024

@LingWinny hello for your setting"EnablePreAnalysis=true PAEngineType=4 PASceneChangeDetectionEnable=false PAPerceptualAQMode=1 PATemporalAQMode=1 PACAQStrength=2 EnableVBAQ=false RateControlPreanalysisEnable=0 MaxNumRefFrames=4 BReferenceEnable=1 MaxConsecutiveBPictures=1 BPicturesPattern=1" there some point you wann to change for some commend to work

  1. PATemporalAQMode=1 it work with PALookAheadBufferDepth<0 (11=short 21=miduim 41=long), and when PATemporalAQMode=1 and using PAPerceptualAQMode=1 the PACAQStrength=2 well be ignored.when using them both or one of 'PAPerceptualAQMode=1 PATemporalAQMode=1',EnableVBAQ=false well be ignored. and PATemporalAQMode=1 it is suitable for non-gaming applications so it will hurt the performance, if you use it in gaming try PATemporalAQMode=2.
  2. EnableVBAQ=true work good when using rc=HQCBR,HQVBR,CQP when dont this rc EnableVBAQ=false it good for get the best quality.
  3. RateControlPreanalysisEnable=0 yes it have good impact on performance maybe low in video quality but is not noticeable

*my suggestion is :

  1. without using "PreAnalysis":
    RateControlPreanalysisEnable=0 EnableVBAQ=false BPicturesPattern=1(try 2) HighMotionQualityBoostEnable=true(optional)
  2. if you want using "PreAnalysis" remember it will hurt performance:
    A) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PAPerceptualAQMode=1 PACAQStrength=0(or1) AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false

B) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PALookAheadBufferDepth=20 PATemporalAQMode=2 AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false
C) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PALookAheadBufferDepth=20 PATemporalAQMode=2 PAPerceptualAQMode=1 AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false
try and choose the setting give you the best video quality for PAHighMotionQualityBoostMode=1 it still bug the encoder. thare is HighMotionQualityBoostEnable it work fin and good with Bframes and not good "PreAnalysis"
i hope it helps you get the best video quality

After testing PAQ=0-1 TAQ=0-1-2 PACAQ=0-1-2 in every combination I could. My settings were still better looking for what I do. Thanks anyways !

for my streaming the best settings after many test was without PreAnalysis:
RateControlPreanalysisEnable=0 EnableVBAQ=false EnforceHRD=true FillerDataEnable=true
PreAnalysis need more gpu power in the encoder and i did have alot of drop fps when enable but for you try every combination test
now am test MinQP=value from (20-23) and have good stream for now

image

image
In the following parameter settings, both the "vbaq" and "pa_taq_mode" parameters are set. However, because "pa_taq_mode" has a higher priority than "vbaq" when "pa_taq_mode" is set to 1 or 2, "vbaq" is ignored. The two command lines below have the same effect in the encoder.

and try use this to Help you understand the priorities if you want more info vist this wiki:https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki/AMF%20Encoder%20Settings%20and%20Tuning%20in%20FFmpeg

@Ryu0833
Copy link

Ryu0833 commented Sep 17, 2024

@Ryu0833

EnableVBAQ=true work good when using rc=HQCBR,HQVBR,CQP when dont this rc EnableVBAQ=false it good for get the best quality.

AMF_PA_PAQ_MODE and AMF_PA_TAQ_MODE cannot work with VBAQ (AMF_VIDEO_ENCODER_ENABLE_VBAQ) features. When AMF_PA_PAQ_MODE or AMF_PA_TAQ_MODE is enabled, VBAQ settings are ignored.

Source

"HQ" presets use AMF_PA_TAQ_MODE_2 and therefore vbaq will do nothing in those presets

"HQ" presets use EnablePreAnalysis=true
AMF_PA_TAQ_MODE_2 work only in rc=CBR,VBR

@LingWinny
Copy link
Author

@Ryu0833

EnableVBAQ=true work good when using rc=HQCBR,HQVBR,CQP when dont this rc EnableVBAQ=false it good for get the best quality.

AMF_PA_PAQ_MODE and AMF_PA_TAQ_MODE cannot work with VBAQ (AMF_VIDEO_ENCODER_ENABLE_VBAQ) features. When AMF_PA_PAQ_MODE or AMF_PA_TAQ_MODE is enabled, VBAQ settings are ignored.

Source
"HQ" presets use AMF_PA_TAQ_MODE_2 and therefore vbaq will do nothing in those presets

"HQ" presets use EnablePreAnalysis=true AMF_PA_TAQ_MODE_2 work only in rc=CBR,VBR

We're talking about streaming here, so CBR only.

@LingWinny
Copy link
Author

@LingWinny hello for your setting"EnablePreAnalysis=true PAEngineType=4 PASceneChangeDetectionEnable=false PAPerceptualAQMode=1 PATemporalAQMode=1 PACAQStrength=2 EnableVBAQ=false RateControlPreanalysisEnable=0 MaxNumRefFrames=4 BReferenceEnable=1 MaxConsecutiveBPictures=1 BPicturesPattern=1" there some point you wann to change for some commend to work

  1. PATemporalAQMode=1 it work with PALookAheadBufferDepth<0 (11=short 21=miduim 41=long), and when PATemporalAQMode=1 and using PAPerceptualAQMode=1 the PACAQStrength=2 well be ignored.when using them both or one of 'PAPerceptualAQMode=1 PATemporalAQMode=1',EnableVBAQ=false well be ignored. and PATemporalAQMode=1 it is suitable for non-gaming applications so it will hurt the performance, if you use it in gaming try PATemporalAQMode=2.
  2. EnableVBAQ=true work good when using rc=HQCBR,HQVBR,CQP when dont this rc EnableVBAQ=false it good for get the best quality.
  3. RateControlPreanalysisEnable=0 yes it have good impact on performance maybe low in video quality but is not noticeable

*my suggestion is :

  1. without using "PreAnalysis":
    RateControlPreanalysisEnable=0 EnableVBAQ=false BPicturesPattern=1(try 2) HighMotionQualityBoostEnable=true(optional)
  2. if you want using "PreAnalysis" remember it will hurt performance:
    A) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PAPerceptualAQMode=1 PACAQStrength=0(or1) AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false

B) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PALookAheadBufferDepth=20 PATemporalAQMode=2 AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false
C) RateControlPreanalysisEnable=0 EnablePreAnalysis=true PAEngineType=4 PALookAheadBufferDepth=20 PATemporalAQMode=2 PAPerceptualAQMode=1 AdaptiveMiniGOP=true MaxConsecutiveBPictures=2(try 3 if dont have problem use it) PASceneChangeDetectionSensitivity=false
try and choose the setting give you the best video quality for PAHighMotionQualityBoostMode=1 it still bug the encoder. thare is HighMotionQualityBoostEnable it work fin and good with Bframes and not good "PreAnalysis"
i hope it helps you get the best video quality

After testing PAQ=0-1 TAQ=0-1-2 PACAQ=0-1-2 in every combination I could. My settings were still better looking for what I do. Thanks anyways !

for my streaming the best settings after many test was without PreAnalysis: RateControlPreanalysisEnable=0 EnableVBAQ=false EnforceHRD=true FillerDataEnable=true PreAnalysis need more gpu power in the encoder and i did have alot of drop fps when enable but for you try every combination test now am test MinQP=value from (20-23) and have good stream for now

image

image In the following parameter settings, both the "vbaq" and "pa_taq_mode" parameters are set. However, because "pa_taq_mode" has a higher priority than "vbaq" when "pa_taq_mode" is set to 1 or 2, "vbaq" is ignored. The two command lines below have the same effect in the encoder.

and try use this to Help you understand the priorities if you want more info vist this wiki:https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki/AMF%20Encoder%20Settings%20and%20Tuning%20in%20FFmpeg

Those settings were not as good.. not even close unfortunately. Also, EnforceHRD=true FillerDataEnable=true are already set to true by default when you use CBR (which you HAVE to if you're streaming).

@LingWinny
Copy link
Author

LingWinny commented Sep 17, 2024

UPDATE
These are still the best until AMD fixes PAHMQB:

EnablePreAnalysis=true PAEngineType=4 PASceneChangeDetectionEnable=false PAPerceptualAQMode=1 PATemporalAQMode=1 PACAQStrength=2 EnableVBAQ=false RateControlPreanalysisEnable=0 MaxNumRefFrames=4 BReferenceEnable=1 MaxConsecutiveBPictures=1 BPicturesPattern=1

I don't have drops in frames compared to yours. My 6950XT handles PA just fine. Sorry if your system is struggling. Tested all my evening but still back to the start! We'll just have to wait for AMD to fix PAHMQB. As [rhutsAMD] said, it is broken.

Just edited this to add that I'm not using useless lines of code here. Made sure to not write something that was already off or on by default.

@lextra2
Copy link

lextra2 commented Sep 17, 2024

@Ryu0833

AMF_PA_TAQ_MODE_2 work only in rc=CBR,VBR

Incorrect. HQcbr & HQvbr are "HQ" presets and therefore use AMF_PA_TAQ_MODE_2 by default.

@LingWinny
Copy link
Author

LingWinny commented Sep 17, 2024

@Ryu0833

AMF_PA_TAQ_MODE_2 work only in rc=CBR,VBR

Incorrect. HQcbr & HQvbr are "HQ" presets and therefore use AMF_PA_TAQ_MODE_2 by default.

@LingWinny

We're talking about streaming here, so CBR only.

Yeah. No shit. HQcbr is for streaming.

Don't reply my name, I wasn't talking to you. I know YOU knew what we were talking about but Ryu was way off here. Don't no shit me.

@lextra2
Copy link

lextra2 commented Sep 17, 2024

Don't reply my name, I wasn't talking to you

My bad. GitHubs quoting is just terrible.

@LingWinny
Copy link
Author

Don't reply my name, I wasn't talking to you

My bad. GitHubs quoting is just terrible.

no worries mate !

@lextra2
Copy link

lextra2 commented Sep 25, 2024

@LingWinny
Have you tried MaxConsecutiveBPictures=0 ?
I have found this bug, maybe the same is true for PAHighMotionQualityBoostMode ?

@LingWinny
Copy link
Author

@LingWinny Have you tried MaxConsecutiveBPictures=0 ? I have found this bug, maybe the same is true for PAHighMotionQualityBoostMode ?

Interesting.. I'll give it a try once I find some time and I'll update y'all with what happens !

@LingWinny
Copy link
Author

@LingWinny Have you tried MaxConsecutiveBPictures=0 ? I have found this bug, maybe the same is true for PAHighMotionQualityBoostMode ?

It works..? PAEngineType=4 is a must otherwise it will overload the encoder

@lextra2
Copy link

lextra2 commented Sep 26, 2024

Nice to hear ;)

@lextra2
Copy link

lextra2 commented Sep 26, 2024

PAEngineType=4 is a must otherwise it will overload the encoder

Try InputQueueSize=32 (not sure if it works in OBS)

The docs say this under AMF_VIDEO_ENCODER_INPUT_QUEUE_SIZE

Max Value: 32
Default Value: 16
Set encoder input queue size. For high-resolution sequence, recommend to set a smaller value to save storage. For low-resolution sequence, recommend to set a larger value to improve encoding speed.

For CBR with filler data enabled, size obviously doesn't matter, since it is constant.

@LingWinny
Copy link
Author

PAEngineType=4 is a must otherwise it will overload the encoder

Try InputQueueSize=32 (not sure if it works in OBS)

The docs say this under AMF_VIDEO_ENCODER_INPUT_QUEUE_SIZE

Max Value: 32
Default Value: 16
Set encoder input queue size. For high-resolution sequence, recommend to set a smaller value to save storage. For low-resolution sequence, recommend to set a larger value to improve encoding speed.

For CBR with filler data enabled, size obviously doesn't matter, since it is constant.

I'll test this too, thanks !

@rhutsAMD
Copy link
Collaborator

PAHMQB improves the visual quality of the image but takes high amount of GPU resources and is known to throttle performance significantly. In the original issue comment, it seems the user is trying to record a video at 60 FPS in OBS. According to internal tests, enabling PAHMQB gives an encoder output FPS of 16-20. Since OBS is a real time application, it will record at the pre-set FPS (60 in this case) and hence we see a lag since the encoder cannot produce frames at 60 FPS.

Having said the above, PAHMQB does not cause any corruption in the video. It leads to frames drops in the output bitstream recorded with OBS because of the difference in encoder speed and the output recording frame rate set in OBS.

  • To clarify when PAHMQB is enabled:
  • For previous drivers (earlier than 24.1.1), PAHMQB=1 does not enable PAHMQB if PALookAheadBufferDepth is not set.
  • In newer drivers. (24.1.1 and later), PAHMQB=1 + does enable PAHMQB if PALookAheadBufferDepth is not set.

@LingWinny
Copy link
Author

PAHMQB improves the visual quality of the image but takes high amount of GPU resources and is known to throttle performance significantly. In the original issue comment, it seems the user is trying to record a video at 60 FPS in OBS. According to internal tests, enabling PAHMQB gives an encoder output FPS of 16-20. Since OBS is a real time application, it will record at the pre-set FPS (60 in this case) and hence we see a lag since the encoder cannot produce frames at 60 FPS.

Having said the above, PAHMQB does not cause any corruption in the video. It leads to frames drops in the output bitstream recorded with OBS because of the difference in encoder speed and the output recording frame rate set in OBS.

  • To clarify when PAHMQB is enabled:
  • For previous drivers (earlier than 24.1.1), PAHMQB=1 does not enable PAHMQB if PALookAheadBufferDepth is not set.
  • In newer drivers. (24.1.1 and later), PAHMQB=1 + does enable PAHMQB if PALookAheadBufferDepth is not set.

Well, is there a way to optimize it's performance and to try and compete with the other manufacturer's encoders ? I'm willing to put the time to help you guys because I really want to love AMD but man... H264 looks so much worst than the competitor's..

@rhutsAMD
Copy link
Collaborator

rhutsAMD commented Nov 1, 2024

PAHMQB improves image quality at the cost of extensive computation. This encoding feature is suitable for certain offline encoding applications that can tolerate significant time costs, but it is not suitable for applications like OBS, which have strict real-time frame rate requirements.

We are continuously improving the video quality of the H.264 encoder. Please stay tuned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants