Expose avg_frame_rate as AverageFrameRate on VideoStream #300

Former-commit-id: 2133d31021
This commit is contained in:
Malte Rosenbjerg 2022-03-24 20:27:09 +01:00
parent 5b97f08029
commit 21e5b9634f
3 changed files with 5 additions and 0 deletions

View file

@ -65,6 +65,9 @@ public class FFProbeStream : ITagsContainer, IDispositionContainer
[JsonPropertyName("r_frame_rate")] [JsonPropertyName("r_frame_rate")]
public string FrameRate { get; set; } = null!; public string FrameRate { get; set; } = null!;
[JsonPropertyName("avg_frame_rate")]
public string AverageFrameRate { get; set; } = null!;
[JsonPropertyName("pix_fmt")] [JsonPropertyName("pix_fmt")]
public string PixelFormat { get; set; } = null!; public string PixelFormat { get; set; } = null!;

View file

@ -61,6 +61,7 @@ private VideoStream ParseVideoStream(FFProbeStream stream)
DisplayAspectRatio = MediaAnalysisUtils.ParseRatioInt(stream.DisplayAspectRatio, ':'), DisplayAspectRatio = MediaAnalysisUtils.ParseRatioInt(stream.DisplayAspectRatio, ':'),
Duration = MediaAnalysisUtils.ParseDuration(stream), Duration = MediaAnalysisUtils.ParseDuration(stream),
FrameRate = MediaAnalysisUtils.DivideRatio(MediaAnalysisUtils.ParseRatioDouble(stream.FrameRate, '/')), FrameRate = MediaAnalysisUtils.DivideRatio(MediaAnalysisUtils.ParseRatioDouble(stream.FrameRate, '/')),
AverageFrameRate = MediaAnalysisUtils.DivideRatio(MediaAnalysisUtils.ParseRatioDouble(stream.AverageFrameRate, '/')),
Height = stream.Height ?? 0, Height = stream.Height ?? 0,
Width = stream.Width ?? 0, Width = stream.Width ?? 0,
Profile = stream.Profile, Profile = stream.Profile,

View file

@ -13,6 +13,7 @@ public class VideoStream : MediaStream
public double FrameRate { get; internal set; } public double FrameRate { get; internal set; }
public string PixelFormat { get; internal set; } = null!; public string PixelFormat { get; internal set; } = null!;
public int Rotation { get; set; } public int Rotation { get; set; }
public double AverageFrameRate { get; set; }
public PixelFormat GetPixelFormatInfo() => FFMpeg.GetPixelFormat(PixelFormat); public PixelFormat GetPixelFormatInfo() => FFMpeg.GetPixelFormat(PixelFormat);
} }