private static void RunWithOptions(Options options) { string workingDirectory = options.TempDir ?? Environment.CurrentDirectory; string outputPath = options.OutputPath ?? Path.GetDirectoryName(Path.GetFullPath(options.InputFile)); string outputName = options.OutputFilename ?? Path.GetFileNameWithoutExtension(options.InputFile); if (!File.Exists(options.InputFile)) { Console.Error.WriteLine("Input file doesn't exist."); return; } var outputCallback = new Action <string>((x) => { Console.WriteLine(x); }); var errorCallback = new Action <string>((x) => { Console.Error.WriteLine(x); }); var encoder = new Encoder(options.FFmpegPath, options.FFprobePath, options.BoxPath, outputCallback, errorCallback, workingDirectory) { DisableQualityCrushing = options.DisableCrushing, EnableStreamCopying = !options.DisableStreamCopying }; var qualities = Quality.GenerateDefaultQualities(options.Quality, options.Preset); var progress = new Progress <IEnumerable <EncodeStageProgress> >(WriteProgress); DashEncodeResult result = null; try { running = true; result = encoder.GenerateDash( options.InputFile, outputName, options.Framerate, options.KeyInterval, qualities, outDirectory: outputPath, cancel: cancelToken.Token, progress: progress); } finally { running = false; } if (result != null) { HandleDelete(options.DeleteBehavior, options.InputFile); Console.WriteLine("MPD Generated: " + result.DashFilePath); Console.WriteLine("Media files:"); Console.Write(string.Join('\n', result.MediaFiles)); Environment.Exit(0); } Console.Error.WriteLine("Failed to produce files. Exiting..."); Environment.Exit(3); }
public IActionResult TestStatus(long transactionId) { var quality = Quality.GenerateDefaultQualities(DEnc.DefaultQuality.medium, DEnc.H264Preset.fast).ToHashSet(); var items = new Dictionary <string, object> { { "queued", new List <ExportableConversionItem>() { new ConversionItem("SomeLibrary", "The TEST", "Test #1", "/home/test/vid/vid1.mkv", "/home/output/", "testitem", true, quality, 24, null, null), new ConversionItem("SomeLibrary", null, null, "/home/test/vid/vid2.mkv", "/home/output/", "testitem2", true, quality, 24, null, null) } }, { "processing", new List <ExportableConversionItem>() { new ConversionItem("SomeLibrary", "The TEST", "Test #3", "/home/test/vid/vid3.mkv", "/home/output/", "processItem", true, quality, 24, null, null) { Progress = new List <DescribedProgress>() { new DescribedProgress("Encoding", 0.25) } }, new ConversionItem("SomeLibrary", null, null, "/home/test/vid/vid4.mkv", "/home/output/", "processItem2", true, quality, 24, null, null) { Progress = new List <DescribedProgress>() { new DescribedProgress("Encoding", 1), new DescribedProgress("Upload", 0.47) } }, new ConversionItem("SomeLibrary", null, null, "/home/test/vid/vid5.mkv", "/home/output/", "processItem3", true, quality, 24, null, null) { Progress = new List <DescribedProgress>() { new DescribedProgress("Encoding", 1), new DescribedProgress(@"Upload C:\path\to\the\temp\directory\long\path\videos\temp\vid5 video something.mp4", 0.36), new DescribedProgress(@"Upload C:\path\to\the\temp\directory\long\path\videos\temp\vid5 audio something.eng.mp4", 0.11), new DescribedProgress(@"Upload C:\path\to\the\temp\directory\long\path\videos\temp\vid5 audio something.jpn.mp4", 0.68), new DescribedProgress(@"Upload C:\path\to\the\temp\directory\long\path\videos\temp\vid5 something.eng.vtt", 1), new DescribedProgress(@"Upload C:\path\to\the\temp\directory\long\path\videos\temp\vid5 something.jpn.vtt", 1) } } } } }; return(new ObjectResult(Newtonsoft.Json.JsonConvert.SerializeObject(items))); }
public IActionResult TestCompletedItems() { var quality = Quality.GenerateDefaultQualities(DEnc.DefaultQuality.medium, DEnc.H264Preset.fast).ToHashSet(); var items = new CompleteItems <ExportableConversionItem>() { new ConversionItem("SomeLibrary", "The COMPLETE", "Test #6", "/home/test/vid/vid6.mkv", "/home/output/", "completeitem1", true, quality, 24, null, null), new ConversionItem("SomeLibrary", "The FAILED", "Test #7", "/home/test/vid/vid7.mkv", "/home/output/", "completeitem2", true, quality, 24, null, null) { ErrorReason = "Task failed successfully. Reason: Not enough", ErrorDetail = "This is a very long error message which contains all kinds of stack trace information and logs or whatever.\n" + "NullProblemException: There is no issue.\n" + " at Volyar.Testing.TestCompletion()\n" + " at Volar.Testing.FakeStackTraceGenerator()\n" + " at System.Runtime.LoremIpsum()\n" + "Running ffmpeg with arguments: -i something -a -b -c -d A bunch of arguments for ffmpeg which takes up a ridiculous amount of space.\n" + "frame= 365 fps=0.0 q=-1.0 size= 22525kB time=00:00:15.27 bitrate=12077.9kbits/s speed=30.6x\n" + "frame= 882 fps=882 q=-1.0 size= 42585kB time=00:00:36.80 bitrate=9479.1kbits/s speed=36.8x\n" + "frame= 1434 fps=956 q=-1.0 size= 58536kB time=00:00:59.86 bitrate=8010.8kbits/s speed=39.9x\n" + "frame= 1986 fps=993 q=-1.0 size= 74108kB time=00:01:22.82 bitrate=7329.9kbits/s speed=41.4x\n" + "frame= 2445 fps=978 q=-1.0 size= 86742kB time=00:01:42.07 bitrate=6961.5kbits/s speed=40.8x\n" + "frame= 2823 fps=941 q=-1.0 size= 96733kB time=00:01:57.79 bitrate=6727.3kbits/s speed=39.2x\n" + "frame= 3261 fps=931 q=-1.0 size= 111247kB time=00:02:16.02 bitrate=6699.9kbits/s speed=38.8x\n" + "frame= 3716 fps=928 q=-1.0 size= 129424kB time=00:02:35.01 bitrate=6839.5kbits/s speed=38.7x\n" + "frame= 4215 fps=936 q=-1.0 size= 154043kB time=00:02:55.89 bitrate=7174.5kbits/s speed=39.1x\n" + "frame= 4609 fps=921 q=-1.0 size= 169230kB time=00:03:12.19 bitrate=7213.3kbits/s speed=38.4x\n" + "frame= 4986 fps=906 q=-1.0 size= 178219kB time=00:03:28.02 bitrate=7018.2kbits/s speed=37.8x\n" + "frame= 5491 fps=915 q=-1.0 size= 194228kB time=00:03:49.11 bitrate=6944.7kbits/s speed=38.2x\n" + "frame= 6044 fps=929 q=-1.0 size= 224348kB time=00:04:12.05 bitrate=7291.6kbits/s speed=38.8x\n" + "frame= 6613 fps=944 q=-1.0 size= 259268kB time=00:04:35.89 bitrate=7698.2kbits/s speed=39.4x\n" + "frame= 7244 fps=965 q=-1.0 size= 296714kB time=00:05:02.16 bitrate=8044.3kbits/s speed=40.3x\n" + "frame= 7860 fps=982 q=-1.0 size= 328630kB time=00:05:27.84 bitrate=8211.7kbits/s speed= 41x\n" + "frame= 8373 fps=985 q=-1.0 size= 350555kB time=00:05:49.25 bitrate=8222.6kbits/s speed=41.1x\n" + "frame= 8851 fps=983 q=-1.0 size= 370039kB time=00:06:09.17 bitrate=8211.2kbits/s speed= 41x\n" + "frame= 9305 fps=979 q=-1.0 size= 385474kB time=00:06:28.14 bitrate=8135.7kbits/s speed=40.8x\n" + "frame= 9858 fps=985 q=-1.0 size= 419481kB time=00:06:51.24 bitrate=8356.0kbits/s speed=41.1x\n" + "frame=10373 fps=987 q=-1.0 size= 443169kB time=00:07:12.74 bitrate=8389.2kbits/s speed=41.2x\n" + "Error! This is the end of the log, good luck!" } }; return(new ObjectResult(Newtonsoft.Json.JsonConvert.SerializeObject(items))); }