public static void GetGrayBytesFromVideo(FileEntry videoFile, List <float> positions, bool extendedLogging) { int tooDarkCounter = 0; for (int i = 0; i < positions.Count; i++) { double position = videoFile.GetGrayBytesIndex(positions[i]); if (videoFile.grayBytes.ContainsKey(position)) { continue; } var data = GetThumbnail(new FfmpegSettings { File = videoFile.Path, Position = TimeSpan.FromSeconds(position), GrayScale = 1, }, extendedLogging); if (data == null) { videoFile.Flags.Set(EntryFlags.ThumbnailError); return; } if (!GrayBytesUtils.VerifyGrayScaleValues(data)) { tooDarkCounter++; } videoFile.grayBytes.Add(position, data); } if (tooDarkCounter == positions.Count) { videoFile.Flags.Set(EntryFlags.TooDark); Logger.Instance.Info($"ERROR: Graybytes too dark of: {videoFile.Path}"); } }
public static void GetGrayBytesFromVideo(FileEntry videoFile, List <float> positions) { int tooDarkCounter = 0; for (int i = 0; i < positions.Count; i++) { double position = videoFile.GetGrayBytesIndex(positions[i]); if (videoFile.grayBytes.ContainsKey(position)) { continue; } var data = GetThumbnail(new FfmpegSettings { File = videoFile.Path, Position = TimeSpan.FromSeconds(position), GrayScale = 1 }); if (data == null || data.Length == 0) { videoFile.Flags.Set(EntryFlags.ThumbnailError); return; } if (!GrayBytesUtils.VerifyGrayScaleValues(data)) { tooDarkCounter++; } videoFile.grayBytes.Add(position, data); } if (tooDarkCounter == positions.Count) { videoFile.Flags.Set(EntryFlags.TooDark); } }