On Mon, 25 Mar 2024 16:02:23 +0100 Niklas Haas <ffm...@haasn.xyz> wrote: > On Mon, 25 Mar 2024 15:36:26 +0100 Damiano Galassi <dam...@gmail.com> wrote: > > On Mon, Mar 25, 2024 at 2:40 PM Niklas Haas <ffm...@haasn.xyz> wrote: > > > > > > ffmpeg -i in.mp4 -vf > > > > "scale='width=1920:height=1080',zscale='width=1920:height=1080'" out.mp4 > > > > ffmpeg -i in.jpg -vf "zscale='width=1920:height=1080'" out.jpg > > > > > > > > it doesn't need a specific mp4 or jpg file. > > > > > > I cannot reproduce any error with your first command line. > > > > > > here's a sample file, and the output I get: > > > > https://subler.org/downloads/test.mp4 > > https://gist.github.com/galad87/a6ddc3318cf20cd2f1ac7d053e1a0786 > > Okay, I see the problem. Basically, swap_color_spaces() doesn't re-run > after pick_formats() settles a filter's format. So swap_color_spaces() > never actually sets zscale's preferred output format, because at that > point there are still multiple options for swscale's output format. > > This patch appears to help, but I'm honestly not sure what exactly the > difference is between this REDUCE_FORMATS() and swap_color_spaces(), or > actually, for what case the latter even exists.
I *think* that the former is intended for picking an exact match, whereas the latter is intended for picking the *best* remaining match (where bestness can be meaningfully measured by some score) So based on this, given that csp/range is only concerned with exact matches, after the suggest patch we can just delete swap_color_spaces() and swap_color_ranges(). Good riddance, too. > > diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c > index bb5399c55e8..3b8f7464889 100644 > --- a/libavfilter/avfiltergraph.c > +++ b/libavfilter/avfiltergraph.c > @@ -794,6 +794,10 @@ static int reduce_formats_on_filter(AVFilterContext > *filter) > nb_formats, ff_add_format); > REDUCE_FORMATS(int, AVFilterFormats, samplerates, > formats, > nb_formats, ff_add_format); > + REDUCE_FORMATS(int, AVFilterFormats, color_spaces, > formats, > + nb_formats, ff_add_format); > + REDUCE_FORMATS(int, AVFilterFormats, color_ranges, > formats, > + nb_formats, ff_add_format); > > /* reduce channel layouts */ > for (i = 0; i < filter->nb_inputs; i++) { _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".