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 <quinkblack@foxmail.com>
This commit is contained in:
Zhao Zhili
2026-02-08 14:28:29 +08:00
committed by Zhao Zhili
parent a85a8e6757
commit b796d72eb2

View File

@@ -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;