From b796d72eb2151e9cd4dfa98490f21f369ea20520 Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Sun, 8 Feb 2026 14:28:29 +0800 Subject: [PATCH] fftools/ffmpeg_filter: skip autoscale for hardware format This fix failure: ffmpeg -hwaccel cuda -hwaccel_output_format cuda \ -i The_Beauty_of_Earth-1.mp4 \ -vf scale_cuda=2880:1440 \ -c:v hevc_nvenc \ -pix_fmt cuda \ -b:v 8M -c:a copy \ -y test_scale.mp4 > Reconfiguring filter graph because hwaccel changed > Impossible to convert between the formats supported by the filter > 'Parsed_scale_cuda_0' and the filter 'auto_scale_0'. > Error reinitializing filters! Signed-off-by: Zhao Zhili --- fftools/ffmpeg_filter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index e8ae021cc0..eed0f06c6d 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1681,7 +1681,10 @@ static int configure_output_video_filter(FilterGraphPriv *fgp, AVFilterGraph *gr av_frame_side_data_remove(&ofp->side_data, &ofp->nb_side_data, AV_FRAME_DATA_DISPLAYMATRIX); } - if ((ofp->width || ofp->height) && (ofp->flags & OFILTER_FLAG_AUTOSCALE)) { + if ((ofp->width || ofp->height) && (ofp->flags & OFILTER_FLAG_AUTOSCALE) && + // skip add scale for hardware format + !(ofp->format != AV_PIX_FMT_NONE && + av_pix_fmt_desc_get(ofp->format)->flags & AV_PIX_FMT_FLAG_HWACCEL)) { char args[255]; AVFilterContext *filter; const AVDictionaryEntry *e = NULL;