added option for dolby vision

This commit is contained in:
John Andrews
2022-11-24 21:12:38 +13:00
parent a81d4f3a9c
commit 1ad920d5d8
3 changed files with 241 additions and 188 deletions

View File

@@ -1,76 +1,76 @@
#if(DEBUG)
using System.Reflection.Metadata;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FileFlows.AudioNodes.AudioBooks;
namespace FileFlows.AudioNodes.Tests;
[TestClass]
public class CreateAudioBookTests
{
[TestMethod]
public void CreateAudioBookTest_01()
{
const string folder = "/home/john/Music/Audio Books/James Dashner (2020) Maze Runner 05.5";
RunTest(folder);
}
[TestMethod]
public void CreateAudioBookTest_02()
{
const string folder = @"/home/john/Music/Audio Books/Charlie and the Great Glass Elevator";
RunTest(folder);
}
[TestMethod]
public void CreateAudioBookTest_03()
{
const string folder = @"/home/john/Music/Audio Books/Scott Westerfeld - Afterworlds";
RunTest(folder);
}
[TestMethod]
public void CreateAudioBookTest_04()
{
const string folder = @"/home/john/Music/Audio Books/Small Town-Lawrence Block";
RunTest(folder);
}
[TestMethod]
public void CreateAudioBookTest_05()
{
const string folder = @"/home/john/Music/Audio Books/Shatter City";
RunTest(folder, 2);
}
[TestMethod]
public void CreateAudioBookTest_06()
{
const string folder = @"/home/john/Music/Audio Books/Among the Betrayed - Margaret Peterson Haddix (M4B)";
RunTest(folder, 2);
}
private void RunTest(string folder, int expected = 1)
{
CreateAudioBook node = new ();
var logger = new TestLogger();
var args = new FileFlows.Plugin.NodeParameters(folder,logger, true, string.Empty);
args.GetToolPathActual = (string tool) => @"/usr/bin/ffmpeg";
const string tempPath= @"/home/john/Music/test";
args.TempPath =tempPath ;
foreach (var file in new DirectoryInfo(tempPath).GetFiles( "*.*"))
{
file.Delete();
}
int output = node.Execute(args);
var log = logger.ToString();
Assert.AreEqual(expected, output);
}
}
#endif
// #if(DEBUG)
//
// using System.Reflection.Metadata;
// using Microsoft.VisualStudio.TestTools.UnitTesting;
// using FileFlows.AudioNodes.AudioBooks;
//
// namespace FileFlows.AudioNodes.Tests;
//
//
// [TestClass]
// public class CreateAudioBookTests
// {
//
// [TestMethod]
// public void CreateAudioBookTest_01()
// {
// const string folder = "/home/john/Music/Audio Books/James Dashner (2020) Maze Runner 05.5";
// RunTest(folder);
// }
//
// [TestMethod]
// public void CreateAudioBookTest_02()
// {
// const string folder = @"/home/john/Music/Audio Books/Charlie and the Great Glass Elevator";
// RunTest(folder);
// }
//
// [TestMethod]
// public void CreateAudioBookTest_03()
// {
// const string folder = @"/home/john/Music/Audio Books/Scott Westerfeld - Afterworlds";
// RunTest(folder);
// }
//
// [TestMethod]
// public void CreateAudioBookTest_04()
// {
// const string folder = @"/home/john/Music/Audio Books/Small Town-Lawrence Block";
// RunTest(folder);
// }
//
// [TestMethod]
// public void CreateAudioBookTest_05()
// {
// const string folder = @"/home/john/Music/Audio Books/Shatter City";
// RunTest(folder, 2);
// }
//
// [TestMethod]
// public void CreateAudioBookTest_06()
// {
// const string folder = @"/home/john/Music/Audio Books/Among the Betrayed - Margaret Peterson Haddix (M4B)";
// RunTest(folder, 2);
// }
//
// private void RunTest(string folder, int expected = 1)
// {
// CreateAudioBook node = new ();
// var logger = new TestLogger();
// var args = new FileFlows.Plugin.NodeParameters(folder,logger, true, string.Empty);
// args.GetToolPathActual = (string tool) => @"/usr/bin/ffmpeg";
// const string tempPath= @"/home/john/Music/test";
// args.TempPath =tempPath ;
// foreach (var file in new DirectoryInfo(tempPath).GetFiles( "*.*"))
// {
// file.Delete();
// }
//
// int output = node.Execute(args);
//
// var log = logger.ToString();
// Assert.AreEqual(expected, output);
//
// }
// }
// #endif

View File

