Coder Social home page Coder Social logo

Comments (7)

kasper93 avatar kasper93 commented on September 23, 2024

@haasn

from mpv.

sfan5 avatar sfan5 commented on September 23, 2024

it's FFmpeg/FFmpeg@bb80445
mpv rejects filters with more than one in-/output for use with --vf:

mpv/filters/f_lavfi.c

Lines 980 to 997 in a26bbbd

// Does it have exactly one video input and one video output?
static bool is_usable(const AVFilter *filter, int media_type)
{
#if LIBAVFILTER_VERSION_INT >= AV_VERSION_INT(8, 3, 0)
int nb_inputs = avfilter_filter_pad_count(filter, 0),
nb_outputs = avfilter_filter_pad_count(filter, 1);
#else
int nb_inputs = avfilter_pad_count(filter->inputs),
nb_outputs = avfilter_pad_count(filter->outputs);
#endif
bool input_ok = filter->flags & AVFILTER_FLAG_DYNAMIC_INPUTS;
bool output_ok = filter->flags & AVFILTER_FLAG_DYNAMIC_OUTPUTS;
if (nb_inputs == 1)
input_ok = avfilter_pad_get_type(filter->inputs, 0) == media_type;
if (nb_outputs == 1)
output_ok = avfilter_pad_get_type(filter->outputs, 0) == media_type;
return input_ok && output_ok;
}

from mpv.

haasn avatar haasn commented on September 23, 2024

Does this fix it?

commit ce996d2d80a6d184856c9d3a869a10e8f1414e9b
Author: Niklas Haas <[email protected]>
Date:   Fri May 3 22:07:30 2024 +0200

    avfilter/vf_scale: add missing filter flag
    
    Fixes: bb8044581366fe286e16b14515d873979133dbda

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index bc53571c1c..696ee272ec 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -1261,6 +1261,7 @@ const AVFilter ff_vf_scale = {
     FILTER_QUERY_FUNC(query_formats),
     .activate        = activate,
     .process_command = process_command,
+    .flags           = AVFILTER_FLAG_DYNAMIC_INPUTS,
 };
 
 static const AVFilterPad avfilter_vf_scale2ref_inputs[] = {

from mpv.

sfan5 avatar sfan5 commented on September 23, 2024

I bet it does but isn't that misusing the flag?

/**
 * The number of the filter inputs is not determined just by AVFilter.inputs.
 * The filter might add additional inputs during initialization depending on the
 * options supplied to it.
 */

I suppose scale could be changed to dynamically add the ref input if any of the relevant vars are used.

Edit: Based on the ffmpeg documentation I noticed we're not actually checking the pad count correctly and proposed #14052. Incidentally this would make your patch no longer work.

from mpv.

haasn avatar haasn commented on September 23, 2024

The pad count serves as a minimum even if the filter has dynamic inputs/outputs, so we should reject them here.

Huh, then indeed vf_scale would need to be fixed to only add the second input dynamically if it's being used. I'm not sure if I read the same into that documentation as you, though. You think that implies it can only ever strictly add inputs, rather than also removing them?

from mpv.

sfan5 avatar sfan5 commented on September 23, 2024

Yes, that is my interpretation.

from mpv.

zhongfly avatar zhongfly commented on September 23, 2024

Fixed by FFmpeg/FFmpeg@6a5b021

from mpv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.