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]: QVBR crashes (and the HQ* versions too) #528

Open
markg85 opened this issue Jan 26, 2025 · 15 comments
Open

[Bug]: QVBR crashes (and the HQ* versions too) #528

markg85 opened this issue Jan 26, 2025 · 15 comments
Labels

Comments

@markg85
Copy link

markg85 commented Jan 26, 2025

Describe the bug
Screen capture and streaming. Just playing with the hevc_amf encoder in ffmpeg.

To Reproduce
Steps to reproduce the behavior:
ffmpeg -framerate 60 -f x11grab -thread_queue_size 1024 -video_size 2560x1440 -i :0.0+0,0 -c:v hevc_amf -usage lowlatency_high_quality -quality quality -rc qvbr -qvbr_quality_level 28 -preanalysis 1 -log_to_dbg 1 -profile:v main10 -b:v 15M -pix_fmt nv12 -f_strict experimental -syncpoints none -f nut udp://10.0.3.55:5555

Adjust accordingly :)

Setup (please complete the following information):

  • OS: Archlinux
  • Driver Version: (i think.. how can i make sure) 1.4.35 because those headers are installed on my system, ffmpeg version is 7.1
  • GPU 7900 XT
  • Which component has the issue: AMF encoder

Debug Log (please upload or paste):

0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::SubmitInput() : format (NV12), memory (HOST), width (2560), height (1440)
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::SubmitInput() : format (NV12), memory (VULKAN), width (2560), height (1440)
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback taskId = 848.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback status = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isFirst = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isLast = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamoffset = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamSize = 320.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpEncrypted = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrHi = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrLo = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback fillerDataSize = 0.
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +2
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: QueryOutput() End: frame pts=847 outputFrames=848
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 0!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 2, Layer 0 update!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 7!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreHevc]   Debug: SetBufferProps: Picture Type:2 Temporal ID=0 @frame 848
0125-00-26 04:10:56 17FFF6C0 [EncodeQueuePalImpl]   Debug: *SubmitInput():jobID=850
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +13
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::SubmitInput() : format (NV12), memory (HOST), width (2560), height (1440)
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +1
0125-00-26 04:10:56 5F0266C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::SubmitInput() : format (NV12), memory (VULKAN), width (2560), height (1440)
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback taskId = 849.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback status = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isFirst = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isLast = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamoffset = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamSize = 787.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpEncrypted = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrHi = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrLo = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback fillerDataSize = 0.
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +2
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: QueryOutput() End: frame pts=848 outputFrames=849
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 0!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 2, Layer 0 update!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 7!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreHevc]   Debug: SetBufferProps: Picture Type:2 Temporal ID=0 @frame 849
0125-00-26 04:10:56 17FFF6C0 [EncodeQueuePalImpl]   Debug: *SubmitInput():jobID=851
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +11
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::SubmitInput() : format (NV12), memory (HOST), width (2560), height (1440)
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::SubmitInput() : format (NV12), memory (VULKAN), width (2560), height (1440)
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback taskId = 850.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback status = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isFirst = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isLast = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamoffset = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamSize = 638.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpEncrypted = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrHi = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrLo = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback fillerDataSize = 0.
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +3
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: QueryOutput() End: frame pts=849 outputFrames=850
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 0!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 2, Layer 0 update!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 7!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreHevc]   Debug: SetBufferProps: Picture Type:2 Temporal ID=0 @frame 850
0125-00-26 04:10:56 17FFF6C0 [EncodeQueuePalImpl]   Debug: *SubmitInput():jobID=852
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +13
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::SubmitInput() : format (NV12), memory (HOST), width (2560), height (1440)
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::SubmitInput() : format (NV12), memory (VULKAN), width (2560), height (1440)
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback taskId = 851.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback status = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isFirst = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isLast = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamoffset = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamSize = 806.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpEncrypted = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrHi = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrLo = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback fillerDataSize = 0.
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +2
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: QueryOutput() End: frame pts=850 outputFrames=851
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 0!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 2, Layer 0 update!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 7!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreHevc]   Debug: SetBufferProps: Picture Type:2 Temporal ID=0 @frame 851
0125-00-26 04:10:56 17FFF6C0 [EncodeQueuePalImpl]   Debug: *SubmitInput():jobID=853
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +11
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::SubmitInput() : format (NV12), memory (HOST), width (2560), height (1440)
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +1
0125-00-26 04:10:56 5F0266C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::SubmitInput() : format (NV12), memory (VULKAN), width (2560), height (1440)
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback taskId = 852.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback status = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isFirst = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isLast = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamoffset = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamSize = 1590.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpEncrypted = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrHi = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrLo = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback fillerDataSize = 0.
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +2
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: QueryOutput() End: frame pts=851 outputFrames=852
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 0!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 2, Layer 0 update!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 7!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreHevc]   Debug: SetBufferProps: Picture Type:2 Temporal ID=0 @frame 852
0125-00-26 04:10:56 17FFF6C0 [EncodeQueuePalImpl]   Debug: *SubmitInput():jobID=854
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +10
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::SubmitInput() : format (NV12), memory (HOST), width (2560), height (1440)
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::SubmitInput() : format (NV12), memory (VULKAN), width (2560), height (1440)
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback taskId = 853.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback status = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isFirst = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isLast = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamoffset = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamSize = 213.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpEncrypted = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrHi = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrLo = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback fillerDataSize = 0.
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +3
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: QueryOutput() End: frame pts=852 outputFrames=853
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 0!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 2, Layer 0 update!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreImpl]   Debug: ParamType 7!
0125-00-26 04:10:56 17FFF6C0 [AMFEncoderCoreHevc]   Debug: SetBufferProps: Picture Type:2 Temporal ID=0 @frame 853
0125-00-26 04:10:56 17FFF6C0 [EncodeQueuePalImpl]   Debug: *SubmitInput():jobID=855
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +13
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::SubmitInput() : format (NV12), memory (HOST), width (2560), height (1440)
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::SubmitInput() : format (NV12), memory (VULKAN), width (2560), height (1440)
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::QueryOutput()
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback taskId = 854.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback status = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isFirst = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback isLast = 1.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamoffset = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback bitstreamSize = 1486.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpEncrypted = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrHi = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback hdcpInputCtrLo = 0.
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: AMFEncoderCoreHevcImpl::GetBitStreamSize() - ECHEVCUVEReadFeedback fillerDataSize = 0.
0125-00-26 04:10:56 17FFF6C0 [AMFPreAnalysisImpl]   Debug: AMFPreAnalysisImpl::QueryOutput()
0125-00-26 04:10:56 5F0266C0 +2
0125-00-26 04:10:56 5F0266C0 [AMFEncoderCoreHevc]   Debug: QueryOutput() End: frame pts=853 outputFrames=854
corrupted size vs. prev_size
[1]    294827 IOT instruction (core dumped)  ffmpeg -framerate 60 -f x11grab -thread_queue_size 1024 -video_size 2560x1440