@@ -1,131 +1,182 @@
namespace FileFlows.VideoNodes
namespace FileFlows.VideoNodes;
/// <summary>
/// Metadata about a video file
/// </summary>
public class VideoInfo
{
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>();
/// <summary>
/// Gets or sets the full filename of the file
/// </summary>
public string FileName { get; set; }
/// <summary>
/// Gets or sets the bitrate in bytes per second
/// </summary>
public float Bitrate { get; set; }
/// <summary>
/// Gets or sets the video streams contained in the file
/// </summary>
public List<VideoStream> VideoStreams { get; set; } = new List<VideoStream>();
/// <summary>
/// Gets or sets the audio streams contained in the file
/// </summary>
public List<AudioStream> AudioStreams { get; set; } = new List<AudioStream>();
/// <summary>
/// Gets or sets the subtitle streams contained in the file
/// </summary>
public List<SubtitleStream> SubtitleStreams { get; set; } = new List<SubtitleStream>();
public List<Chapter> Chapters { get; set; } = new List<Chapter>();
}
/// <summary>
/// Gets or sets the chapters in the file
/// </summary>
public List<Chapter> Chapters { get; set; } = new List<Chapter>();
}
public class VideoFileStream
{
/// <summary>
/// The original index of the stream in the overall video
/// </summary>
public int Index { get; set; }
/// <summary>
/// The index of the specific type
/// </summary>
public int TypeIndex { get; set; }
/// <summary>
/// The stream title (name)
/// </summary>
public string Title { get; set; } = "";
/// <summary>
/// Metadata about a stream in a vidoe file
/// </summary>
public class VideoFileStream
{
/// <summary>
/// The original index of the stream in the overall video
/// </summary>
public int Index { get; set; }
/// <summary>
/// The index of the specific type
/// </summary>
public int TypeIndex { get; set; }
/// <summary>
/// The stream title (name)
/// </summary>
public string Title { get; set; } = "";
/// <summary>
/// The bitrate(BPS) of the video stream in bytes per second
/// </summary>
public float Bitrate { get; set; }
/// <summary>
/// The bitrate(BPS) of the video stream in bytes per second
/// </summary>
public float Bitrate { get; set; }
/// <summary>
/// The codec of the stream
/// </summary>
public string Codec { get; set; } = "";
/// <summary>
/// The codec of the stream
/// </summary>
public string Codec { get; set; } = "";
/// <summary>
/// The codec tag of the stream
/// </summary>
public string CodecTag { get; set; } = "";
/// <summary>
/// The codec tag of the stream
/// </summary>
public string CodecTag { get; set; } = "";
/// <summary>
/// If this stream is an image
/// </summary>
public bool IsImage { get; set; }
/// <summary>
/// If this stream is an image
/// </summary>
public bool IsImage { get; set; }
/// <summary>
/// Gets or sets the index string of this track
/// </summary>
public string IndexString { get; set; }
/// <summary>
/// Gets or sets the index string of this track
/// </summary>
public string IndexString { get; set; }
/// <summary>
/// Gets or sets if the stream is HDR
/// </summary>
public bool HDR { get; set; }
/// <summary>
/// Gets or sets the input file index
/// </summary>
public int InputFileIndex { get; set; } = 0;
}
/// <summary>
/// Gets or sets the input file index
/// </summary>
public int InputFileIndex { get; set; } = 0;
}
/// <summary>
/// Metadata about a video stream
/// </summary>
public class VideoStream : VideoFileStream
{
/// <summary>
/// Gets or sets if the stream is HDR
/// </summary>
public bool HDR { get; set; }
/// <summary>
/// Gets or sets if this is dolby vision
/// </summary>
public bool DolbyVision { get; set; }
/// <summary>
/// The width of the video stream
/// </summary>
public int Width { get; set; }
/// <summary>
/// The height of the video stream
/// </summary>
public int Height { get; set; }
/// <summary>
/// The number of frames per second
/// </summary>
public float FramesPerSecond { get; set; }
public class VideoStream : VideoFileStream
{
/// <summary>
/// The width of the video stream
/// </summary>
public int Width { get; set; }
/// <summary>
/// The height of the video stream
/// </summary>
public int Height { get; set; }
/// <summary>
/// The number of frames per second
/// </summary>
public float FramesPerSecond { get; set; }
/// <summary>
/// The duration of the stream
/// </summary>
public TimeSpan Duration { get; set; }
}
/// <summary>
/// The duration of the stream
/// </summary>
public TimeSpan Duration { get; set; }
}
/// <summary>
/// Metadata about an audio stream in a video file
/// </summary>
public class AudioStream : VideoFileStream
{
/// <summary>
/// The language of the stream
/// </summary>
public string Language { get; set; }
public class AudioStream : VideoFileStream
{
/// <summary>
/// The language of the stream
/// </summary>
public string Language { get; set; }
/// <summary>
/// The channels of the stream
/// </summary>
public float Channels { get; set; }
/// <summary>
/// The channels of the stream
/// </summary>
public float Channels { get; set; }
/// <summary>
/// The duration of the stream
/// </summary>
public TimeSpan Duration { get; set; }
/// <summary>
/// The duration of the stream
/// </summary>
public TimeSpan Duration { get; set; }
/// <summary>
/// The sample rate of the audio stream
/// </summary>
public int SampleRate { get; set; }
}
/// <summary>
/// The sample rate of the audio stream
/// </summary>
public int SampleRate { get; set; }
}
/// <summary>
/// Metadata about a subtitle stream in a video file
/// </summary>
public class SubtitleStream : VideoFileStream
{
/// <summary>
/// The language of the stream
/// </summary>
public string Language { get; set; }
public class SubtitleStream : VideoFileStream
{
/// <summary>
/// The language of the stream
/// </summary>
public string Language { get; set; }
/// <summary>
/// If this is a forced subtitle
/// </summary>
public bool Forced { get; set; }
}
/// <summary>
/// If this is a forced subtitle
/// </summary>
public bool Forced { get; set; }
}
public class Chapter
{
public string Title { get; set; }
public TimeSpan Start { get; set; }
public TimeSpan End { get; set; }
}
/// <summary>
/// A chapter in a video file
/// </summary>
public class Chapter
{
/// <summary>
/// Gets or sets the title of the stream
/// </summary>
public string Title { get; set; }
/// <summary>
/// Gets or sets the start of the chapter
/// </summary>
public TimeSpan Start { get; set; }
/// <summary>
/// Gets or sets the end of the chapter
/// </summary>
public TimeSpan End { get; set; }
}

View File

@@ -269,6 +269,8 @@ namespace FileFlows.VideoNodes
// "HDR is only the new transfer function" (PQ or HLG)
vs.HDR = info.Contains("arib-std-b67") || info.Contains("smpte2084");
vs.DolbyVision = info.Contains("DOVI configuration record");
return vs;
}