[FFmpeg-devel] [PATCH 11/17] avfilter/vf_scale: strip metadata when changing colorspace
Niklas Haas
ffmpeg at haasn.xyz
Thu Dec 5 13:47:41 EET 2024
On Thu, 05 Dec 2024 12:30:20 +0100 Niklas Haas <ffmpeg at haasn.xyz> wrote:
> From: Niklas Haas <git at haasn.dev>
>
> This is no longer relevant after a change in color space.
> ---
> libavfilter/vf_scale.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index e33617468a..a56d452c6c 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -868,6 +868,18 @@ scale:
> if (scale->out_transfer != AVCOL_TRC_UNSPECIFIED)
> out->color_trc = scale->out_transfer;
>
> + if (in->color_primaries != out->color_primaries ||
> + in->color_trc != out->color_trc)
> + {
> + av_frame_remove_side_data(out, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
> + av_frame_remove_side_data(out, AV_FRAME_DATA_DYNAMIC_HDR_PLUS);
> + av_frame_remove_side_data(out, AV_FRAME_DATA_DYNAMIC_HDR_VIVID);
> + av_frame_remove_side_data(out, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
> + av_frame_remove_side_data(out, AV_FRAME_DATA_ICC_PROFILE);
> + av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_METADATA);
> + av_frame_remove_side_data(out, AV_FRAME_DATA_DOVI_RPU_BUFFER);
> + }
> +
> av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den,
> (int64_t)in->sample_aspect_ratio.num * outlink->h * link->w,
> (int64_t)in->sample_aspect_ratio.den * outlink->w * link->h,
> --
> 2.47.0
>
I included this commit just for the sake of completeness / testing, but
ideally we would rebase it on top of this series:
https://ffmpeg.org//pipermail/ffmpeg-devel/2024-December/337053.html
More information about the ffmpeg-devel
mailing list