Expected behavior
Don't crash!

Oh and QVBR also sometimes gives me this:

malloc(): unsorted double linked list corruptede=00:00:05.91 bitrate=26372.6kbits/s speed=0.986x    
[1]    296200 IOT instruction (core dumped)  ffmpeg -framerate 60 -f x11grab -thread_queue_size 1024 -video_size 2560x1440

Additional context
I did add -preanalysis 1 as i read somewhere that this codec requires that. However, with or without that the encoding just crashes after a couple seconds. I also tried changing between main and main10 but that didn't change anything either.

Note that i'm using features that AMF itself advertises within ffmpeg to be options to use! Surely those should work?!

@markg85 markg85 added the bug label Jan 26, 2025
@MikhailAMD
Copy link
Collaborator

This sounds like known issue. The fix will be in upcoming driver. If you want a way-around, you will need to disable/minimize AMF tracing in FFmpeg code. I can point you to the code. Or you can get new AMF patches for FFmpeg where this logging is minimized by default: https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=13753

@markg85
Copy link
Author

markg85 commented Jan 27, 2025

Ohh, that's fresh! Just a couple days old (ffmpeg patches that is).

Ok, fine, i'll patch ffmpeg and see if i can get it running 🙂 I'll report back with my findings!

@markg85
Copy link
Author

