mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
Merge pull request #351 from keg247/sample-aspect-ratio
Add SampleAspectRatio property to VideoStream
This commit is contained in:
commit
9727ec5cfe
4 changed files with 39 additions and 32 deletions
|
@ -1,10 +1,10 @@
|
||||||
using System;
|
using FFMpegCore.Test.Resources;
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using FFMpegCore.Test.Resources;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
|
|
||||||
namespace FFMpegCore.Test
|
namespace FFMpegCore.Test
|
||||||
{
|
{
|
||||||
|
@ -125,6 +125,8 @@ public void Probe_Success()
|
||||||
Assert.AreEqual(1471810, info.PrimaryVideoStream!.BitRate);
|
Assert.AreEqual(1471810, info.PrimaryVideoStream!.BitRate);
|
||||||
Assert.AreEqual(16, info.PrimaryVideoStream.DisplayAspectRatio.Width);
|
Assert.AreEqual(16, info.PrimaryVideoStream.DisplayAspectRatio.Width);
|
||||||
Assert.AreEqual(9, info.PrimaryVideoStream.DisplayAspectRatio.Height);
|
Assert.AreEqual(9, info.PrimaryVideoStream.DisplayAspectRatio.Height);
|
||||||
|
Assert.AreEqual(1, info.PrimaryVideoStream.SampleAspectRatio.Width);
|
||||||
|
Assert.AreEqual(1, info.PrimaryVideoStream.SampleAspectRatio.Height);
|
||||||
Assert.AreEqual("yuv420p", info.PrimaryVideoStream.PixelFormat);
|
Assert.AreEqual("yuv420p", info.PrimaryVideoStream.PixelFormat);
|
||||||
Assert.AreEqual(1280, info.PrimaryVideoStream.Width);
|
Assert.AreEqual(1280, info.PrimaryVideoStream.Width);
|
||||||
Assert.AreEqual(720, info.PrimaryVideoStream.Height);
|
Assert.AreEqual(720, info.PrimaryVideoStream.Height);
|
||||||
|
|
|
@ -53,6 +53,9 @@ public class FFProbeStream : ITagsContainer, IDispositionContainer
|
||||||
[JsonPropertyName("display_aspect_ratio")]
|
[JsonPropertyName("display_aspect_ratio")]
|
||||||
public string DisplayAspectRatio { get; set; } = null!;
|
public string DisplayAspectRatio { get; set; } = null!;
|
||||||
|
|
||||||
|
[JsonPropertyName("sample_aspect_ratio")]
|
||||||
|
public string SampleAspectRatio { get; set; } = null!;
|
||||||
|
|
||||||
[JsonPropertyName("duration")]
|
[JsonPropertyName("duration")]
|
||||||
public string Duration { get; set; } = null!;
|
public string Duration { get; set; } = null!;
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ private VideoStream ParseVideoStream(FFProbeStream stream)
|
||||||
CodecTag = stream.CodecTag,
|
CodecTag = stream.CodecTag,
|
||||||
CodecTagString = stream.CodecTagString,
|
CodecTagString = stream.CodecTagString,
|
||||||
DisplayAspectRatio = MediaAnalysisUtils.ParseRatioInt(stream.DisplayAspectRatio, ':'),
|
DisplayAspectRatio = MediaAnalysisUtils.ParseRatioInt(stream.DisplayAspectRatio, ':'),
|
||||||
|
SampleAspectRatio = MediaAnalysisUtils.ParseRatioInt(stream.SampleAspectRatio, ':'),
|
||||||
Duration = MediaAnalysisUtils.ParseDuration(stream),
|
Duration = MediaAnalysisUtils.ParseDuration(stream),
|
||||||
FrameRate = MediaAnalysisUtils.DivideRatio(MediaAnalysisUtils.ParseRatioDouble(stream.FrameRate, '/')),
|
FrameRate = MediaAnalysisUtils.DivideRatio(MediaAnalysisUtils.ParseRatioDouble(stream.FrameRate, '/')),
|
||||||
Height = stream.Height ?? 0,
|
Height = stream.Height ?? 0,
|
||||||
|
|
|
@ -7,6 +7,7 @@ public class VideoStream : MediaStream
|
||||||
public double AvgFrameRate { get; set; }
|
public double AvgFrameRate { get; set; }
|
||||||
public int BitsPerRawSample { get; set; }
|
public int BitsPerRawSample { get; set; }
|
||||||
public (int Width, int Height) DisplayAspectRatio { get; set; }
|
public (int Width, int Height) DisplayAspectRatio { get; set; }
|
||||||
|
public (int Width, int Height) SampleAspectRatio { get; set; }
|
||||||
public string Profile { get; set; } = null!;
|
public string Profile { get; set; } = null!;
|
||||||
public int Width { get; set; }
|
public int Width { get; set; }
|
||||||
public int Height { get; set; }
|
public int Height { get; set; }
|
||||||
|
|
Loading…
Reference in a new issue