[FFmpeg-trac] #4209(avformat:open): GPS coordinates location and other iOS metadata in MOV are not copied to output MP4

FFmpeg trac at avcodec.org
Wed Apr 10 19:02:05 EEST 2024


#4209: GPS coordinates location and other iOS metadata in MOV are not copied to
output MP4
------------------------------------+------------------------------------
             Reporter:  elmimmo     |                    Owner:  (none)
                 Type:  defect      |                   Status:  open
             Priority:  normal      |                Component:  avformat
              Version:  git-master  |               Resolution:
             Keywords:  mov         |               Blocked By:
             Blocking:              |  Reproduced by developer:  1
Analyzed by developer:  0           |
------------------------------------+------------------------------------
Comment (by wywh):

 In fact, ffmpeg copies {{{Keys}}}, {{{UserData}}} and {{{ItemList}}} tags
 to the same {{{Keys}}} tags embedded in {{{UserData}}} atom tags that
 Apple's apps do not display.

 For example, ffmpeg copies {{{Keys}}}, {{{UserData}}} and {{{ItemList}}}
 GPS coordinate tags about the same way:

 {{{
 ffmpeg6 -i input.mp4 -c copy -movflags use_metadata_tags -map_metadata 0
 output.mp4
 ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
   built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
   configuration: --cc=/usr/bin/clang
 --datadir=/opt/local/libexec/ffmpeg6/share/data
 --docdir=/opt/local/libexec/ffmpeg6/share/doc --progs-suffix=6
 --prefix=/opt/local/libexec/ffmpeg6 --enable-audiotoolbox --disable-
 indev=jack --disable-libjack --disable-libopencore-amrnb --disable-
 libopencore-amrwb --disable-libxcb --disable-libxcb-shm --disable-libxcb-
 xfixes --disable-metal --disable-outdev=xv --enable-opencl --enable-sdl2
 --disable-securetransport --enable-videotoolbox --disable-xlib --enable-
 avfilter --enable-fontconfig --enable-gnutls --enable-libass --enable-
 libbluray --enable-libdav1d --enable-libfreetype --enable-libfribidi
 --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-
 libopus --enable-librsvg --enable-libsoxr --enable-libspeex --enable-
 libtheora --enable-libvorbis --enable-libvpx --enable-libzimg --enable-
 libzvbi --enable-lzma --enable-shared --enable-pthreads --enable-swscale
 --enable-zlib --enable-libaom --enable-libsvtav1 --arch=x86_64 --enable-
 x86asm --enable-gpl --enable-libvidstab --enable-libx264 --enable-libx265
 --enable-libxvid --enable-postproc
   libavutil      58. 29.100 / 58. 29.100
   libavcodec     60. 31.102 / 60. 31.102
   libavformat    60. 16.100 / 60. 16.100
   libavdevice    60.  3.100 / 60.  3.100
   libavfilter     9. 12.100 /  9. 12.100
   libswscale      7.  5.100 /  7.  5.100
   libswresample   4. 12.100 /  4. 12.100
   libpostproc    57.  3.100 / 57.  3.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
   Metadata:
     major_brand     : mp42
     minor_version   : 1
     compatible_brands: isommp41mp42
     creation_time   : 2005-05-05T09:05:05.000000Z
     location        : -36.6101-066.91515+119.900/
     location-eng    : -36.6101-066.91515+119.900/
     com.apple.quicktime.location.ISO6709: -36.6101-066.91515+119.900/
   Duration: 00:00:04.00, start: 0.000000, bitrate: 2593 kb/s
   Stream #0:0[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
 stereo, fltp, 133 kb/s (default)
     Metadata:
       handler_name    : Core Media Audio
       vendor_id       : [0][0][0][0]
   Stream #0:1[0x2](und): Video: h264 (High) (avc1 / 0x31637661),
 yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2452 kb/s,
 25 fps, 25 tbr, 25k tbn (default)
     Metadata:
       handler_name    : Core Media Video
       vendor_id       : [0][0][0][0]
 Output #0, mp4, to 'output.mp4':
   Metadata:
     major_brand     : mp42
     minor_version   : 1
     compatible_brands: isommp41mp42
     creation_time   : 2005-05-05T09:05:05.000000Z
     location        : -36.6101-066.91515+119.900/
     location-eng    : -36.6101-066.91515+119.900/
     com.apple.quicktime.location.ISO6709: -36.6101-066.91515+119.900/
     encoder         : Lavf60.16.100
   Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv,
 bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2452 kb/s, 25
 fps, 25 tbr, 25k tbn (default)
     Metadata:
       handler_name    : Core Media Video
       vendor_id       : [0][0][0][0]
   Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
 fltp, 133 kb/s (default)
     Metadata:
       handler_name    : Core Media Audio
       vendor_id       : [0][0][0][0]
 Stream mapping:
   Stream #0:1 -> #0:0 (copy)
   Stream #0:0 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 [out#0/mp4 @ 0x7f85f801f4c0] video:1197kB audio:66kB subtitle:0kB other
 streams:0kB global headers:0kB muxing overhead: 0.329143%
 size=    1268kB time=00:00:03.98 bitrate=2603.7kbits/s speed=1.26e+03x
 }}}

 {{{Keys}}}, {{{UserData}}} and {{{ItemList}}} are all copied to {{{Keys}}}
 tags embedded in {{{UserData}}} atom {{{'MOV-Movie-UserData-Meta-Keys'}}}
 which Apple's apps do not display. exiftool -G5 switch reveals that
 difference (output grouped as {{{Keys-UserData-ItemList}}}):

 {{{
 exiftool -a -G5 -s -n -api LargeFileSupport=1 -Keys:All -UserData:All
 -ItemList:All .
 ======== ./input.mp4
 [MOV-Movie-Meta-Keys] GPSCoordinates            : -36.6101 -66.91515 119.9
 [MOV-Movie-UserData] GPSCoordinates             : -36.6101 -66.91515 119.9
 [MOV-Movie-UserData-Meta-ItemList] GPSCoordinates: -36.6101 -66.91515
 119.9
 ======== ./output.mp4
 [MOV-Movie-UserData-Meta-Keys] GPSCoordinates   : -36.6101 -66.91515 119.9

 [MOV-Movie-UserData-Meta-Keys] Location         :
 -36.6101-066.91515+119.900/
 [MOV-Movie-UserData-Meta-Keys] Location-eng     :
 -36.6101-066.91515+119.900/
 [MOV-Movie-UserData] LocationInformation        : (none) Role=shooting
 Lat=-36.61009 Lon=-66.91515 Alt=119.90 Body=earth Notes=

 [MOV-Movie-UserData-Meta-Keys] Location         :
 -36.6101-066.91515+119.900/
 [MOV-Movie-UserData] LocationInformation        : (none) Role=shooting
 Lat=-36.61009 Lon=-66.91515 Alt=119.90 Body=earth Notes=
 }}}

 The same with exiftool G1 switch. ffmpeg adds those extra lines for
 {{{UserData}}} and {{{ItemList}}} GPS:

 {{{
 exiftool -a -G1 -s -n -api LargeFileSupport=1 -Keys:All -UserData:All
 -ItemList:All .
 ======== ./input.mp4
 [Keys]          GPSCoordinates                  : -36.6101 -66.91515 119.9
 [UserData]      GPSCoordinates                  : -36.6101 -66.91515 119.9
 [ItemList]      GPSCoordinates                  : -36.6101 -66.91515 119.9
 ======== ./output.mp4
 [Keys]          GPSCoordinates                  : -36.6101 -66.91515 119.9

 [Keys]          Location                        :
 -36.6101-066.91515+119.900/
 [Keys]          Location-eng                    :
 -36.6101-066.91515+119.900/
 [UserData]      LocationInformation             : (none) Role=shooting
 Lat=-36.61009 Lon=-66.91515 Alt=119.90 Body=earth Notes=

 [Keys]          Location                        :
 -36.6101-066.91515+119.900/
 [UserData]      LocationInformation             : (none) Role=shooting
 Lat=-36.61009 Lon=-66.91515 Alt=119.90 Body=earth Notes=
 }}}

 p.s. Notice that {{{Keys}}} tags are actually stored inside the
 {{{ItemList}}}, so deleting the {{{ItemList}}} group as a block (ie.
 {{{-ItemList:All=}}}) also deletes Keys tags. Instead, to preserve
 {{{Keys}}} tags the {{{ItemList}}} tags may be deleted individually with
 {{{-QuickTime:ItemList:All=}}}.

 https://exiftool.org/forum/index.php?topic=14491.msg78100#msg78100
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/4209#comment:27>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list