[FFmpeg-devel] [RFC] amerge design issue
Nicolas George
nicolas.george at normalesup.org
Sun Sep 9 15:40:32 CEST 2012
Le duodi 22 fructidor, an CCXX, Stefano Sabatini a écrit :
> Channel layout is configured at the configuration stage,
> query_formats() is performed *before* that. Currently amerge seems to
> work *only* with movie, since for this filter the channel layout is
> computed in the init(), which is a very strong limitation.
That is a bit of an exaggeration. amerge works correctly provided all its
input meet the following two conditions: their query_formats has already
been called and they only propose one output channel layout.
The first condition means that 'amovie=a.mkv [a] ; amovie=b.mkv [b] ;
[a] [b] amerge' will work but not '[a] [b] amerge ; amovie=a.mkv [a] ;
amovie=b.mkv [b]', even though they are theoretically equivalent. I suspect
no user would notice that constraint, since the order that works is the
logical one. There is a temporary hack to ensure that -filter_complex inputs
are queried in the correct order.
The second condition is met, at least, by -filter_complex, movie and
aformat.
> The solution seems to declare the output channel layout as a
> configuration parameter, rather than guess it when it is not yet
> possible to do it.
I find that requiring the channel layout is very user-unfriendly, and
requiring the _output_ layout is very likely to cause mistakes.
Currently, if the user is in a situation where amerge can not guess, they
can specify the layout explicitly simply by adding the aformat filter in
front of the inputs. I believe this is enough for a temporary solution.
> If you want to keep the current logic, you could check on
> query_formats() that channel layout is not defined *and* is defined in
> the input links, but that's an unsafe assumption since the
> config_props() callbacks on the input may change it.
My intent is to rework the configuration process so that filters with
complex dependencies between formats can delay their configuration. My idea
would be something like that:
while (there are unconfigured filters) {
for (filter) {
if (filter has some formats unset)
filter->query_formats();
}
for (link) {
if (input and output formats set and not yet intersected)
intersect_formats(link);
}
if (no progress in the last round)
fail();
}
I have not had time to implement this yet, but it is still in my TODO list.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120909/91b1f396/attachment.asc>
More information about the ffmpeg-devel
mailing list