[FFmpeg-devel] [RFC] AVFilter Parser
vmrsss
vmrsss
Thu Mar 27 00:06:04 CET 2008
Sorry guys, for some reason my email is badly asynchronous: I receive
your emails with large delays, which makes the discussion a bit
clumsy. In particular, when I wrote my previous proposal I had not
seen several emails that apparently have been sent before it. This is
somehow embarrassing.
Below, I'll comment on the new (for me) messages
>> How do
>> you express that out_k is to be fed back to in_h? Or can you only do
>> feedback on intermediate labels?
>
> (out_k) is one of the outputs of the whole filter graph. It can't be
> feed to anything. Maybe I don't understand your question.
The idea to keep feedback labels entirely separated from input and
output labels is entirely right. But should I not bee able to take a
filter and perform some feedback after composing as part of a larger
graph? I'll say more below.
>> Which one? the first? or the last? the one missing from the list?
>> Perhaps I should know the answer, but I am not clear about your
>> intended use of labels. Let me take an example you use below:
>>
>> '(in1)(in2) picInPic, (in3) picInPic(out1)'
>>
>> Is "(in1)(in2)" the same as "(in2)(in1)" ? I expect the answer is no,
>> the second form would swap the two input stream. And (in3) refers
>> to a
>> third input from the entire chain. Is that fed to the second input of
>> picInPic?
>
> You got all that right.
>
> In order to feed it to the first input, would I have to
>> write the filter this way:
>>
>> '(in1)(in2) picInPic(tmp), (in3)(tmp) picInPic(out1)' ?
>
> Unless this is a typo, you got this one wrong. The comma would link
> the
> second (inexistent!) output of picInPic to the first input of the
> other
> picInPic. It would cause a syntax error. Maybe you meant
>
> '(in1)(in2) picInPic(tmp); (in3)(tmp) picInPic(out1)' ?
Well, I simply meant to ask: the (1st) output from the 1st picInPic is
fed to the 1st input of the 2nd picInPic. How do I specify that I want
that output to go to the 1st input, and (in3) to the 2nd?
> mygraph := (in1) vflip (out1)
>
> vitor at vitor$ ffmpeg -i file1.avi -vfilters '(in1) mygraph (out1)'
> file2.avi
>
> And yes, textual substitution will give
>
> '(in1) (in1) vflip (out1) (out1)' which is nonsense.
Ah! This I don't understand:
First of all, in -vfilters '.....' (in1) and (out1) carry absolutely
no information, why would to use them? Only one stream, no confusion
is possible: just write -vfilters 'mygraph'.
Then, do you or do you not allow (x) mygraph (y) ? I have the feeling
you are arguing against the substitution, not again that form. (But
then, if (in1) mygraph (out1) is non-sense after the substitution,
isn't it non-sense also before?)
Of course there is an important reason to allow (x) mygraph (y): it is
that you want to capture (that is name) its input or output to do some
non-trivial re-routing of the streams: eg, I might want to use
mygraph, feed it with the second of my input streams, and then send
its output as 2nd input of another filter. How do you propose I do
that? I think it would be natural to write something of the kind:
(in2) mygraph (a) ; (in1)(a) picInPic (out1)
Why not? Do you agree? Also, getting back the point above about
feedback, what would be wrong with something like:
(a)(in1)picInPic , mygraph (a)
Why not? Is that allowed?
>> with respect to the form above (A)(B)(C) my_filter1 (out1), if I make
>> a textual substitution I find myself with
>
> As I've already said, textual substitution is not needed (and not
> wanted, at least by me). It's not easier to parse and it's not
> easier to
> understand. So, unless you give a good argument for textual
> substitution, please stop using it in examples or arguments for how
> the
> syntax should be.
I don't think I am making an argument for textual substitution, I am
trying to discuss mechanisms for input/output binding. I am not
thinking about implementation, I am thinking about combinators, and I
would like to be able to understand them also at the level of
syntactic manipulation.
>> Because of course, you'll have situations like this:
>>
>> my_f1 = '(in1)something(out1)'
>> my_f2 = '(in2)otherthing(out1)'
>>
>> movie=f1.avi(A);
>> movie=f2.avi(B);
>> (A)(B) my_f1 ; my_f2 (out1)(out2)
>>
>
> no. Syntax error. You defined
>
> my_f1 = '(in1)something(out1)'
>
> That means you defined a filter that gets one (and only one) input,
> filter it with the filter "something" and gives one (and only one)
> output. In
>
> (A)(B) my_f1 ; my_f2 (out1)(out2)
>
> you are passing two outputs to my_f1. Maybe you meant
>
> my_f1 = '(in1)something(out1)'
> my_f2 = '(in2)otherthing(out1)'
>
> movie=f1.avi(A);
> movie=f2.avi(B);
> (A) my_f1 (out1); (B) my_f2 (out2)
I'd expect "(A)(B) (my_f1 ; my_f2) (out1)(out2)" and "(A) my_f1
(out1); (B) my_f2 (out2)" to be exactly the same (perhaps I should use
* here instead of ; ?) And here is why: "my_f1;my_f2" has got two
input and two streams A (out1) is the first input (output), B (out2)
the second input (output). The same happens to (A) my_f1 (out1); (B)
my_f2 (out2)
(There is however something else I don't understand with (B) my_f2
(out2): can you use out2? Or should it be out1? There is only one
output there.)
> Also, looking at
>
> (A)(B) my_f1 ; my_f2 (out1)(out2)
>
> It gives me the impression you misunderstood the meaning in my
> syntax of
> the semi-colon.
Yes, I am clearly confused about your syntax. Sorry. I am trying to
understand.
> For such a line be valid, my_f1 can't have any output.
> I'll try to explain by a drawing:
>
> (etc) filter (etc2) ; (tmp1) filter2 (tmp2)
>
> means
>
> (etc) ------> filter ---> (etc2) (tmp1) ---> filter2 ---->
> (tmp2)
>
> another example
>
> (etc) dead_end_filter ; vsrc_movie=a.avi (tmp2)
>
> (etc) ----> dead_end_filter vsrc_movie ---> (tmp2)
>
> (mind the difference with the coma)
>
> The semi-colon describes two different parts of the filter chain
> without
> doing any linking. As I said,
>
> vflip ; hflip
>
> is a syntax error no matter where it appears. It expects vflip to have
> no output, but it has one. (Yes, I know it is related with your '*',
> but
> it has the lowest precedence)
This I don't understand: everybody knows what these filters are like,
that is a perfectly fine filter with two inputs (first to vflip,
second to hflip) and two outputs (first from vflip, second from
hflip). Why do you want me to over-specify (in1)vflip(out1);
(in2)hflip(out2) ? As I said above, the only reason I might want to do
that is if I need to name the output for some non-trivial threading.
>> I think it is important that whatever the syntax is, users are
>> allowed
>> to omit elements so as to write simple filters as simply as always,
>> eg:
>>
>> ... remove_logo,deinterlace,crop,scale,pad...
>>
>> In this sense, it's important to be able to leave streams implicit if
>> possible.
>
> Yes, I'm favorable to that. But how is this related to this
> suggestion?
Only, is this allowed by your syntax?
> Which convention for implicit linking?
>
> The comma links the last stream of the previous filter to the first of
> the next. This is explicit and well defined.
Well, implicit means that it is not explicitly noted. I don't
particularly like it, but after all I don't mind. What I still don't
understand is what do I need to do in order to send the last stream of
the previous filter somewhere else. Is the answer: use ";" ? That'd be
quite an overhead, like below.
> If you don't want "implicit" linking, you can do all your links
> explicitly (and named, btw), like
>
>
> L1 L3
> (in1) ---> split ---> rotate ------+
> | picinPic ----> out
> +-----> nop ------+
> L2 L4
>
> (in1) split (L1) (L2);
> (L1) rotate (L3);
> (L2) nop (L4);
> (L3) (L4) picinPic (out);
>
> No comma, no "implicit" linking.
More information about the ffmpeg-devel
mailing list