[FFmpeg-devel] [PATCH] AVI metadata retrieval improvements

gregory.wolfe at kodakalaris.com gregory.wolfe at kodakalaris.com
Fri Mar 21 15:39:55 CET 2014


> Am 04.03.14 17:16, schrieb gregory.wolfe at kodakalaris.com:
> > This is the second of two changes I've made as part of our upgrade to
> > the latest FFmpeg development branch.
> > 
> > This patch enhances two aspects of metadata retrieval from AVI files.
> > I've attached before/after command line output from ffmpeg for each
> > modification.  Test video files that can be used to generate the
> > before/after output have been uploaded to the FFmpeg FTP server.
> > 
> > 
> > Patched file:  libavformat/avidec.c
> > Description (from commit message):
> > 
> > Added function avi_extract_stream_metadata().  Some cameras (e.g., 
Fuji)
> > store stream metadata following the "strd" stream data tag. Currently,
> > avi_read_header() calls ff_get_extradata() to read and save this data 
in
> > the codec's "extradata" slot.  This new function extracts metadata 
from
> > "extradata" by first looking for the AVIF tag, then extracting 
metadata
> > from the EXIF tags which follow it.
> 
> I've rewritten almost everything to use existing EXIF functions.
> 
> Patch attached, but there are 2 issues I need advise for:
> 
> a) Current EXIF is in lavc only and relies on lavc/tiff.h and 
lavc/bytestream,
> so these have to be moved (to lavu)?
> 
> b) I can't see anything about the endianess in AVI files. How to 
> determine or is
> it always little-endian?
> 
> 
> > In a separate change, some cameras (e.g., Casio) store the date format 
as
> > yyyy/mm/dd/ hh:mm.  Added code to get rid of the "/" following "dd".
> 
> I don't think this is a good idea for FFmpeg to change the 
metadata.Should be
> done by the interpreting application, IMHO.
> 
> Please comment.
> 
> -Thilo

Thilo:

a) My primary interest was to be able to retrieve the metadata by
some reasonable means.  That being said, using existing EXIF
functions to accomplish the goal sounds like a good idea.  Moving
the EXIF source files from libavcodec to libavutil makes sense,
since (strictly speaking) metadata retrieval is really a separate
functional category (vs. decoding compressed video data).  OR, it
could be moved to libavformat (i.e., part of parsing the file
format).

b) Ordinarily the endianess of EXIF tags would be indicated by
a two byte field whose value is either "II" (Intel, little-endian)
or "MM" (Motorola, big-endian).  I opened the FUJI FinePix camera
video file using a binary editor and did not find either "II" or
"MM" in the header data.  However, interpreting binary data (e.g.,
tag ID, offset to tag data, length of tag data) as little-endian
yielded the correct result.  Use of little-endian byte order is also
consistent with internet usage, so in the absence of any other
evidence I would assume little-endian byte order.  This assumption
worked for all the AVI files in our set of 300 test video files.

c) As far as the Casio change goes, the AVI metadata retrieval function
avi_metadata_creation_time() is already changing '/' to '-' in the
creation date for some cases, so the change I submitted is simply
consistent with the existing code.  Note that the date format used by
EXIF uses ':' between fields instead of '/' or '-'.  That would be
my preference, but I don't think it's critical.

Greg Wolfe, Kodak Alaris


More information about the ffmpeg-devel mailing list