[FFmpeg-devel] [PATCH] ffprobe integration

Stefano Sabatini stefano.sabatini-lala
Thu Feb 11 01:15:03 CET 2010


On date Tuesday 2010-02-09 23:42:50 -0200, Ramiro Polla encoded:
> [snip replies, just a quick review usage- and documentation-wise of
> the latest patch]
> 
> It took me a while just to understand how this thing worked. I read
> the manpage, but had to resort to the source code to really understand
> it. An example command line would help a lot too.

Yes, please forget about the docs for the moment as I'm seeing there
is apparently quite a lot of discussion to be done before to have a
stable interface, so I'm not putting much effort into keep it updated
with the latest patch.
 
> [...]
> > +static const AVOption ffprobe_options[] = {
> > +    {"format", "set the flags which control how to display values", OFFSET(format_flags), FF_OPT_TYPE_FLAGS, DEFAULT, 0, UINT_MAX, D, "format_flags"},
> > +    {"unit",   "show unit", 0, FF_OPT_TYPE_CONST, FORMAT_USE_UNIT, INT_MIN, INT_MAX, D, "format_flags"},
> > +    {"prefix", "show binary or decimal SI prefixes", 0, FF_OPT_TYPE_CONST, FORMAT_USE_PREFIX,  INT_MIN, INT_MAX, D, "format_flags"},
> > +    {"binary_prefix", "force binary SI prefixes", 0, FF_OPT_TYPE_CONST, FORMAT_USE_BINARY_PREFIX,  INT_MIN, INT_MAX, D, "format_flags"},
> > +    {"byte_binary_prefix", "force binary SI prefixes with byte measure units", 0, FF_OPT_TYPE_CONST, FORMAT_USE_BYTE_BINARY_PREFIX,  INT_MIN, INT_MAX, D, "format_flags"},
> > +    {"sexagesimal", "use sexagesimal time format", 0, FF_OPT_TYPE_CONST, FORMAT_USE_SEXAGESIMAL_TIME_FORMAT,  INT_MIN, INT_MAX, D, "format_flags"},
> > +    {"pretty", "prettify format, the equivalent of unit+prefix+byte_binary_prefix+sexagesimal", 0, FF_OPT_TYPE_CONST,
> > +     FORMAT_USE_UNIT|FORMAT_USE_PREFIX|FORMAT_USE_BYTE_BINARY_PREFIX|FORMAT_USE_SEXAGESIMAL_TIME_FORMAT,  INT_MIN, INT_MAX, D, "format_flags"},
> > +
> > +    {"show", "set the flags which control what to display", OFFSET(show_flags), FF_OPT_TYPE_FLAGS, DEFAULT, 0, UINT_MAX, D, "show_flags"},
> > +    {"streams", "show streams", 0, FF_OPT_TYPE_CONST, SHOW_STREAMS, INT_MIN, INT_MAX, D, "show_flags"},
> 
> > +    {"format", "show streams", 0, FF_OPT_TYPE_CONST,  SHOW_FORMAT,  INT_MIN, INT_MAX, D, "show_flags"},
> 
> "show streams" twice?
> 
> [...]
> > Index: ffmpeg/doc/ffprobe-doc.texi
> > ===================================================================
> > --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> > +++ ffmpeg/doc/ffprobe-doc.texi	2010-02-07 16:48:53.000000000 +0100
> > @@ -0,0 +1,87 @@
> [...]
> > + at item -show_format
> > +Show information about the container format of the input multimedia
> > +stream.
> > + at item -show_streams
> > +Show information about each media stream contained in the input
> > +multimedia stream.
> 
> This doesn't seem to work.
> 
> [...]
> 
> From the output of ffprobe -h:
> > $ ./ffprobe -h
> [...]
> > Simple multimedia streams analyzer
> > usage: ffprobe [OPTIONS] [INPUT_FILE]
> >
> > Main options:
> > -L                  show license
> > -h                  show help
> > -?                  show help
> > -help               show help
> > --help              show help
> > -version            show version
> 
> > -formats            show available formats
> > -codecs             show available codecs
> > -bsfs               show available bit stream filters
> > -protocols          show available protocols
> > -filters            show available filters
> > -pix_fmts           show available pixel formats
> 
> These will just confuse the users.

Why? If the user is going to probe for a stream, it has to know which
are the formats/codecs/protocols supported, so she will know what
will fail / won't be recognized.

> > -loglevel loglevel  set libav* logging level
> 
> > -default            generic catch all option
> 
> This too.
> 
> >
> > FFprobeContext AVOptions:
> > -format            <flags> .D... set the flags which control how to display values
> 
> format looks too close to formats, which means the file format. This
> is confusing.

Yes, better name suggestions are welcome.

> >    unit                    .D... show unit
> >    prefix                  .D... show binary or decimal SI prefixes
> >    binary_prefix           .D... force binary SI prefixes
> >    byte_binary_prefix         .D... force binary SI prefixes with byte measure units
> >    sexagesimal             .D... use sexagesimal time format
> >    pretty                  .D... prettify format, the equivalent of unit+prefix+byte_binary_prefix+sexagesimal
> > -show              <flags> .D... set the flags which control what to display
> >    streams                 .D... show streams
> >    format                  .D... show streams
> 
> Some other things:
> - Output of ./ffprobe input.avi gives no useful information.

How so?

stefano at geppetto ~/s/ffmpeg> ffprobe in.avi
FFprobe version SVN-r21750, Copyright (c) 2007-2010 Fabrice Bellard, et al.
  built on Feb 11 2010 00:30:30 with gcc 4.3.2
  configuration: --prefix=/home/stefano --enable-gpl --disable-shared --enable-debug=3 --enable-pthreads --enable-libvorbis --enable-avfilter --enable-nonfree --enable-x11grab --enable-libmp3lame --enable-libspeex --disable-optimizations --disable-mmx --disable-stripping --disable-indev=x11_grab_device
  libavutil     50. 9. 0 / 50. 9. 0
  libavcodec    52.53. 0 / 52.53. 0
  libavformat   52.52. 0 / 52.52. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.17. 0 /  1.17. 0
  libswscale     0.10. 0 /  0.10. 0
Input #0, avi, from 'in.avi':
  Metadata:
    ISFT            : Lavf52.41.0
  Duration: 00:00:53.40, start: 0.000000, bitrate: 294 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 199x199 [PAR 5:4 DAR 5:4], 25 tbr, 25 tbn, 25 tbc
    Stream #0.1: Audio: mp2, 48000 Hz, 2 channels, s16, 64 kb/s

Also the command will fail with a non-multimedia file:
stefano at geppetto ~/s/ffmpeg> ffprobe CREDITS 
FFprobe version SVN-r21750, Copyright (c) 2007-2010 Fabrice Bellard, et al.
  built on Feb 11 2010 00:30:30 with gcc 4.3.2
  configuration: --prefix=/home/stefano --enable-gpl --disable-shared --enable-debug=3 --enable-pthreads --enable-libvorbis --enable-avfilter --enable-nonfree --enable-x11grab --enable-libmp3lame --enable-libspeex --disable-optimizations --disable-mmx --disable-stripping --disable-indev=x11_grab_device
  libavutil     50. 9. 0 / 50. 9. 0
  libavcodec    52.53. 0 / 52.53. 0
  libavformat   52.52. 0 / 52.52. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.17. 0 /  1.17. 0
  libswscale     0.10. 0 /  0.10. 0
CREDITS: Unknown format

This is useful to check for example which file are multimedia files.

> - What can ffprobe do that mediainfo can't do and vice-versa (except
> xml output, we don't want that =)? If it's very inferior it should be
> worked on much more before it's released.

I don't agree with this. I'm trying to keep this version of ffprobe
simple to ease its inclusion (SF ffprobe variant supports also
-show_packets and -show_frames but it's rather hackish in that area).

I'll add more features as it will be included, I believe it is already
useful with the current features so waiting for it to be perfect /
better than program X is not helping anyone.

Apart from packet/frame probing, one of the nice features of mediainfo
which I'd like to implement is the exposure of the dependancies
between the I/P/B frames in a video stream, I still didn't figure out
how to do that with libav* though.

> - How do I force a file format or a codec? (like it's possible with
> ffmpeg/ffplay)

I'll try to add this.

> And feeding to ffprobe the output of libavcodec/output-example:
> 
> > $ ./ffprobe -format pretty -show format+streams ../input.avi
> > FFprobe version SVN-r21735, Copyright (c) 2007-2010 Fabrice Bellard, et al.
> 
> FFprobe is fabrice bellard's work? Underlying libraries are, but not
> this program.

I don't want to implement per-program copyright showing just for
FFprobe, so I consider Fabrice's name like a sort of "symbol" or
mythological name which can represent the project so I have no
problem into keeping that.

Even better would be to entirely remove his name from that line,
FFmpeg is a collective effort so doesn't look nice to mention just the
name of a single developer, SCCS log should be enough for what regards
the copyright of each single piece of code.

See attached.

> >   built on Feb  9 2010 22:28:23 with gcc 4.4.1
> >   configuration: --cc='ccache gcc' --enable-gpl --enable-runtime-cpudetect
> >   libavutil     50. 9. 0 / 50. 9. 0
> >   libavcodec    52.53. 0 / 52.53. 0
> >   libavformat   52.51. 0 / 52.51. 0
> >   libavdevice   52. 2. 0 / 52. 2. 0
> >   libswscale     0.10. 0 /  0.10. 0
> > Input #0, avi, from '../input.avi':
> >   Metadata:
> >     ISFT            : Lavf52.50.0
> >   Duration: 00:00:05.01, start: 0.000000, bitrate: 748 kb/s
> >     Stream #0.0: Video: mpeg4, yuv420p, 352x288 [PAR 1:1 DAR 11:9], 25 tbr, 25 tbn, 25 tbc
> >     Stream #0.1: Audio: mp2, 44100 Hz, 2 channels, s16, 64 kb/s
> 
> There should be an option to not print out the banner and the dump
> info. Or at least document the possibility of redirecting stderr to
> /dev/null.

Yes this is a general problem of the ff* tools, this is currently not
possible as we print the banner *before* the parsing. We may show it
just after the parsing like:
if (!silent_mode) show_banner()

but this won't help in case of wrong parameters/syntax, in that case
may be useful to see the banner (user X has a problem with the syntax,
he shows the output:
stefano at geppetto ~/s/ffmpeg> ffmpeg -foo
ffmpeg: missing argument for option 'foo'

but this is not very useful since we miss which version he's running).

> > [STREAM]
> > index=0
> > codec_name=mpeg4
> > codec_long_name=MPEG-4 part 2
> > codec_type=video
> > codec_time_base=1/25
> > codec_tag_string=FMP4
> > codec_tag=0x34504d46
> > width=352
> > height=288
> > has_b_frames=0
> > sample_aspect_ratio=1:1
> > display_aspect_ratio=1:1
> > pix_fmt=yuv420p
> > r_frame_rate=25/1
> > avg_frame_rate=0/0
> > time_base=1/25
> > start_time=0:00:00.000000
> > duration=0:00:05.000000
> > [/STREAM]
> > [STREAM]
> > index=1
> > codec_name=mp2
> > codec_long_name=MP2 (MPEG audio layer 2)
> > codec_type=audio
> > codec_time_base=0/1
> 
> > codec_tag_string=P___
> 
> This doesn't make sense for most audio codecs.

So the question is: does it make sense for some audio codecs? In this
case I'd say maybe we should keep it, and I don't want to implement
per-codec printing.

> > codec_tag=0x0050
> > sample_rate=44.100 KHz
> > channels=2
> > bits_per_sample=0
> > r_frame_rate=0/0
> > avg_frame_rate=0/0
> 
> There's a bunch of 0 values here and there. Is this information useful?

Not a strong opinion here, yes maybe just a N/A as done elsewhere may be
better.

> > time_base=32/1225
> > start_time=0:00:00.000000
> > duration=0:00:05.015510
> > [/STREAM]
> > [FORMAT]
> > filename=../input.avi
> > nb_streams=2
> > format_name=avi
> > format_long_name=AVI format
> > start_time=0:00:00.000000
> > duration=0:00:05.015510
> > size=458.463 Kibyte
> > bit_rate=748.822 Kbit/s
> 
> > ISFT=Lavf52.50.0
> 
> metadata is just being printed out along with the other information?

Yes metadata is a property either of the container or of the stream, 
in SF ffprobe I have a -show_tags option, but I don't like it has it
shows only the container metadata.

An idea would be to prefix the metadata tags with something like:
TAG:ISFT=Lavf52.50.0

another idea would be to make the output of ffprobe full hierarchical
with a depth >1, so we could have:

format
  data
  metadata
  streams
    stream
      data
        metadata
        packets
          packet
            frame
            frame
          packet
          ...

not sure I like it, and that would complicate parsing.

Regards.
-- 
FFmpeg = Fabulous and Fanciful Mournful Philosofic Empowered Guru
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dont-show-fabrice.patch
Type: text/x-diff
Size: 635 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100211/0dd74dda/attachment.patch>



More information about the ffmpeg-devel mailing list