1 year ago

#357194

test-img

Rasitha Ariyarathna

Extract GPS meta data of a video using C#

I have tried following libraries in c# (.net core)

  1. Media Info
  2. Metadata Extractor
  3. Tag Lib
  4. Media Tool Kit

I wasn't able to retrieve GPS metadata from any of these libraries of a video. But for an image, it worked fine. Also, I tried the Exif tool, but no luck.

Following are some code samples I used. Looking for help on this.

// using metadata extractor
var byteArray = await File.ReadAllBytesAsync("./meta_video.mp4");
Stream stream = new MemoryStream(byteArray);

var directories = QuickTimeMetadataReader.ReadMetadata(stream);
var directories1 = ImageMetadataReader.ReadMetadata("./meta_image1.jpg");
            
// using tag lib
var tfile = TagLib.File.Create(@"./meta_video.mp4");
            
// using media tool kit
var inputFile = new MediaToolkit.Model.MediaFile {Filename = @"./meta_video.mp4"};
using (var engine = new Engine())
{
                engine.GetMetadata(inputFile);
}

// using media info
string fileNameAndPath = "./video2.mp4";
var myVideo = new MediaFile(fileNameAndPath);

c#

gps

metadata

exiftool

metadata-extractor

0 Answers

Your Answer

Accepted video resources