public void GetFps() { AsfFile asfFile = new AsfFile(testVideoFileName); AsfExtendedStreamProperties asfExtendedStreamProperties = asfFile.GetAsfObject <AsfExtendedStreamProperties>(); if (asfExtendedStreamProperties.AvgTimePerFrame > 0) { double frameRate = 1.0 / TimeSpan.FromTicks((long)asfExtendedStreamProperties.AvgTimePerFrame).TotalSeconds; } }
public AsfExtendedStreamPropertiesItem(Stream stream) : base("Extended Stream Properties Object", AsfGuid.ASF_Extended_Stream_Properties_Object, stream) { AsfExtendedStreamProperties asfExtendedStreamProperties = new AsfExtendedStreamProperties(stream); Properties.Add("Stream Number", asfExtendedStreamProperties.StreamNumber); Name = string.Format("Extended Stream Properties Object [{0}]", asfExtendedStreamProperties.StreamNumber); Properties.Add("Start Time", TimeSpan.FromMilliseconds(asfExtendedStreamProperties.StartTime).ToString("mm':'ss\\.fff")); Properties.Add("End Time", TimeSpan.FromMilliseconds(asfExtendedStreamProperties.EndTime).ToString("mm':'ss\\.fff")); Properties.Add("Avg. Time / Frame", TimeSpan.FromTicks((long)asfExtendedStreamProperties.AvgTimePerFrame).ToString("mm':'ss\\.fff")); if (asfExtendedStreamProperties.AvgTimePerFrame > 0) { double frameRate = 1.0 / TimeSpan.FromTicks((long)asfExtendedStreamProperties.AvgTimePerFrame).TotalSeconds; string displayFrameRate = String.Format("{0:0.##}", frameRate); if (displayFrameRate == "29.97") { displayFrameRate += "(NTSC)"; } else if (displayFrameRate == "25.00") { displayFrameRate += "(PAL)"; } Properties.Add("Avg. Frames / Sec", displayFrameRate); } Properties.Add("Max. Object Size", asfExtendedStreamProperties.MaxObjectSize); Properties.Add("Avg. Data Bit Rate", asfExtendedStreamProperties.DataBitrate); Properties.Add("Max. Data Bit Rate", asfExtendedStreamProperties.MaxDataBitrate); Properties.Add("Avg. Buffer Size", TimeSpan.FromMilliseconds(asfExtendedStreamProperties.BufferSize).ToString("mm':'ss\\.fff")); Properties.Add("Max. Buffer Size", TimeSpan.FromMilliseconds(asfExtendedStreamProperties.AlternateBufferSize).ToString("mm':'ss\\.fff")); Properties.Add("Flags", string.Format("{0:x}", asfExtendedStreamProperties.Flags)); Properties.Add("Reliable", asfExtendedStreamProperties.IsReliable); Properties.Add("Seekable", asfExtendedStreamProperties.IsSeekable); Properties.Add("No Cleanpoints", asfExtendedStreamProperties.HasNoCleanpoints); Properties.Add("Resend Live Clean Points", asfExtendedStreamProperties.DoResendLiveCleanpoints); Properties.Add("Language Index", asfExtendedStreamProperties.LanguageIndex); }