[FFmpeg-user] How to copy Photos.app metadata over?

Gabriel Zachmann zach at cs.uni-bremen.de
Thu May 17 11:40:19 EEST 2018


I need to convert a number of movies that I have stored in the Photos app on my mac (OSX 10.13, high sierra).

So, I export the movies from Photos, then convert them using ffmpeg, then import them back into Photos.

This is the ffmpeg command I use (version is attached below):

/usr/local/bin/ffmpeg -loglevel error -hide_banner -nostats -nostdin -i MIRU.mp4 -map 0 -c:s copy -map_metadata 0 -map_metadata:s:v 0:s:v -map_metadata:s:a 0:s:a -c:a aac -b:a 128k -f mp4 -codec:v hevc -tag:v hvc1 -preset faster -crf 25 -x265-params profile=main:me=umh:subme=5:ref=4:aq-mode=2:aq-strength=1.0:psy-rd=2.0:psy-rdoq=1.0:rd=6 MIRU.h265.mp4

Problem is: after importing the new movie into Photos, all meta info is gone, especially the GPS location, date of recording, etc.

I tried to display the tags for both files using exiftool, and from that output it looks like all metadata has been copied over all right.
Except that those data does not contain the desired information.
(Below you'll find the output of exiftool)

I have also tried 'exiftool -tagsFromFile MIRU.mp4 MIRU.h265.mp4' , to no avail.

Does anyone have an idea , how I can transfer all the metadata from the originals to the converted movie files?
Especially date of recording, GPS, camera info.

Thanks a lot in advance for all kinds of insights and hints.


Best regards, Gabriel




ffmpeg version:

% /usr/local/bin/ffmpeg -version
ffmpeg version N-87824-g25bd2f4 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.37)
configuration: --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --disable-indev=jack --disable-outdev=xv --enable-audiotoolbox --enable-sdl2 --enable-shared --enable-pthreads --enable-videotoolbox --arch=x86_64 --enable-x86asm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid --extra-ldflags='-L /opt/local/lib -framework CoreVideo -lfribidi' --extra-cflags='-I /opt/local/include/ -framework CoreVideo'
libavutil      55. 79.100 / 55. 79.100
libavcodec     57.108.100 / 57.108.100
libavformat    57. 84.100 / 57. 84.100
libavdevice    57. 11.100 / 57. 11.100
libavfilter     6.108.100 /  6.108.100
libavresample   3.  8.  0 /  3.  8.  0
libswscale      4.  9.100 /  4.  9.100
libswresample   2. 10.100 /  2. 10.100
libpostproc    54.  8.100 / 54.  8.100





Output of exiftool:


======== MIRU.h265.mp4
ExifTool Version Number         : 10.96
File Name                       : MIRU.h265.mp4
Directory                       : .
File Size                       : 19 MB
File Modification Date/Time     : 2018:05:15 18:43:56+02:00
File Access Date/Time           : 2018:05:17 10:33:46+02:00
File Inode Change Date/Time     : 2018:05:17 10:37:31+02:00
File Permissions                : rw-r-----
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4  Base Media v1 [IS0 14496-12:2003]
Minor Version                   : 0.2.0
Compatible Brands               : isom, iso2, mp41
Movie Data Size                 : 19400360
Movie Data Offset               : 44
Movie Header Version            : 0
Create Date                     : 2018:05:15 16:42:39
Modify Date                     : 2018:05:15 16:42:39
Time Scale                      : 1000
Duration                        : 0:01:04
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 3
Track Header Version            : 0
Track Create Date               : 2018:05:15 16:42:39
Track Modify Date               : 2018:05:15 16:42:39
Track ID                        : 1
Track Duration                  : 0:01:04
Track Layer                     : 0
Track Volume                    : 100.00%
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 48000
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Image Width                     : 1280
Image Height                    : 720
Media Header Version            : 0
Media Create Date               : 2018:05:15 16:42:39
Media Modify Date               : 2018:05:15 16:42:39
Media Time Scale                : 15360
Media Duration                  : 0:01:04
Media Language Code             : und
Handler Description             : VideoHandler
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : hvc1
Source Image Width              : 1280
Source Image Height             : 720
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Video Field Order               : Progressive; 0
Pixel Aspect Ratio              : 1:1
Video Frame Rate                : 30
Handler Type                    : Metadata
Handler Vendor ID               : Apple
Encoder                         : Lavf57.84.100
Avg Bitrate                     : 2.42 Mbps
Image Size                      : 1280x720
Megapixels                      : 0.922
Rotation                        : 0
======== MIRU.mp4
ExifTool Version Number         : 10.96
File Name                       : MIRU.mp4
Directory                       : .
File Size                       : 94 MB
File Modification Date/Time     : 2018:05:15 18:43:56+02:00
File Access Date/Time           : 2018:05:17 10:37:31+02:00
File Inode Change Date/Time     : 2018:05:15 18:44:24+02:00
File Permissions                : rw-r--r--
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4 v2 [ISO 14496-14]
Minor Version                   : 0.0.1
Compatible Brands               : mp41, mp42, isom
Movie Header Version            : 0
Create Date                     : 2018:05:15 16:42:39
Modify Date                     : 2018:05:15 16:43:56
Time Scale                      : 30
Duration                        : 0:01:04
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 3
Track Header Version            : 0
Track Create Date               : 2018:05:15 16:42:39
Track Modify Date               : 2018:05:15 16:43:56
Track ID                        : 1
Track Duration                  : 0:01:04
Track Layer                     : 0
Track Volume                    : 100.00%
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 48000
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Image Width                     : 1280
Image Height                    : 720
Media Header Version            : 0
Media Create Date               : 2018:05:15 16:42:39
Media Modify Date               : 2018:05:15 16:43:56
Media Time Scale                : 30
Media Duration                  : 0:01:04
Media Language Code             : und
Handler Type                    : Video Track
Handler Description             : Core Media Video
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 1280
Source Image Height             : 720
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Color Representation            : nclx 1 1 1
Video Field Order               : Progressive; 0
Pixel Aspect Ratio              : 1:1
Video Frame Rate                : 30
Unknown Thumbnail               : (Binary data 183093 bytes, use -b option to extract)
Description                     : This video is about IMG_1329
Title                           : IMG_1329
Movie Data Size                 : 98826726
Movie Data Offset               : 208860
Avg Bitrate                     : 12.3 Mbps
Image Size                      : 1280x720
Megapixels                      : 0.922
Rotation                        : 0
    2 image files read



More information about the ffmpeg-user mailing list