Skip to content

Commit

Permalink
Test: merge BarsOne
Browse files Browse the repository at this point in the history
  • Loading branch information
tqk2811 committed Jan 5, 2022
1 parent 6c888ce commit 0da7ac4
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 70 deletions.
123 changes: 123 additions & 0 deletions FFmpegArgs.Test/TanersenerSlideShow/BarsOne.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
using FFmpegArgs.Filters.Enums;
using FFmpegArgs.Filters.MultimediaFilters;
using FFmpegArgs.Filters.VideoFilters;
using FFmpegArgs.Filters.VideoSources;
using FFmpegArgs.Inputs;
using FFmpegArgs.Outputs;
using FFmpegArgs.Filters;
using FFmpegArgs;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Collections;
using FFmpegArgs.Executes;
using FFmpegArgs.Cores.Maps;
using System.Diagnostics;

namespace FFmpegArgs.Test.TanersenerSlideShow
{
[TestClass]
public class BarsOne
{
[TestMethod]
public void BarsOneVerticalTest_Blur()
{
Config config = new Config();
BarsOneVerticalTest(config,ScreenMode.Blur);
}


public void BarsOneVerticalTest(Config config, ScreenMode screenMode)
{
string outputFileName = $"{nameof(BarsOneVerticalTest)}-{screenMode}.mp4";
string filterFileName = $"{nameof(BarsOneVerticalTest)}-{screenMode}.txt";
FFmpegArg ffmpegArg = new FFmpegArg().OverWriteOutput();
var images_inputmap = ffmpegArg.GetImagesInput();

int BAR_COUNT = 16;

TimeSpan TOTAL_DURATION = (config.ImageDuration + config.TransitionDuration) * images_inputmap.Count - config.TransitionDuration;

List<IEnumerable<ImageMap>> prepareInputs = images_inputmap.InputScreenModes(screenMode, config);

var overlaids = prepareInputs.Select(x => x.First()).Overlaids(config);

var startEnd = prepareInputs.Select(x => x.Last()).ToList().StartEnd(config);

var blendeds = startEnd.Blendeds(config, blend => blend
.Shortest(true)
.All_Expr($"if((lte(mod(X,({config.Size.Width}/{BAR_COUNT})),({config.Size.Width}/{BAR_COUNT})*T/{config.TransitionDuration.TotalSeconds})),A,B)"));

var out_map = overlaids.ConcatOverlaidsAndBlendeds(blendeds);

//Output
ImageFileOutput imageFileOutput = new ImageFileOutput(outputFileName, out_map);
imageFileOutput
.VSync(VSyncMethod.vfr)
.SetOption("-c:v", "libx264")
.Fps(config.Fps)
.SetOption("-g", "0")
.SetOption("-rc-lookahead", "0");

ffmpegArg.AddOutput(imageFileOutput);

ffmpegArg.TestRender(filterFileName, outputFileName);
}









[TestMethod]
public void BarsOneHorizontalTest_Blur()
{
Config config = new Config();
BarsOneHorizontalTest(config, ScreenMode.Blur);
}


public void BarsOneHorizontalTest(Config config, ScreenMode screenMode)
{
string outputFileName = $"{nameof(BarsOneHorizontalTest)}-{screenMode}.mp4";
string filterFileName = $"{nameof(BarsOneHorizontalTest)}-{screenMode}.txt";
FFmpegArg ffmpegArg = new FFmpegArg().OverWriteOutput();
var images_inputmap = ffmpegArg.GetImagesInput();

int BAR_COUNT = 16;

TimeSpan TOTAL_DURATION = (config.ImageDuration + config.TransitionDuration) * images_inputmap.Count - config.TransitionDuration;

List<IEnumerable<ImageMap>> prepareInputs = images_inputmap.InputScreenModes(screenMode, config);

var overlaids = prepareInputs.Select(x => x.First()).Overlaids(config);

var startEnd = prepareInputs.Select(x => x.Last()).ToList().StartEnd(config);

var blendeds = startEnd.Blendeds(config, blend => blend
.Shortest(true)
.All_Expr($"if((lte(mod(Y,({config.Size.Height}/{BAR_COUNT})),({config.Size.Height}/{BAR_COUNT})*T/{config.TransitionDuration.TotalSeconds})),A,B)"));

var out_map = overlaids.ConcatOverlaidsAndBlendeds(blendeds);

//Output
ImageFileOutput imageFileOutput = new ImageFileOutput(outputFileName, out_map);
imageFileOutput
.VSync(VSyncMethod.vfr)
.SetOption("-c:v", "libx264")
.Fps(config.Fps)
.SetOption("-g", "0")
.SetOption("-rc-lookahead", "0");

ffmpegArg.AddOutput(imageFileOutput);

ffmpegArg.TestRender(filterFileName, outputFileName);
}
}
}
70 changes: 0 additions & 70 deletions FFmpegArgs.Test/TanersenerSlideShow/BarsVerticalOne.cs

This file was deleted.

0 comments on commit 0da7ac4

Please sign in to comment.