Opened 8 years ago

Last modified 5 years ago

#6193 new defect

GPS coordinates getting lost after encoding

Reported by: AndriusWild Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hello,
Here is the command I am using:

ffmpeg -i in.mp4 -c:v libx264 -crf 23 -c:a aac -strict experimental -q:a 100 -map_metadata 0 out.mp4

I read metadata of both input and output file after that with:

exiftool -a -G1 -s

and noticed that the following information is missing in the output file:

[QuickTime] PlayMode : SEQ_PLAY
[QuickTime] GPSCoordinates : ## deg ##' ##.##" N, ##' ##.##" W
....
[Composite] GPSLatitude : ## deg ##' ##.##" N
[Composite] GPSLongitude : ## deg ##' ##.##" W
[Composite] GPSPosition : ## deg ##' ##.##" N, ##' ##.##" W

Real coordinates are not shown

Here is the output of:

ffmpeg -v 9 -loglevel 99 -i
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers

built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
WARNING: library configuration mismatch
avcodec configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv --enable-version3 --disable-doc --disable-programs --disable-avdevice --disable-avfilter --disable-avformat --disable-avresample --disable-postproc --disable-swscale --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libvo_aacenc --enable-libvo_amrwbenc
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100

Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ...Missing argument for option 'i'.
Error splitting the argument list: Invalid argument

Change History (10)

comment:1 by Carl Eugen Hoyos, 8 years ago

Please test current FFmpeg git head and provide the command line you tested together with the complete, uncut console output to make this a valid ticket and provide a sample input file.

comment:2 by AndriusWild, 8 years ago

~/Compiled/ffmpeg $ ffmpeg -v 9 -loglevel 99 -i
ffmpeg version N-83683-g26a7d6a Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --enable-gpl --enable-libx264 --enable-libmp3lame --enable-nonfree --enable-libfdk-aac
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 81.100 / 57. 81.100
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  3.100 / 57.  3.100
  libavfilter     6. 74.100 /  6. 74.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ...Missing argument for option 'i'.
Error splitting the argument list: Invalid argument
~/Compiled/ffmpeg $ ffmpeg -i '/media/data/Family Pictures/2016/2016-10/20161024/20161024_175755.mp4' -c:v libx264 -crf 23 -c:a aac -strict experimental -q:a 100 -map_metadata 0 '/media/data/Family Pictures/2016/2016-10/20161024/20161024_175755_x264.mp4'
ffmpeg version N-83683-g26a7d6a Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --enable-gpl --enable-libx264 --enable-libmp3lame --enable-nonfree --enable-libfdk-aac
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 81.100 / 57. 81.100
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  3.100 / 57.  3.100
  libavfilter     6. 74.100 /  6. 74.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/data/Family Pictures/2016/2016-10/20161024/20161024_175755.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-10-24T23:58:29.000000Z
    location        : +50.9678-114.0690/
    location-eng    : +50.9678-114.0690/
    com.android.version: 6.0.1
  Duration: 00:00:33.73, start: 0.000000, bitrate: 17248 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 17015 kb/s, 29.99 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      rotate          : 180
      creation_time   : 2016-10-24T23:58:29.000000Z
      handler_name    : VideoHandle
    Side data:
      displaymatrix: rotation of -180.00 degrees
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      creation_time   : 2016-10-24T23:58:29.000000Z
      handler_name    : SoundHandle
[libx264 @ 0x3b806a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x3b806a0] profile High, level 4.0
[libx264 @ 0x3b806a0] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/media/data/Family Pictures/2016/2016-10/20161024/20161024_175755_x264.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-10-24T23:58:29.000000Z
    location        : +50.9678-114.0690/
    location-eng    : +50.9678-114.0690/
    com.android.version: 6.0.1
    encoder         : Lavf57.66.102
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandle
      creation_time   : 2016-10-24T23:58:29.000000Z
      encoder         : Lavc57.81.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2016-10-24T23:58:29.000000Z
      handler_name    : SoundHandle
      encoder         : Lavc57.81.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 1010 fps=9.0 q=-1.0 Lsize=   42468kB time=00:00:33.72 bitrate=10314.8kbits/s speed=0.302x    
