mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-31 04:09:32 -06:00
added overall bitrate to video info
This commit is contained in:
@@ -24,6 +24,7 @@ namespace FileFlows.VideoNodes
|
||||
{ "vi.Duration", 1800 },
|
||||
{ "vi.VideoInfo", new VideoInfo()
|
||||
{
|
||||
Bitrate = 10_000_000,
|
||||
VideoStreams = new List<VideoStream> {
|
||||
new VideoStream { }
|
||||
},
|
||||
|
||||
@@ -17,7 +17,8 @@ namespace VideoNodes.Tests
|
||||
public void VideoInfoTest_JudgeDreed()
|
||||
{
|
||||
var vi = new VideoInfoHelper(@"C:\utils\ffmpeg\ffmpeg.exe", new TestLogger());
|
||||
vi.Read(@"D:\videos\unprocessed\Hellboy 2019 Bluray-1080p.mp4");
|
||||
var info = vi.Read(@"D:\videos\unprocessed\Injustice.mkv");
|
||||
Assert.IsNotNull(info);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ namespace FileFlows.VideoNodes
|
||||
public class VideoInfo
|
||||
{
|
||||
public string FileName { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the bitrate in bytes per second
|
||||
/// </summary>
|
||||
public float Bitrate { get; set; }
|
||||
public List<VideoStream> VideoStreams { get; set; } = new List<VideoStream>();
|
||||
public List<AudioStream> AudioStreams { get; set; } = new List<AudioStream>();
|
||||
public List<SubtitleStream> SubtitleStreams { get; set; } = new List<SubtitleStream>();
|
||||
@@ -24,7 +28,7 @@ namespace FileFlows.VideoNodes
|
||||
public string Title { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// The bitrate(BPS) of the video stream
|
||||
/// The bitrate(BPS) of the video stream in bytes per second
|
||||
/// </summary>
|
||||
public float Bitrate { get; set; }
|
||||
|
||||
|
||||
@@ -67,6 +67,15 @@ namespace FileFlows.VideoNodes
|
||||
var streamMatches = rgxStreams.Matches(output);
|
||||
int streamIndex = 0;
|
||||
|
||||
|
||||
// get a rough estimate, bitrate: 346 kb/s
|
||||
var rgxBitrate = new Regex(@"(?<=(bitrate: ))[\d\.]+(?!=( kb/s))");
|
||||
var brMatch = rgxBitrate.Match(output);
|
||||
if (brMatch.Success)
|
||||
{
|
||||
vi.Bitrate = float.Parse(brMatch.Value) * 1_000; // to convert to b/s
|
||||
}
|
||||
|
||||
int subtitleIndex = 1;
|
||||
foreach (Match sm in streamMatches)
|
||||
{
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user