markg85 commented Jan 27, 2025

Compile error.

CC	libavfilter/vf_sr_amf.o
In file included from libavfilter/avfilter_internal.h:31,
                 from libavfilter/vf_sr_amf.c:42:
libavfilter/vf_sr_amf.c:182:24: error: initialization of ‘int (*)(const AVFilterContext *, struct AVFilterFormatsConfig **, struct AVFilterFormatsConfig **)’ from incompatible pointer type ‘int (*)(AVFilterContext *)’ [-Wincompatible-pointer-types]
  182 |     FILTER_QUERY_FUNC2(&amf_filter_query_formats),
      |                        ^

GCC version, in case it matters:

❯ gcc --version
gcc (GCC) 14.2.1 20240910

@MikhailAMD
Copy link
Collaborator

Hmmmm... change it to:
FILTER_QUERY_FUNC(amf_filter_query_formats),

@markg85
Copy link
Author

markg85 commented Jan 27, 2025

So, that is in two files:
libavfilter/vf_vpp_amf.c
libavfilter/vf_sr_amf.c

Fixing that does make it compile a little further but... more errors await :)

❯ make
\CC	libavcodec/amfenc_av1.o
In file included from /usr/include/AMF/core/Data.h:37,
                 from /usr/include/AMF/core/Buffer.h:37,
                 from /usr/include/AMF/core/Context.h:37,
                 from /usr/include/AMF/core/Factory.h:40,
                 from libavcodec/amfenc.h:22,
                 from libavcodec/amfenc_av1.c:23:
libavcodec/amfenc_av1.c: In function ‘amf_encode_init_av1’:
libavcodec/amfenc_av1.c:467:57: error: ‘AMF_VIDEO_ENCODER_AV1_ADAPTIVE_MINIGOP’ undeclared (first use in this function); did you mean ‘AMF_VIDEO_ENCODER_ADAPTIVE_MINIGOP’?
  467 |             AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_ADAPTIVE_MINIGOP, ((ctx->pa_adaptive_mini_gop == 0) ? false : true));
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/amfenc_av1.c:467:57: note: each undeclared identifier is reported only once for each function it appears in
libavcodec/amfenc_av1.c:481:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  481 |     AMFVariantStruct    is_adaptive_b_frames = { 0 };
      |     ^~~~~~~~~~~~~~~~
libavcodec/amfenc_av1.c:490:66: error: ‘AMF_VIDEO_ENCODER_AV1_CAP_BFRAMES’ undeclared (first use in this function); did you mean ‘AMF_VIDEO_ENCODER_CAP_BFRAMES’?
  490 |             res = encoder_caps->pVtbl->GetProperty(encoder_caps, AMF_VIDEO_ENCODER_AV1_CAP_BFRAMES, &var);
      |                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                  AMF_VIDEO_ENCODER_CAP_BFRAMES
libavcodec/amfenc_av1.c:499:70: error: ‘AMF_VIDEO_ENCODER_AV1_MAX_CONSECUTIVE_BPICTURES’ undeclared (first use in this function); did you mean ‘AMF_VIDEO_ENCODER_MAX_CONSECUTIVE_BPICTURES’?
  499 |                         AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_MAX_CONSECUTIVE_BPICTURES, 3);
      |                                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/amfenc_av1.c:510:74: error: ‘AMF_VIDEO_ENCODER_AV1_B_PIC_PATTERN’ undeclared (first use in this function); did you mean ‘AMF_VIDEO_ENCODER_B_PIC_PATTERN’?
  510 |                             AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_B_PIC_PATTERN, ctx->max_b_frames);
      |                                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [ffbuild/common.mak:81: libavcodec/amfenc_av1.o] Error 1

Are you sure that amf-headers 1.4.35 include these constants?

❯ yay -Qs amf-headers
local/amf-headers 1.4.35-1
    Header files for AMD Advanced Media Framework

And when i grep through these headers:

❯ grep -Ri "ADAPTIVE_MINIGOP" *
components/VideoEncoderVCE.h:195:#define AMF_VIDEO_ENCODER_ADAPTIVE_MINIGOP                      L"AdaptiveMiniGOP"          // bool; default = false; Disable/Enable Adaptive MiniGOP

