[FFmpeg-devel] [PATCH v3 7/8] avfilter/vf_scale: tag output color space

Niklas Haas ffmpeg at haasn.xyz
Tue Oct 31 16:54:49 EET 2023


From: Niklas Haas <git at haasn.dev>

When using vf_scale to force a specific output color space, also tag
this on the AVFrame. (Mirroring existing logic for output range)
---
 libavfilter/vf_scale.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index fb8e6a2b76..3ec080693c 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -857,6 +857,9 @@ scale:
                                      brightness, contrast, saturation);
 
         out->color_range = out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
+        if (scale->out_color_matrix >= 0 &&
+            scale->out_color_matrix != AVCOL_SPC_UNSPECIFIED)
+            out->colorspace = scale->out_color_matrix;
     }
 
     av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den,
-- 
2.42.0



More information about the ffmpeg-devel mailing list