[FFmpeg-devel] [PATCH] ffprobe: add INI writer

Clément Bœsch ubitux at gmail.com
Sun May 27 10:28:46 CEST 2012


On Sun, May 27, 2012 at 01:51:36AM +0200, Stefano Sabatini wrote:
> On date Sunday 2012-05-27 01:37:13 +0200, Stefano Sabatini encoded:
> > Liberally based on the work of Luca Barbato <lu_zero at gentoo.org>, done
> > for libav/avprobe.
> > ---
> >  doc/ffprobe.texi |   24 +++++++++
> >  ffprobe.c        |  144 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
> >  2 files changed, 167 insertions(+), 1 deletions(-)
> 
> Output example:
> $ ffprobe -print_format ini  ~/src/ffmpeg/ffprobe-test.nut -show_streams -show_format  -show_versions -show_packets -show_frames > ffprobe.ini
> $ cat ffprobe.ini
> # ffprobe output
> 
> [program_version]
> version=N-41042-g5536632
> copyright=Copyright (c) 2007-2012 the FFmpeg developers
> build_date=May 27 2012
> build_time=01\:39\:03
> compiler_type=gcc
> compiler_version=4.6.1
> configuration=...
> 
> [library_version.0]
> name=libavutil
> major=51
> minor=54
> micro=100
> version=3356260
> 
> [library_version.1]
> name=libavcodec
> major=54
> minor=23
> micro=100
> version=3544932
> 
> ...
> [packet.115]
> codec_type=video
> stream_index=2
> pts=49
> pts_time=1.960000
> dts=49
> dts_time=1.960000
> duration=1
> duration_time=0.040000
> size=12288
> pos=1283672
> flags=K
> 
> [frame.115]
> media_type=video
> key_frame=1
> pkt_pts=49
> pkt_pts_time=1.960000
> pkt_dts=49
> pkt_dts_time=1.960000
> pkt_pos=1283672
> width=64
> height=64
> pix_fmt=rgb24
> sample_aspect_ratio=N/A
> pict_type=I
> coded_picture_number=0
> display_picture_number=0
> interlaced_frame=0
> top_field_first=0
> repeat_pict=0
> reference=0
> 
> [stream.0]
> index=0
> codec_name=pcm_s16le
> codec_long_name=PCM signed 16-bit little-endian
> profile=unknown
> codec_type=audio
> codec_time_base=1/8000
> codec_tag_string=[1][0][0][0]
> codec_tag=0x0001
> sample_fmt=s16
> sample_rate=8000
> channels=2
> bits_per_sample=16
> id=N/A
> r_frame_rate=0/0
> avg_frame_rate=0/0
> time_base=1/2000
> start_time=0.000000
> duration=40.499000
> bit_rate=256000
> nb_frames=N/A
> nb_read_frames=16
> nb_read_packets=16
> 
> [stream.1]
> index=1
> codec_name=rawvideo
> codec_long_name=raw video
> profile=unknown
> codec_type=video
> codec_time_base=1/25
> codec_tag_string=RGB[24]
> codec_tag=0x18424752
> width=64
> height=64
> has_b_frames=0
> sample_aspect_ratio=N/A
> display_aspect_ratio=N/A
> pix_fmt=rgb24
> level=-99
> timecode=N/A
> id=N/A
> r_frame_rate=25/1
> avg_frame_rate=0/0
> time_base=1/25
> start_time=0.000000
> duration=40.480000
> bit_rate=N/A
> nb_frames=N/A
> nb_read_frames=50
> nb_read_packets=50
> 
> [stream.2]
> index=2
> codec_name=rawvideo
> codec_long_name=raw video
> ...
> 
> [format]
> filename=/home/stefano/src/ffmpeg/ffprobe-test.nut

Looks like a good file for ffprobe reg tests :)

> nb_streams=3
> format_name=nut
> format_long_name=NUT format
> start_time=0.000000
> duration=40.499000
> size=1295960
> bit_rate=255998
> 
> [format.tags]
> title=ffprobe test file
> comment='A comment wih XML & JSON special chars'\: <tag value\="x">
> encoder=Lavf53.14.0
> ...
> 
> 
> avprobe format is a bit different, for example:
> stream.2 -> streams.stream.2
> 

Exactly the issue I raised in the flat writer. I don't like that at all
(it suggests streams can contain something else than a sequence of stream
section, which is not and will never be the case). Unfortunately, if we
want to void headaches for the users, it might be wise to make it
possible, at least with an option. Still, making it the default might be
better.

> With frames/packets I could try to make it appear a bit more useful,
> for example it could be (straining a bit the printer model):
> streams.stream.2.packet.3
> 
> INI is not a well specified format, see for example:
> http://en.wikipedia.org/wiki/INI_file
> 
> so there are *a lot* of variants, in particular, see "Hierarchy"
> section in the above mentioned page:
> 
> |Most commonly, INI files have no hierarchy of sections within
> |sections. Some files appear to have a hierarchical naming convention,
> |however. For section A, subsection B, sub-subsection C, property P
> |and value V, they may accept entries such as [A.B.C] and P=V
> |(Windows' xstart.ini), [A\B\C] and P=V (the IBM Windows driver file
> |devlist.ini), or [A] and B,C,P = V (Microsoft Visual Studio file
> |AEMANAGR.INI).
> |
> |It is unclear whether these are simply naming conventions that an
> |application happens to use in order to give the appearance of a
> |hierarchy, or whether the file is being read by a module that
> |actually presents this hierarchy to the application programmer.
> 
> I can easily implement this behavior, or add a switch for that if it
> seems worth the effort.

That's good to know, but the priority is to keep compatibility with libav
(there are a lot of users of the probe tool, which libav seems not to have
realized yet), so feel free to postpone :)

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120527/83126788/attachment.asc>


More information about the ffmpeg-devel mailing list