Which does lead me to think that the AMF headers you use are not the ones i use ;) (well.. that's unfair, lol)

@MikhailAMD
Copy link
Collaborator

You need to get the latest headers from this repo for these patches. Few parameters were published ahead of time but we didn't change version yet.
8f5a645

@markg85
Copy link
Author

markg85 commented Jan 27, 2025

I got it working! Thank you so much @MikhailAMD!

I'm just playing with a couple HEVC settings now and will report back in here if i find something crashing. I'm mostly just curious if i can find a suitable desktop streaming for low latency but high quality (bitrate is no concern as it's local).

I did thus far find one weird message. When playing with vbr_peak i get this message:

rate control mode is PEAK_CONSTRAINED_VBR but rc_max_rate is not set

rc_max_rate is not one of the options to even specify. Trying to specify it gives me Unrecognized option 'rc_max_rate'.

It's probably not the mode i'm after anyhow but i thought it'd be worth reporting it.

@MikhailAMD
Copy link
Collaborator

Thanks for letting know. The patch developer will update the patch. Not sure how it was compiled.
Regarding rate control: rc_max_rate is set by -maxrate. For PEAK_CONSTRAINED_VBR it should be higher than basic bitrate: 10-20%. If not set, AMF will select somewhat default.

@markg85
Copy link
Author

markg85 commented Jan 28, 2025

Hmm, couple observations.

  1. I do get this every time: [EncodeQueuePalImpl] Warning: EncodeQueueServicePalImpl::CreateEncodeQueue(): unsupported queue type 4 requested, fallback to queue type 2 Encoding still work.
  2. QVBR and HQVBR seem to be ignoring any rate option. For instance, i set -minrate 2M, -maxrate 8M and -b:v 5M but i still get insane bitrates like 300 mbit/sec.
  3. vbr_peak is a gem! It does adhere to the settings and looks rather nice!
  4. vbr_latency however... I just can't get a stable image out of that one. It's like the image is ok'ish for half a second, then pixalated for half a second. rinse and repeat.. Feels like a heartbeat effect.
  5. The -quality and -presetoptions are vague. Both havequality, balancedandspeedas options. And both have the exact same description of:Set the encoding quality preset (from -1 to 10) (default -1). I guess the whole -qualityshould go and-preset` was the intent here?
  6. A lot of options have (default auto) behind it... What is auto? For example the -aud option has this auto... It's a bool, so is it true or false by default.. ehh..
  7. Many encoders have, in the default ffmpeg logging settings, some summary to show you which encoding options where used in that encoding. AMF doesn't do this. It is available in AMF as you can see it zip by when you enable logging but that is just too much logging.

All of it is at the -usage lowlatency_high_quality and the main10 profile.

Should i now try AV1.. which last time froze my GPU requiring a reboot... 😛 Joking aside, i try desktop streaming and i need hardware acceleration on both ends for the lowest possible latency. Sadly my other side (AMD too) doesn't have hardware AV1 decoding.. so HEVC is probably my best option here.

In general i'm really happy with how it works right now! This begins to get usable for me, sweet! The only thing i really miss is a higher quality YUV. 4:2:0 is... meh.. for desktop purposes. 4:4:4 is best (well and 10 bit).

Edit
A note on the default auto and it not being helpful. I did went over nearly all of the HEVC AMF documentation in this repo and the default auto now does make sense. The docs are, in fact, very clear (my compliments)! I get that exposing the same - verbose - level probably wouldn't be looking great in the ffmpeg docs hence default auto. Hmm, not so sure.

@MikhailAMD
Copy link
Collaborator

Hi, rate control folks have trouble to reproduce vbr_latency issue and are asking for the the exact command line.

@markg85
Copy link
Author

markg85 commented Jan 30, 2025

Hmm, it's behavior is now different compared to when i wrote that. It's still weird though.

As i can't upload mkv files, i did it on this site: https://limewire.com/d/d55ebc38-5f99-42af-9114-5d9765247470#vOIDj3aFvoj43iAndxJPWn9SRUPMTUBQn_gtPZ8-nLM
Now it's every 5 seconds that the picture turns pixelated/bad/something happens.

The arguments i used for this (also in the video but text might be easier):

LD_LIBRARY_PATH=/home/mark/pkgbuilds/ffmpeg/upstream/build/lib \
./ffmpeg -hwaccel amf -hwaccel_device /dev/dri/renderD128 -init_hw_device amf=/dev/dri/renderD128 \
    -f x11grab -framerate 60 -max_delay 0 -max_probe_packets 1 -thread_queue_size 1024 -video_size 2560x1440 -r 60 -i :0.0+0,0 \
    -c:v hevc_amf \
    -usage lowlatency \
    -rc vbr_latency \
    -minrate 2M \
    -maxrate 15M \
    -quality quality \
    -preset quality \
    -vbaq 0 -enforce_hrd 0 -aud 0 -latency 0 -filler_data 0  \
    -profile:v main10 \
    -profile_tier high \
    -b:v 8M \
    -pix_fmt p010\
    -y -f matroska out.mkv

@MikhailAMD
Copy link
Collaborator

Thanks!

@markg85
Copy link
Author

markg85 commented Jan 30, 2025

high_quality has crash issues too.

Command:

LD_LIBRARY_PATH=/home/mark/pkgbuilds/ffmpeg/upstream/build/lib \
./ffmpeg -hwaccel amf -hwaccel_device /dev/dri/renderD128 -init_hw_device amf=/dev/dri/renderD128 \
    -f x11grab -framerate 60 -max_delay 0 -max_probe_packets 1 -thread_queue_size 1024 -video_size 2560x1440 -r 60 -i :0.0+0,0 \
    -c:v hevc_amf \
    -usage high_quality \
    -rc vbr_peak \
    -minrate 2M \
    -maxrate 15M \
    -quality quality \
    -preset quality \
    -header_insertion_mode 1 \
    -vbaq 0 -enforce_hrd 0 -aud 0 -latency 0 -filler_data 0  \
    -profile:v main10 \
    -profile_tier high \
    -b:v 8M \
    -pix_fmt p010\
    -f nut -muxdelay 0 udp://10.0.3.55:5555

error:

0125-00-30 21:43:36 3E5EC6C0 [AMFEncoderCoreImpl] Warning: PA has already been created!
0125-00-30 21:43:36 3E5EC6C0 [AMFEncoderCoreImpl]   Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreImpl.cpp(1381):Assertion failed:InitializePA() - format (P010) != AMF_SURFACE_NV12
0125-00-30 21:43:36 3E5EC6C0 [AMFEncoderCoreHevc]   Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreHevcImpl.cpp(1088):AMF_ERROR 4 : AMF_INVALID_ARG: Failed to initialize PA properly
0125-00-30 21:43:36 3E5EC6C0 [AMFEncoderCoreHevc]   Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreHevcImpl.cpp(1293):AMF_ERROR 4 : AMF_INVALID_ARG: InitInternal(): Failed to create Encoder!
0125-00-30 21:43:36 3E5EC6C0 [AMFEncoderCoreHevc]   Error: ../../../../../runtime/src/components/EncoderCore/EncoderCoreHevcImpl.cpp(470):AMF_ERROR 4 : AMF_INVALID_ARG: _Init() - Failed

Now i just changed the usage parameter (and added header_insertion_mode but that shouldn't matter).
I left all the other options the same, it works for literally all other usage options (yes, i tried) except high_quality.

@MikhailAMD
Copy link
Collaborator

This is different. high_quality tries to enable pre-analysis (PA) but is not supported for 10-bit HEVC which is forced by
-pix_fmt p010

@MikhailAMD
Copy link
Collaborator

Regarding pulsing with vbr_latency:
They say it is normal for this mode. The mode allows very little variations in frame-to-frame bitrate. What you have is small VBV buffer and every IDR-frame has very little budget for bits in this mode. So IDRs are encoded with low quality. One way to deal with this is to increase VBV, but it will not fully eliminate the issue and defeats the purpose of this mode. Another way is to set GOP size to 0 (-gop 0). This will disable IDR frames (except the first one) but then the streaming app will need to manually request IDR if a frame is lost in transmission or some other app joins the stream at the middle of streaming.

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

2 participants