fix(avhw): specify format=nv12 output for scale_vaapi filter
scale_vaapi defaults to the input sw_format (RGBZ) when no output format is specified. h264_vaapi encoder only supports NV12/YUV formats. Adding format=nv12 ensures the filter outputs the correct color format for hardware encoding.
This commit is contained in:
@@ -518,7 +518,11 @@ fn build_filter_graph(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// scale_vaapi: hardware scaling and colourspace conversion (keeps original dimensions)
|
// scale_vaapi: hardware scaling and colourspace conversion (keeps original dimensions)
|
||||||
let mut scale_ctx = graph.add(&scale_vaapi, "scale", &format!("{width}:{height}"))?;
|
let mut scale_ctx = graph.add(
|
||||||
|
&scale_vaapi,
|
||||||
|
"scale",
|
||||||
|
&format!("{width}:{height}:format=nv12"),
|
||||||
|
)?;
|
||||||
// SAFETY: scale_vaapi needs hw_device_ctx for VAAPI device access.
|
// SAFETY: scale_vaapi needs hw_device_ctx for VAAPI device access.
|
||||||
unsafe {
|
unsafe {
|
||||||
(*scale_ctx.as_mut_ptr()).hw_device_ctx = hw_dev.ref_clone();
|
(*scale_ctx.as_mut_ptr()).hw_device_ctx = hw_dev.ref_clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user