Added CodecTag and CodecTagString properties to info derived from an FFProbe.Analyse() call. This allows for specific codecs to be identified to check compatibility with hardware limitations.

This commit is contained in:
Warrick Wilson 2021-08-09 14:52:39 -05:00
parent 292841e40d
commit ac2b358fad
4 changed files with 16 additions and 0 deletions

View file

@ -63,6 +63,8 @@ public void Probe_Success()
Assert.AreEqual("LC", info.PrimaryAudioStream.Profile);
Assert.AreEqual(377351, info.PrimaryAudioStream.BitRate);
Assert.AreEqual(48000, info.PrimaryAudioStream.SampleRateHz);
Assert.AreEqual("mp4a", info.PrimaryAudioStream.CodecTagString);
Assert.AreEqual("0x6134706d", info.PrimaryAudioStream.CodecTag);
Assert.AreEqual(1471810, info.PrimaryVideoStream!.BitRate);
Assert.AreEqual(16, info.PrimaryVideoStream.DisplayAspectRatio.Width);
@ -76,6 +78,8 @@ public void Probe_Success()
Assert.AreEqual("h264", info.PrimaryVideoStream.CodecName);
Assert.AreEqual(8, info.PrimaryVideoStream.BitsPerRawSample);
Assert.AreEqual("Main", info.PrimaryVideoStream.Profile);
Assert.AreEqual("avc1", info.PrimaryVideoStream.CodecTagString);
Assert.AreEqual("0x31637661", info.PrimaryVideoStream.CodecTag);
}
[TestMethod, Timeout(10000)]

View file

@ -41,6 +41,12 @@ public class FFProbeStream : ITagsContainer
[JsonPropertyName("codec_long_name")]
public string CodecLongName { get; set; } = null!;
[JsonPropertyName("codec_tag")]
public string CodecTag { get; set; } = null!;
[JsonPropertyName("codec_tag_string")]
public string CodecTagString { get; set; } = null!;
[JsonPropertyName("display_aspect_ratio")]
public string DisplayAspectRatio { get; set; } = null!;

View file

@ -56,6 +56,8 @@ private VideoStream ParseVideoStream(FFProbeStream stream)
BitsPerRawSample = !string.IsNullOrEmpty(stream.BitsPerRawSample) ? MediaAnalysisUtils.ParseIntInvariant(stream.BitsPerRawSample) : default,
CodecName = stream.CodecName,
CodecLongName = stream.CodecLongName,
CodecTag = stream.CodecTag,
CodecTagString = stream.CodecTagString,
DisplayAspectRatio = MediaAnalysisUtils.ParseRatioInt(stream.DisplayAspectRatio, ':'),
Duration = MediaAnalysisUtils.ParseDuration(stream),
FrameRate = MediaAnalysisUtils.DivideRatio(MediaAnalysisUtils.ParseRatioDouble(stream.FrameRate, '/')),
@ -77,6 +79,8 @@ private AudioStream ParseAudioStream(FFProbeStream stream)
BitRate = !string.IsNullOrEmpty(stream.BitRate) ? MediaAnalysisUtils.ParseIntInvariant(stream.BitRate) : default,
CodecName = stream.CodecName,
CodecLongName = stream.CodecLongName,
CodecTag = stream.CodecTag,
CodecTagString = stream.CodecTagString,
Channels = stream.Channels ?? default,
ChannelLayout = stream.ChannelLayout,
Duration = MediaAnalysisUtils.ParseDuration(stream),

View file

@ -10,6 +10,8 @@ public class MediaStream
public int Index { get; internal set; }
public string CodecName { get; internal set; } = null!;
public string CodecLongName { get; internal set; } = null!;
public string CodecTagString { get; set; } = null!;
public string CodecTag { get; set; } = null!;
public int BitRate { get; internal set; }
public TimeSpan Duration { get; internal set; }
public string? Language { get; internal set; }