internal VideoInfo(FfMpegToolJsonSchema.Stream stream) : base(stream) { // Re-assign Codec to the CodecTagString instead of the CodecLongName // We need the tag for sub-formats like DivX / DX50 // Ignore bad tags like 0x0000 / [0][0][0][0] if (!string.IsNullOrEmpty(stream.CodecTagString) && !stream.CodecTagString.Contains("[0]", StringComparison.OrdinalIgnoreCase)) { Codec = stream.CodecTagString; } // Build the Profile Profile = string.IsNullOrEmpty(stream.Profile) switch { false when !string.IsNullOrEmpty(stream.Level) => $"{stream.Profile}@{stream.Level}", false => stream.Profile, _ => Profile }; // Test for interlaced // https://ffmpeg.org/ffprobe-all.html // Progressive, tt, bb, tb, bt Interlaced = !string.IsNullOrEmpty(stream.FieldOrder) && !stream.FieldOrder.Equals("Progressive", StringComparison.OrdinalIgnoreCase); // ClosedCaptions ClosedCaptions = stream.ClosedCaptions; // Missing: HDR }
internal SubtitleInfo(FfMpegToolJsonSchema.Stream stream) : base(stream) { Forced = stream.Disposition.Forced; }
internal TrackInfo(FfMpegToolJsonSchema.Stream stream) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } // Fixed attributes Format = stream.CodecName; Codec = stream.CodecLongName; Default = stream.Disposition.Default; // Variable attributes Title = stream.Tags.FirstOrDefault(item => item.Key.Equals("title", StringComparison.OrdinalIgnoreCase)).Value ?? ""; Language = stream.Tags.FirstOrDefault(item => item.Key.Equals("language", StringComparison.OrdinalIgnoreCase)).Value ?? ""; // TODO: FfProbe uses the tag language value instead of the track language // Some files show MediaInfo and MkvMerge say language is "eng", FfProbe says language is "und" // https://github.com/MediaArea/MediaAreaXml/issues/34 // Set language if (string.IsNullOrEmpty(Language)) { Language = "und"; } // Some sample files are "???" or "null", set to und else if (Language.Equals("???", StringComparison.OrdinalIgnoreCase) || Language.Equals("null", StringComparison.OrdinalIgnoreCase)) { HasErrors = true; Log.Logger.Warning("Invalid Language : {Language}", Language); Language = "und"; } else { // FfProbe normally sets a 3 letter ISO 639-2 code, but some samples have 2 letter codes // Try to lookup the language to make sure it is correct Iso6393 lang = PlexCleaner.Language.GetIso6393(Language); if (lang != null) { Language = lang.Part2B; } else { HasErrors = true; Log.Logger.Warning("Invalid Language : {Language}", Language); Language = "und"; } } // Use index for number Id = stream.Index; Number = stream.Index; // Has tags HasTags = MediaInfo.IsTagTitle(Title); // Verify required info Debug.Assert(!string.IsNullOrEmpty(Format)); Debug.Assert(!string.IsNullOrEmpty(Codec)); }
internal AudioInfo(FfMpegToolJsonSchema.Stream stream) : base(stream) { }