Example #1
0
        // command based out of https://stackoverflow.com/a/48853654/5031684
        private string GetFfmpegCommand(List <string> clipPaths, string outputLocation)
        {
            if (clipPaths == null || clipPaths.Count == 0 || outputLocation == null)
            {
                throw new ArgumentNullException();
            }

            string command = $"{UtilMethods.GetSolutionPath()}ffmpeg ";

            foreach (string clip in clipPaths)
            {
                command += $"-i \"{clip}\" ";
            }
            command += "-filter_complex \"";
            for (int i = 0; i < clipPaths.Count; i++)
            {
                //command += $"[{i}:v]scale=1920:1080:force_original_aspect_ratio=1[v{i}]; ";
                command += $"[{i}:v]scale=1920:1080,setdar=16/9[v{i}]; ";
            }
            for (int i = 0; i < clipPaths.Count; i++)
            {
                command += $"[v{i}][{i}:a]";
            }
            command += $"concat=n={clipPaths.Count}:v=1:a=1[v][a]\" -map [v] -map [a] {outputLocation}";

            return(command);
        }