[FFmpeg-devel] [PATCH] lavfi: add asendcmd and sendcmd filters

Stefano Sabatini stefasab at gmail.com
Sun Sep 2 15:40:59 CEST 2012

On date Wednesday 2012-08-15 00:16:36 +0200, Nicolas George encoded:
> L'octidi 28 thermidor, an CCXX, Stefano Sabatini a écrit :
> > Well, I suppose we could detect when the time goes back in case t2 <=
> > t1, and seek back to the first command with time >= t2.
> I am afraid it is more complicated than that. For example, if you want to
> remove an annoying logo from t=5mn to t=15mn, you will put a command to
> activate delogo at 5mn and deactivate it at 15mn, but there may be other
> unrelated commands between them. If the user seeks from 18mn to 12mn, the
> command to activate delogo has to be executed, but if they seek directly
> from 15mn to 3mn, it does not.
> I do not believe having a solution for that problem right now is mandatory,
> but having a syntax that be extended to implement a solution would be
> better.
> > > What happens if your lines are terminated by \r\n?
> > Syntax error (a line containing only "\r" doesn't contain enough
> > information.
> I was not only thinking about empty lines. I suppose a correct timed command
> line terminated by \r\n would just have the \r taken as part of the
> argument, does it not?

> This is not very windows-users-friendly. Not that I care at all about
> windows, but it will definitely generate noise on the users mailing list and
> bug tracker.
> We could have some kind of av_read_file with flags to eliminate \r before
> \n, and possibly even other features. If you think it is a good idea, I can
> implement that.

We could implement a av_read_line(), which may be more generic than an
av_read_file(). It would be useful in many places, e.g. in

I'll try to hack a local solution and see if we can make it public.
> > Yes. At the moment I don't know how to support commands which spans
> > for more than one line. I suppose we could make use of some form of
> > \n escaping.
> If you use av_get_token, I believe you can have a multi-line argument just
> by delimiting with single quotes.


> > It will abort since the line doesn't contain a command (# not at the
> > begin of the line are not treated as comments).
> Skipping the spaces at the beginning of lines would not be hard.
> > I don't know if we have already a mergesort implementation in our
> > codebase or if I should hack it.

> Michael added qsort.h with a quick-sort and a merge-sort as macros. Another
> solution would be to just add an index in the command structure (maybe the
> line number, useful in the verbose message?) and use it as a secondary sort
> key.

I like the second solution.

FFmpeg = Friendly and Fascinating Martial Puristic Enhanced Glue

More information about the ffmpeg-devel mailing list