drewnoakes / metadata-extractor

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Apache License 2.0
2.55k stars 479 forks source link

Add support for DJI drone photos #543

Open Eragoo opened 3 years ago

Eragoo commented 3 years ago

I' have some footage from DJI drone:

footage

And i'm trying to parse this image metadata in this way:

import com.drew.imaging.ImageMetadataReader;
import com.drew.imaging.ImageProcessingException;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.metadata.Tag;

import java.io.File;
import java.io.IOException;

public class App {
    public static void main(String[] args) throws ImageProcessingException, IOException {
        File img = new File(args[0]);
        Metadata metadata = ImageMetadataReader.readMetadata(img);
        for (Directory directory : metadata.getDirectories()) {
            for (Tag tag : directory.getTags()) {
                System.out.format("[%s] - %s = %s",
                        directory.getName(), tag.getTagName(), tag.getDescription());
                System.out.println();
            }
            if (directory.hasErrors()) {
                for (String error : directory.getErrors()) {
                    System.err.format("ERROR: %s", error);
                }
            }
        }
    }
}

And it works fine, but some part of metadata is not present. According to this web site that image also contain these tags that i'm looking for: GimbalRollDegree, GimbalYawDegree, GimbalPitchDegree, but library don't parse it.

Maybe someone had similar problem or i'm wrong somewhere.

Nadahar commented 3 years ago

Somebody probably just have to add parsing for that information. Do you have the spec for the file format that the drone uses?

Eragoo commented 3 years ago

Somebody probably just have to add parsing for that information. Do you have the spec for the file format that the drone uses?

No, i don't have official specs, just have this one: https://exiftool.org/TagNames/DJI.html

drewnoakes commented 3 years ago

Gimbal data is stored in XMP within the DJI data. A change was made to the .NET library that allowed accessing this data in https://github.com/drewnoakes/metadata-extractor-dotnet/pull/298. If someone wants to port this to Java it would be great. It's a very simple change.