[FFmpeg-devel] [PATCH] Don't let error messages overwrite progress information

Michael Karcher ffmpeg
Wed Oct 27 13:25:24 CEST 2010

[the constructive suggestion is in the last paragraph]

Am Mittwoch, den 27.10.2010, 12:42 +0200 schrieb Michael Niedermayer:
> > > Problem is that we dont want the status line to overwrite something else
> > > so keep track of the last thing printed and add a \n as needed
> > What about printing the \r at the beginning of the status message
> > instead of at the end? For sucessive status outputs, either way works,
> > but the cursor will be at the end of the status message so it won't be
> > overwritten if something else is output after it.
> The "last message repeated" stuff will still overwrite it
Right. This is obviously a fundamental problem. The "last message
repeated" stuff expects that the last thing output ist the previous
"last message repeated" message. While the timer output of ffmpeg
expects that the current line contains a previos timer value. We can't
satisfy both assumptions at the same time.

> and appending text after it wont look pretty
While this is right, it seems like exactly what the use case that
started this thread needed - a timestamp that indicates when the message
was printed. If the message is appended to the timestamp, that's maybe
ugly but conveys all required information - except if the last message
repeated stuff interferes.

If the use case of the thread starter is deemed important enough, every
instance of a repeated message is to be shown seperately. Having each
"Last message repeated %d times" appended to a timestamp on a different
line would make that possible - but OTOH, the "Last message repeated %d
times" is intended to be overwritten, so one can not output a newline

It looks like the output of the timestamp in ffmpeg.c and the default
logging callback just don't go together. A probably right way to fix the
stuff is to have a custom log callback in ffmpeg.c that handles printing
error messages with timestamps in a consistent way (e.g. prefixing the
current timestamp to log messages - which needs the timestamp (string)
to be in a global variable for that).

  Michael Karcher

More information about the ffmpeg-devel mailing list