/// <inheritdoc /> public DateTime ReadDate(string filePath) { try { var ffProbe = new FFProbe(); var videoInfo = ffProbe.GetMediaInfo(filePath); var creationTimePair = videoInfo.FormatTags.FirstOrDefault(x => x.Key.Equals("creation_time")); if (DateTime.TryParse(creationTimePair.Value, out var dateVideoTaken)) { return(dateVideoTaken); } } catch { //--- ignore } return(ReaderHelper.GetDefault(filePath)); }
/// <inheritdoc /> public DateTime ReadDate(string filePath) { try { using MagickImage image = new MagickImage(filePath); var profile = image.GetExifProfile(); if (profile != null) { var dateExifValue = profile.GetValue(ExifTag.DateTimeDigitized); if (dateExifValue != null && DateTime.TryParseExact(dateExifValue.Value, "yyyy:MM:dd HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out var date)) { return(date); } } } catch { //--- ignore } return(ReaderHelper.GetDefault(filePath)); }