[FFmpeg-devel] [PATCH 2/2] lavf/mov: strip com.apple.quicktime prefix in meta; parse creation date

Michael Niedermayer michael at niedermayer.cc
Sat Sep 10 13:55:07 EEST 2016


On Fri, Sep 09, 2016 at 08:06:40PM -0500, Rodger Combs wrote:
> ---
>  libavformat/mov.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 54530e3..b75acd2 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -42,6 +42,7 @@
>  #include "libavutil/aes_ctr.h"
>  #include "libavutil/sha.h"
>  #include "libavutil/timecode.h"
> +#include "libavutil/parseutils.h"
>  #include "libavcodec/ac3tab.h"
>  #include "libavcodec/mpegaudiodecheader.h"
>  #include "avformat.h"
> @@ -476,6 +477,21 @@ retry:
>                  return ret;
>              }
>              str[str_size] = 0;
> +            if (!strcmp(key, "com.apple.quicktime.creationdate")) {
> +                struct tm *ptm, tmbuf;
> +                int64_t timeval;
> +                if (av_parse_time(&timeval, str, 0) >= 0) {
> +                    time_t timet = timeval / 1000000;
> +                    if (ptm = gmtime_r(&timet, &tmbuf)) {
> +                        strftime(str, str_size, "%Y-%m-%d %H:%M:%S", ptm);
> +                        key = "creation_time";
> +                    }
> +                }
> +            } else if (!strcmp(key, "com.apple.quicktime.location.ISO6709")) {
> +                key = "location";
> +            } else if (!strncmp(key, "com.apple.quicktime.", 20)) {
> +                key += 20;
> +            }
>          }

this causes language specific entries no longer to be listed together
with their "parent" entries:
is this missing some hadling of langauge specific stuff ?
also off topic but we should sort metadata for display so related
tags appear together

ticket/4012/IMG_4596.MOV

     major_brand     : qt
     minor_version   : 0
-    creation_time   : 2014-10-05T10:06:36.000000Z
+    make-eng        : Apple
     encoder         : 8.0.2
     encoder-eng     : 8.0.2
     date            : 2014-10-05T18:06:36+0800
     date-eng        : 2014-10-05T18:06:36+0800
-    location        : +06.2271+099.7476+018.026/
+    software        : 8.0.2
     location-eng    : +06.2271+099.7476+018.026/
-    model           : iPhone 6
+    creation_time   : 2014-10-05T10:06:36.000
     model-eng       : iPhone 6
+    location        : +06.2271+099.7476+018.026/
+    model           : iPhone 6
     make            : Apple
-    make-eng        : Apple
       rotate          : 180
       creation_time   : 2014-10-05T10:06:36.000000Z
       handler_name    : Core Media Data Handler


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160910/39eef0f6/attachment.sig>


More information about the ffmpeg-devel mailing list