Skip to content

GPS/location metadata is lost when compressing images and videos despite Preserve EXIF/metadata settings #165

Description

@JoshvaJoel

Describe the bug

FFShare 2.0.0 removes GPS/location metadata when compressing images and videos.

For images, I enabled Preserve Exif tags, but the GPS coordinates are removed after compression. Other EXIF information is preserved correctly, including camera model, aperture, focal length, shutter speed, ISO, and date/time. However, the GPS/location information is missing from the compressed output.

I tested the same issue with videos as well. Location metadata is not reliably preserved after video compression, even when using -map_metadata 0.


Settings applied

App version: FFShare 2.0.0

Device: Xiaomi M2012K11AI

Image settings

  • Preserve Exif tags: Enabled
  • Image file output extension: Original
  • JPEG image qscale: 10

The default image compression command shown in the log was:

ffmpeg -y -i IMG_20260827_173909.jpg -preset medium -qscale:v 10 IMG_20260827_173909.jpeg

The FFmpeg log shows that EXIF metadata exists after processing:

Side data: EXIF metadata: (5772 bytes)

However, the GPS/location information is still missing.

I also tested Custom Image Parameters:

-map_metadata 0 -qscale:v 10

GPS/location metadata was still removed after compression.

Video settings

Custom Video Parameters:

-map_metadata 0 -movflags use_metadata_tags -c:v libx264 -preset medium -crf 33 -pix_fmt yuv420p -c:a aac -b:a 128k

Despite using -map_metadata 0, GPS/location metadata is not reliably preserved after video compression.


Steps to reproduce

Images

  1. Take a photo with camera location/GPS enabled.
  2. Confirm that the original image contains GPS coordinates.
  3. Open FFShare.
  4. Enable Preserve Exif tags.
  5. Compress the image.
  6. Open the compressed image and check its metadata/location.

Actual result:

GPS coordinates/location are missing from the compressed image.

Other EXIF information, such as camera model and exposure settings, remains available.

Expected result:

The compressed image should retain the same GPS coordinates/location as the original image when Preserve Exif tags is enabled.

Example from my test:

Original image GPS coordinates: 13.084789, 80.211006

Original image:

  • IMG_20260904_190025.jpg
  • 3000 x 4000
  • 2.34 MB

Compressed image:

  • IMG_20260904_190025.jpeg
  • 3000 x 4000
  • 731 KB

The compressed image still contains:

  • Xiaomi M2012K11AI
  • f/1.8
  • 4.71 mm
  • 1/50 s
  • ISO 133

But the GPS/location information is missing.


Videos

  1. Record a video that contains location/GPS metadata.
  2. Confirm that the original video contains location information.
  3. Compress the video using FFShare.
  4. Enable metadata preservation and/or use -map_metadata 0.
  5. Check the compressed video's metadata/location.

Actual result:

GPS/location metadata is missing or not reliably preserved after compression.

Expected result:

The compressed video should retain the original GPS/location metadata where supported by the source and output container.


App Logs

FFmpeg version shown by FFShare:

ffmpeg version n8.1.2

During image compression, FFmpeg reports EXIF metadata:

Side data: EXIF metadata: (5772 bytes)

Despite EXIF metadata being reported, the GPS coordinates are not available in the resulting compressed image.

The command also reports:

Codec AVOption preset (set encoding preset) has not been used for any stream.

This may be unrelated to the GPS issue, but it appears that -preset medium is not used for JPEG/MJPEG encoding.


File used

Please test this issue using your own photo and video files that contain GPS/location metadata.

  1. Take a photo with location/GPS enabled and confirm that the original photo contains location information.
  2. Compress it using FFShare with Preserve Exif tags enabled.
  3. Check whether the compressed image still contains the same GPS coordinates.

Please also test with a video that contains location metadata:

  1. Confirm that the original video contains location/GPS metadata.
  2. Compress it using FFShare with metadata preservation enabled.
  3. Check whether the compressed video retains the original location metadata.

This issue should be reproducible using your own media files containing GPS/location information.


Additional information

It appears that FFShare successfully preserves some EXIF/metadata fields but does not preserve the complete GPS/location metadata.

For JPEG images, EXIF metadata is reported in FFmpeg output, and camera information remains available, but the GPS coordinates disappear. This suggests that the EXIF GPS information may not be copied or rewritten correctly during JPEG re-encoding.

For videos, -map_metadata 0 and -movflags use_metadata_tags do not appear to reliably preserve location information after compression.

Could this please be investigated for both image and video compression?

When the user enables Preserve Exif tags or metadata preservation, the expected behavior is that all supported metadata, including GPS/location information, should be retained in the compressed output.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions