Opened 5 months ago

Last modified 5 months ago

#10993 new defect

"-sws_flags" ignored in "-lavfi" ("-filter_complex")

Reported by: MasterQuestionable Owned by:
Priority: important Component: avfilter
Version: git-master Keywords: sws_flags lavfi filter_complex
Cc: MasterQuestionable Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by MasterQuestionable)

͏    E.g.
("-lavfi" vs. "-vf")
͏    ffmpeg -v debug -hide_banner -nostdin -nostats -i "W020170309545700291313.jpg" -lavfi "scale=iw/2:-2" -sws_flags gauss+accurate_rnd+print_info -compression_level 1 -pred none "scale.lavfi.png"
͏    ffmpeg -v debug -hide_banner -nostdin -nostats -i "W020170309545700291313.jpg" -vf "scale=iw/2:-2" -sws_flags gauss+accurate_rnd+print_info -compression_level 1 -pred none "scale.vf.png"

͏    https://web.archive.org/web/20230512231916/http://www.nlc.cn/newgtkj/tssc/mzyj/201703/W020170309545700291313.jpg

͏    See also:
͏    https://stackoverflow.com/questions/55193264#55193912
͏    https://trac.ffmpeg.org/wiki/Scaling

Change History (2)

comment:1 by Gyan, 5 months ago

For complex filtergraphs, add sws_flags=args; right at the beginning of the graph, e.g.

sws_flags=bicubic;[1:v]trim=50,scale=640:360,...

comment:2 by MasterQuestionable, 5 months ago

Description: modified (diff)

͏    Thanks for mentioning.

͏    ----

͏    Matters most:
͏    ffmpeg -v debug -hide_banner -nostdin -nostats -i "W020170309545700135684.jpg" -i "W020170309545700291313.jpg" -lavfi "hstack,format=rgb24" -sws_flags gauss+accurate_rnd+print_info -lossless 1 -q 100 -compression_level 6 "gauss-full_chroma_int.webp"

͏    Per the doc "format" doesn't support "flags":
͏    https://ffmpeg.org/ffmpeg-filters.html#format

͏    Hacky workaround required:
͏    ffmpeg -v debug -hide_banner -nostdin -nostats -i "W020170309545700135684.jpg" -i "W020170309545700291313.jpg" -lavfi "sws_flags=gauss+accurate_rnd+print_info; hstack,format=rgb24" -lossless 1 -q 100 -compression_level 6 "gauss-full_chroma_int.webp"
͏    (per [ https://ffmpeg.org/ffmpeg-filters.html#Filtergraph-syntax ])

͏    And there seems to be no solution for "-sws_dither", "-param0", "-param1": which may matter at times.

Last edited 5 months ago by MasterQuestionable (previous) (diff)
Note: See TracTickets for help on using tickets.