Grant Edwards | 8 Feb 21:49
Picon

How to get machine-friendly output from ffmpeg?

I've been working on some scripts/programs that use ffmpeg to
convert files from one video format to another.

I need to monitor the progress so I can calculate a %complete
and an ETA.  (I was pretty surprised that ffmpeg doesn't do
that since most other similar programs seem to).  I also need
to discard all of the preliminary stuff that ffmpeg spits out
on startup (configuration info and a table of codecs/formats).
All that stuff just makes the useful information harder to
spot.

I've got something working, but it's been painful using ffmpeg
programmatically because of the hostile output format -- mostly
the mixture of newlines and carriage returns for line endings.

It would also be a lot easier to handle output programmatically
if time values were displayed consistently rather than being a
mixture of hh:mm:ss.ss in some and just ssssss.ss in others.

I've searched the options and there doesn't seem to be any way
to get the output to use consistent line endings.  I don't care
what line endings, but they need to be consistent.

The problem of not having readily parsable output seems to have
come up several times in the past, but all I could find were
hacks that attempt work around the issues by filtering the
output through "strings" or perl scripts to try to fix up the
output.  [You can't use "tr" to fix the line ending problem
because it buffers it's output.]

Is there any proscpect of a real solution?

--

-- 
Grant Edwards                   grante             Yow! I'm a fuschia bowling
                                  at               ball somewhere in Brittany
                               visi.com            

Gmane