mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 08:34:12 +01:00
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:
parent
292841e40d
commit
ac2b358fad
4 changed files with 16 additions and 0 deletions
|
@ -63,6 +63,8 @@ public void Probe_Success()
|
||||||
Assert.AreEqual("LC", info.PrimaryAudioStream.Profile);
|
Assert.AreEqual("LC", info.PrimaryAudioStream.Profile);
|
||||||
Assert.AreEqual(377351, info.PrimaryAudioStream.BitRate);
|
Assert.AreEqual(377351, info.PrimaryAudioStream.BitRate);
|
||||||
Assert.AreEqual(48000, info.PrimaryAudioStream.SampleRateHz);
|
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(1471810, info.PrimaryVideoStream!.BitRate);
|
||||||
Assert.AreEqual(16, info.PrimaryVideoStream.DisplayAspectRatio.Width);
|
Assert.AreEqual(16, info.PrimaryVideoStream.DisplayAspectRatio.Width);
|
||||||
|
@ -76,6 +78,8 @@ public void Probe_Success()
|
||||||
Assert.AreEqual("h264", info.PrimaryVideoStream.CodecName);
|
Assert.AreEqual("h264", info.PrimaryVideoStream.CodecName);
|
||||||
Assert.AreEqual(8, info.PrimaryVideoStream.BitsPerRawSample);
|
Assert.AreEqual(8, info.PrimaryVideoStream.BitsPerRawSample);
|
||||||
Assert.AreEqual("Main", info.PrimaryVideoStream.Profile);
|
Assert.AreEqual("Main", info.PrimaryVideoStream.Profile);
|
||||||
|
Assert.AreEqual("avc1", info.PrimaryVideoStream.CodecTagString);
|
||||||
|
Assert.AreEqual("0x31637661", info.PrimaryVideoStream.CodecTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod, Timeout(10000)]
|
[TestMethod, Timeout(10000)]
|
||||||
|
|
|
@ -41,6 +41,12 @@ public class FFProbeStream : ITagsContainer
|
||||||
[JsonPropertyName("codec_long_name")]
|
[JsonPropertyName("codec_long_name")]
|
||||||
public string CodecLongName { get; set; } = null!;
|
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")]
|
[JsonPropertyName("display_aspect_ratio")]
|
||||||
public string DisplayAspectRatio { get; set; } = null!;
|
public string DisplayAspectRatio { get; set; } = null!;
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,8 @@ private VideoStream ParseVideoStream(FFProbeStream stream)
|
||||||
BitsPerRawSample = !string.IsNullOrEmpty(stream.BitsPerRawSample) ? MediaAnalysisUtils.ParseIntInvariant(stream.BitsPerRawSample) : default,
|
BitsPerRawSample = !string.IsNullOrEmpty(stream.BitsPerRawSample) ? MediaAnalysisUtils.ParseIntInvariant(stream.BitsPerRawSample) : default,
|
||||||
CodecName = stream.CodecName,
|
CodecName = stream.CodecName,
|
||||||
CodecLongName = stream.CodecLongName,
|
CodecLongName = stream.CodecLongName,
|
||||||
|
CodecTag = stream.CodecTag,
|
||||||
|
CodecTagString = stream.CodecTagString,
|
||||||
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, '/')),
|
||||||
|
@ -77,6 +79,8 @@ private AudioStream ParseAudioStream(FFProbeStream stream)
|
||||||
BitRate = !string.IsNullOrEmpty(stream.BitRate) ? MediaAnalysisUtils.ParseIntInvariant(stream.BitRate) : default,
|
BitRate = !string.IsNullOrEmpty(stream.BitRate) ? MediaAnalysisUtils.ParseIntInvariant(stream.BitRate) : default,
|
||||||
CodecName = stream.CodecName,
|
CodecName = stream.CodecName,
|
||||||
CodecLongName = stream.CodecLongName,
|
CodecLongName = stream.CodecLongName,
|
||||||
|
CodecTag = stream.CodecTag,
|
||||||
|
CodecTagString = stream.CodecTagString,
|
||||||
Channels = stream.Channels ?? default,
|
Channels = stream.Channels ?? default,
|
||||||
ChannelLayout = stream.ChannelLayout,
|
ChannelLayout = stream.ChannelLayout,
|
||||||
Duration = MediaAnalysisUtils.ParseDuration(stream),
|
Duration = MediaAnalysisUtils.ParseDuration(stream),
|
||||||
|
|
|
@ -10,6 +10,8 @@ public class MediaStream
|
||||||
public int Index { get; internal set; }
|
public int Index { get; internal set; }
|
||||||
public string CodecName { get; internal set; } = null!;
|
public string CodecName { get; internal set; } = null!;
|
||||||
public string CodecLongName { 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 int BitRate { get; internal set; }
|
||||||
public TimeSpan Duration { get; internal set; }
|
public TimeSpan Duration { get; internal set; }
|
||||||
public string? Language { get; internal set; }
|
public string? Language { get; internal set; }
|
||||||
|
|
Loading…
Reference in a new issue