video:40298kB audio:2134kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.085235%
[libx264 @ 0x3b806a0] frame I:7     Avg QP:23.60  size:145904
[libx264 @ 0x3b806a0] frame P:583   Avg QP:25.59  size: 59609
[libx264 @ 0x3b806a0] frame B:420   Avg QP:29.11  size: 13075
[libx264 @ 0x3b806a0] consecutive B-frames: 24.5% 55.0% 15.7%  4.8%
[libx264 @ 0x3b806a0] mb I  I16..4:  9.6% 64.6% 25.8%
[libx264 @ 0x3b806a0] mb P  I16..4:  3.0%  9.7%  2.2%  P16..4: 40.6% 18.7% 10.4%  0.0%  0.0%    skip:15.5%
[libx264 @ 0x3b806a0] mb B  I16..4:  0.3%  1.2%  0.4%  B16..8: 41.4%  4.7%  1.0%  direct: 2.3%  skip:48.7%  L0:41.7% L1:50.9% BI: 7.4%
[libx264 @ 0x3b806a0] 8x8 transform intra:65.2% inter:75.1%
[libx264 @ 0x3b806a0] coded y,uvDC,uvAC intra: 58.1% 47.9% 13.5% inter: 25.9% 16.1% 1.0%
[libx264 @ 0x3b806a0] i16 v,h,dc,p: 29% 28% 10% 33%
[libx264 @ 0x3b806a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 23% 17%  4%  6%  6%  8%  6%  7%
[libx264 @ 0x3b806a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 26% 11%  4%  9%  9% 11%  5%  6%
[libx264 @ 0x3b806a0] i8c dc,h,v,p: 57% 24% 15%  4%
[libx264 @ 0x3b806a0] Weighted P-Frames: Y:6.0% UV:2.2%
[libx264 @ 0x3b806a0] ref P L0: 69.9% 19.7%  7.7%  2.5%  0.2%
[libx264 @ 0x3b806a0] ref B L0: 94.8%  5.1%  0.2%
[libx264 @ 0x3b806a0] ref B L1: 98.0%  2.0%
[libx264 @ 0x3b806a0] kb/s:9805.50
[aac @ 0x3bc1840] Qavg: 11800.000

Input file metadata:

~/Compiled/ffmpeg $ exiftool -a -G1 -s '/media/data/Family Pictures/2016/2016-10/20161024/20161024_175755.mp4' 
[ExifTool]      ExifToolVersion                 : 10.10
[System]        FileName                        : 20161024_175755.mp4
[System]        Directory                       : /media/data/Family Pictures/2016/2016-10/20161024
[System]        FileSize                        : 69 MB
[System]        FileModifyDate                  : 2017:01:28 23:13:26-07:00
[System]        FileAccessDate                  : 2017:01:29 21:58:00-07:00
[System]        FileInodeChangeDate             : 2017:01:28 23:13:26-07:00
[System]        FilePermissions                 : rwxrwx---
[File]          FileType                        : MP4
[File]          FileTypeExtension               : mp4
[File]          MIMEType                        : video/mp4
[QuickTime]     MajorBrand                      : MP4 v2 [ISO 14496-14]
[QuickTime]     MinorVersion                    : 0.0.0
[QuickTime]     CompatibleBrands                : isom, mp42
[QuickTime]     MovieDataSize                   : 72699457
[QuickTime]     MovieDataOffset                 : 32
[QuickTime]     MovieHeaderVersion              : 0
[QuickTime]     CreateDate                      : 2016:10:24 23:58:29
[QuickTime]     ModifyDate                      : 2016:10:24 23:58:29
[QuickTime]     TimeScale                       : 1000
[QuickTime]     Duration                        : 0:00:33
[QuickTime]     PreferredRate                   : 1
[QuickTime]     PreferredVolume                 : 100.00%
[QuickTime]     MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[QuickTime]     PreviewTime                     : 0 s
[QuickTime]     PreviewDuration                 : 0 s
[QuickTime]     PosterTime                      : 0 s
[QuickTime]     SelectionTime                   : 0 s
[QuickTime]     SelectionDuration               : 0 s
[QuickTime]     CurrentTime                     : 0 s
[QuickTime]     NextTrackID                     : 3
[QuickTime]     PlayMode                        : SEQ_PLAY
[QuickTime]     GPSCoordinates                  : 50 deg 58' 4.08" N, 114 deg 4' 8.40" W
[QuickTime]     HandlerType                     : Metadata Tags
[QuickTime]     ComAndroidVersion               : 6.0.1
[Track1]        TrackHeaderVersion              : 0
[Track1]        TrackCreateDate                 : 2016:10:24 23:58:29
[Track1]        TrackModifyDate                 : 2016:10:24 23:58:29
[Track1]        TrackID                         : 1
[Track1]        TrackDuration                   : 0:00:33
[Track1]        TrackLayer                      : 0
[Track1]        TrackVolume                     : 0.00%
[Track1]        MatrixStructure                 : -1 0 0 0 -1 0 0 0 1
[Track1]        ImageWidth                      : 1920
[Track1]        ImageHeight                     : 1080
[Track1]        MediaHeaderVersion              : 0
[Track1]        MediaCreateDate                 : 2016:10:24 23:58:29
[Track1]        MediaModifyDate                 : 2016:10:24 23:58:29
[Track1]        MediaTimeScale                  : 90000
[Track1]        MediaDuration                   : 0:00:33
[Track1]        HandlerType                     : Video Track
[Track1]        HandlerDescription              : VideoHandle
[Track1]        GraphicsMode                    : srcCopy
[Track1]        OpColor                         : 0 0 0
[Track1]        CompressorID                    : avc1
[Track1]        SourceImageWidth                : 1920
[Track1]        SourceImageHeight               : 1080
[Track1]        XResolution                     : 72
[Track1]        YResolution                     : 72
[Track1]        BitDepth                        : 24
[Track1]        VideoFrameRate                  : 29.995
[Track2]        TrackHeaderVersion              : 0
[Track2]        TrackCreateDate                 : 2016:10:24 23:58:29
[Track2]        TrackModifyDate                 : 2016:10:24 23:58:29
[Track2]        TrackID                         : 2
[Track2]        TrackDuration                   : 0:00:33
[Track2]        TrackLayer                      : 0
[Track2]        TrackVolume                     : 100.00%
[Track2]        MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[Track2]        MediaHeaderVersion              : 0
[Track2]        MediaCreateDate                 : 2016:10:24 23:58:29
[Track2]        MediaModifyDate                 : 2016:10:24 23:58:29
[Track2]        MediaTimeScale                  : 48000
[Track2]        MediaDuration                   : 0:00:33
[Track2]        HandlerType                     : Audio Track
[Track2]        HandlerDescription              : SoundHandle
[Track2]        Balance                         : 0
[Track2]        AudioFormat                     : mp4a
[Track2]        AudioChannels                   : 2
[Track2]        AudioBitsPerSample              : 16
[Track2]        AudioSampleRate                 : 48000
[Composite]     AvgBitrate                      : 17.2 Mbps
[Composite]     GPSLatitude                     : 50 deg 58' 4.08" N
[Composite]     GPSLongitude                    : 114 deg 4' 8.40" W
[Composite]     GPSPosition                     : 50 deg 58' 4.08" N, 114 deg 4' 8.40" W
[Composite]     ImageSize                       : 1920x1080
[Composite]     Megapixels                      : 2.1
[Composite]     Rotation                        : 180

Output file metadata:

~/Compiled/ffmpeg $ exiftool -a -G1 -s '/media/data/Family Pictures/2016/2016-10/20161024/20161024_175755_x264.mp4' [ExifTool]      ExifToolVersion                 : 10.10
[System]        FileName                        : 20161024_175755_x264.mp4
[System]        Directory                       : /media/data/Family Pictures/2016/2016-10/20161024
[System]        FileSize                        : 41 MB
[System]        FileModifyDate                  : 2017:02:27 09:44:59-07:00
[System]        FileAccessDate                  : 2017:02:27 09:45:05-07:00
[System]        FileInodeChangeDate             : 2017:02:27 09:44:59-07:00
[System]        FilePermissions                 : rwxrwx---
[File]          FileType                        : MP4
[File]          FileTypeExtension               : mp4
[File]          MIMEType                        : video/mp4
[QuickTime]     MajorBrand                      : MP4  Base Media v1 [IS0 14496-12:2003]
[QuickTime]     MinorVersion                    : 0.2.0
[QuickTime]     CompatibleBrands                : isom, iso2, avc1, mp41
[QuickTime]     MovieDataSize                   : 43450350
[QuickTime]     MovieDataOffset                 : 48
[QuickTime]     MovieHeaderVersion              : 0
[QuickTime]     CreateDate                      : 2016:10:24 23:58:29
[QuickTime]     ModifyDate                      : 2016:10:24 23:58:29
[QuickTime]     TimeScale                       : 1000
[QuickTime]     Duration                        : 0:00:33
[QuickTime]     PreferredRate                   : 1
[QuickTime]     PreferredVolume                 : 100.00%
[QuickTime]     MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[QuickTime]     PreviewTime                     : 0 s
[QuickTime]     PreviewDuration                 : 0 s
[QuickTime]     PosterTime                      : 0 s
[QuickTime]     SelectionTime                   : 0 s
[QuickTime]     SelectionDuration               : 0 s
[QuickTime]     CurrentTime                     : 0 s
[QuickTime]     NextTrackID                     : 3
[QuickTime]     HandlerType                     : Metadata
[QuickTime]     HandlerVendorID                 : Apple
[QuickTime]     Encoder                         : Lavf57.66.102
[QuickTime]     LocationInformation             : (none) Role=shooting Lat=50.96779 Lon=-114.06898 Alt=0.00 Body=earth Notes=
[Track1]        TrackHeaderVersion              : 0
[Track1]        TrackCreateDate                 : 2016:10:24 23:58:29
[Track1]        TrackModifyDate                 : 2016:10:24 23:58:29
[Track1]        TrackID                         : 1
[Track1]        TrackDuration                   : 0:00:33
[Track1]        TrackLayer                      : 0
[Track1]        TrackVolume                     : 0.00%
[Track1]        MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[Track1]        ImageWidth                      : 1920
[Track1]        ImageHeight                     : 1080
[Track1]        MediaHeaderVersion              : 0
[Track1]        MediaCreateDate                 : 2016:10:24 23:58:29
[Track1]        MediaModifyDate                 : 2016:10:24 23:58:29
[Track1]        MediaTimeScale                  : 15360
[Track1]        MediaDuration                   : 0:00:33
[Track1]        MediaLanguageCode               : eng
[Track1]        HandlerType                     : Video Track
[Track1]        HandlerDescription              : VideoHandler
[Track1]        GraphicsMode                    : srcCopy
[Track1]        OpColor                         : 0 0 0
[Track1]        CompressorID                    : avc1
[Track1]        SourceImageWidth                : 1920
[Track1]        SourceImageHeight               : 1080
[Track1]        XResolution                     : 72
[Track1]        YResolution                     : 72
[Track1]        BitDepth                        : 24
[Track1]        VideoFrameRate                  : 30
[Track2]        TrackHeaderVersion              : 0
[Track2]        TrackCreateDate                 : 2016:10:24 23:58:29
[Track2]        TrackModifyDate                 : 2016:10:24 23:58:29
[Track2]        TrackID                         : 2
[Track2]        TrackDuration                   : 0:00:33
[Track2]        TrackLayer                      : 0
[Track2]        TrackVolume                     : 100.00%
[Track2]        MatrixStructure                 : 1 0 0 0 1 0 0 0 1
[Track2]        MediaHeaderVersion              : 0
[Track2]        MediaCreateDate                 : 2016:10:24 23:58:29
[Track2]        MediaModifyDate                 : 2016:10:24 23:58:29
[Track2]        MediaTimeScale                  : 48000
[Track2]        MediaDuration                   : 0:00:33
[Track2]        MediaLanguageCode               : eng
[Track2]        HandlerType                     : Audio Track
[Track2]        HandlerDescription              : SoundHandler
[Track2]        Balance                         : 0
[Track2]        AudioFormat                     : mp4a
[Track2]        AudioChannels                   : 2
[Track2]        AudioBitsPerSample              : 16
[Track2]        AudioSampleRate                 : 48000
[Composite]     AvgBitrate                      : 10.3 Mbps
[Composite]     GPSAltitude                     : 0 m
[Composite]     GPSAltitudeRef                  : Above Sea Level
[Composite]     GPSLatitude                     : 50 deg 58' 4.04" N
[Composite]     GPSLongitude                    : 114 deg 4' 8.33" W
[Composite]     ImageSize                       : 1920x1080
[Composite]     Megapixels                      : 2.1
[Composite]     Rotation                        : 0
[Composite]     GPSPosition                     : 50 deg 58' 4.04" N, 114 deg 4' 8.33" W

Looks like the latest version actually keeps the GPS coordinates however the Quicktime tag looks different.
Original:

[QuickTime]     GPSCoordinates                  : 50 deg 58' 4.08" N, 114 deg 4' 8.40" W

Output:

[QuickTime]     LocationInformation             : (none) Role=shooting Lat=50.96779 Lon=-114.06898 Alt=0.00 Body=earth Notes=

Is that normal?

Input file can be downloaded here:
https://drive.google.com/file/d/0B5_iknSPeSNBM3JWeGFVS1kteDA/view?usp=sharing

Last edited 8 years ago by AndriusWild (previous) (diff)

comment:3 by AndriusWild, 8 years ago

Wanted to add that Mediainfo sees coordinates in the original file

©xyz                                     : +50.9678-114.0690/

but does not see them in the output file.

comment:4 by AndriusWild, 8 years ago

I sent the output file to the phone (Samsung Galaxy S6 Android 6.0.1) and it shows "No location" either.

Last edited 8 years ago by AndriusWild (previous) (diff)

comment:5 by AndriusWild, 8 years ago

Also, the altitude information that ffmpeg adds is incorrect. Looks like ffmpeg writes 0 value if the source file does have it.

comment:6 by AndriusWild, 8 years ago

I was able to copy moov/udta atom using https://www.bento4.com
mp4extract moov/udta input.mp4 temp.txt
mp4edit --insert moov:temp.txt output.mp4 output_gps.mp4

I tried to copy moov/udta/©xyz atom first but was not able to do that so I had to copy the entire [udta]

comment:7 by AndriusWild, 8 years ago

Hello,
I was wondering if this issue is going to be investigated.
To reproduce the issue you can

  1. Download this sample file: https://drive.google.com/file/d/0B5_iknSPeSNBM3JWeGFVS1kteDA/view?usp=sharing
  2. Convert it with
    -map_metadata 0
    
    option, for example
ffmpeg -i in.mp4 -c:v libx264 -crf 23 -c:a libfdk_aac -b:a 192k -map_metadata 0 out.mp4

and then

  1. Read metadata using the following tools:
ffmpeg -i FILE
mediainfo FILE
exiftool -a -G1 -s FILE

ffmpeg -i will show you that

com.android.version: 6.0.1

as well as

rotate          : 90

are missing

mediainfo will show you that

©xyz                                     : +##.####-###.####/
com.android.version                      : 6.0.1

is missing and replaced with:

Writing application                      : Lavf57.56.101

Also

Rotation                                 : 90°

is missing

ExifTool will show you that

[QuickTime]     GPSCoordinates                  : ## deg ##' ##.##" N, ### deg #' ##.##" W 
[QuickTime]     ComAndroidVersion               : 6.0.1     

got replaced with:

[QuickTime]     HandlerType                     : Metadata
[QuickTime]     HandlerVendorID                 : Apple
[QuickTime]     Encoder                         : Lavf57.56.101
[QuickTime]     LocationInformation             : (none) Role=shooting Lat=##.##### Lon=-###.##### Alt=0.00 Body=earth Notes=

and

[QuickTime]     ComAndroidVersion               : 6.0.1  

is missing

as well as

[Composite]     Rotation                        : 90

got replaced with

[Composite]     Rotation                        : 0

Please advise

comment:8 by nom, 6 years ago

When will this get fixed?

comment:9 by Gyan, 6 years ago

ffmpeg, by default, autorotates videos to 0 rotation. Use -noautorotate as an input option to avoid that.

Yes, many of the udta tags are not set upon demuxing and only a few (1 ?) are conveyed to output MOV/MP4s at present. Patch should be sent to the ffmpeg-devel ML.

in reply to:  6 comment:10 by TimvW1984, 5 years ago

This issue is similar to https://trac.ffmpeg.org/ticket/4209

Replying to AndriusWild:

I was able to copy moov/udta atom using https://www.bento4.com
mp4extract moov/udta input.mp4 temp.txt
mp4edit --insert moov:temp.txt output.mp4 output_gps.mp4

I tried to copy moov/udta/©xyz atom first but was not able to do that so I had to copy the entire [udta]

Thanks! This work-around works for me, except I use moov/meta (instead of your moov/udta):

ffmpeg -i source.mov converted.mp4
mp4extract moov/meta source.mov source-metadata
mp4edit --insert moov:source-metadata converted.mp4 converted-withmeta.mp4
Note: See TracTickets for help on using tickets.