-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(amf): add max_au_size option to prevent FEC bypass on Wi-Fi #4926
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -472,6 +472,7 @@ namespace config { | |||||||||||
| (int) amd::quality_av1_e::balanced, // quality (av1) | ||||||||||||
| 0, // preanalysis | ||||||||||||
| 1, // vbaq | ||||||||||||
| {}, // max_au_size (disabled by default) | ||||||||||||
| (int) amd::coder_e::_auto, // coder | ||||||||||||
| }, // amd | ||||||||||||
|
|
||||||||||||
|
|
@@ -1129,6 +1130,7 @@ namespace config { | |||||||||||
| bool_f(vars, "amd_preanalysis", (bool &) video.amd.amd_preanalysis); | ||||||||||||
| bool_f(vars, "amd_vbaq", (bool &) video.amd.amd_vbaq); | ||||||||||||
| bool_f(vars, "amd_enforce_hrd", (bool &) video.amd.amd_enforce_hrd); | ||||||||||||
| int_f(vars, "amd_max_au_size", video.amd.amd_max_au_size); | ||||||||||||
|
||||||||||||
| int_f(vars, "amd_max_au_size", video.amd.amd_max_au_size); | |
| int_f(vars, "amd_max_au_size", video.amd.amd_max_au_size); | |
| if (video.amd.amd_max_au_size && *video.amd.amd_max_au_size <= 0) { | |
| video.amd.amd_max_au_size.reset(); | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -749,6 +749,7 @@ namespace video { | |||||||||||||||||||
| {"rc"s, &config::video.amd.amd_rc_av1}, | ||||||||||||||||||||
| {"usage"s, &config::video.amd.amd_usage_av1}, | ||||||||||||||||||||
| {"enforce_hrd"s, &config::video.amd.amd_enforce_hrd}, | ||||||||||||||||||||
| {"max_au_size"s, &config::video.amd.amd_max_au_size}, | ||||||||||||||||||||
|
||||||||||||||||||||
| {"max_au_size"s, &config::video.amd.amd_max_au_size}, |
Copilot
AI
Mar 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AMF "max_au_size" AVOption in FFmpeg for h264_amf/hevc_amf is specified in bits (and FFmpeg commonly uses -1 as the disable sentinel). The UI/docs describe this value as bytes and recommend 800000, which will be interpreted as ~100KB if passed through unchanged. Either convert bytes->bits before setting the codec option, or update the config/UI/docs to clearly use bits (and document the disable behavior).
| {"max_au_size"s, &config::video.amd.amd_max_au_size}, | |
| {"max_au_size"s, []() { | |
| // Config/UI use bytes; FFmpeg AMF option expects bits. Negative disables (maps to -1). | |
| const int value_bytes = config::video.amd.amd_max_au_size; | |
| if (value_bytes < 0) { | |
| return -1; | |
| } | |
| return value_bytes * 8; | |
| }}, |
Copilot
AI
Mar 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: the FFmpeg "max_au_size" option is in bits. Passing the config value through as-is while documenting bytes will lead to an incorrect cap. Consider converting bytes->bits (and treating 0/empty as unset) before setting this option.
| {"max_au_size"s, &config::video.amd.amd_max_au_size}, | |
| {"max_au_size"s, []() { | |
| const auto bytes = config::video.amd.amd_max_au_size; | |
| if (bytes <= 0) { | |
| return 0; | |
| } | |
| return bytes * 8; | |
| }}, |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -109,6 +109,8 @@ | |||||
| "amd_coder_desc": "Allows you to select the entropy encoding to prioritize quality or encoding speed. H.264 only.", | ||||||
| "amd_enforce_hrd": "AMF Hypothetical Reference Decoder (HRD) Enforcement", | ||||||
| "amd_enforce_hrd_desc": "Increases the constraints on rate control to meet HRD model requirements. This greatly reduces bitrate overflows, but may cause encoding artifacts or reduced quality on certain cards.", | ||||||
| "amd_max_au_size": "AMF Max AU Size", | ||||||
| "amd_max_au_size_desc": "Maximum encoded frame size in bytes (0 or empty = disabled). Caps the largest frame the encoder can produce, preventing oversized frames from exceeding FEC limits. Recommended value: 800000 for Wi-Fi streaming with CQP mode.", | ||||||
|
||||||
| "amd_max_au_size_desc": "Maximum encoded frame size in bytes (0 or empty = disabled). Caps the largest frame the encoder can produce, preventing oversized frames from exceeding FEC limits. Recommended value: 800000 for Wi-Fi streaming with CQP mode.", | |
| "amd_max_au_size_desc": "Maximum encoded frame size in bits for H.264/HEVC AMF encoders (0 or empty = disabled). Caps the largest frame the encoder can produce, preventing oversized frames from exceeding FEC limits. Recommended value: 6400000 bits (equivalent to 800000 bytes) for Wi-Fi streaming with CQP mode.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section documents the cap in bytes and implies it applies to all AMF codecs, but in FFmpeg the exposed "max_au_size" AVOption is for h264_amf/hevc_amf (in bits) and av1_amf doesn’t expose an equivalent option. Please update the docs to match the actual supported codecs and units, and clarify the default/disable behavior (e.g., unset vs 0 vs -1).