/// <summary> /// Joins a list of video files. /// </summary> /// <param name="output">Output video file.</param> /// <param name="videos">List of vides that need to be joined together.</param> /// <returns>Output video information.</returns> public VideoInfo Join(FileInfo output, params VideoInfo[] videos) { FFMpegHelper.OutputExistsExceptionCheck(output); FFMpegHelper.InputsExistExceptionCheck(videos.Select(video => video.ToFileInfo()).ToArray()); var temporaryVideoParts = videos.Select(video => { FFMpegHelper.ConversionSizeExceptionCheck(video); var destinationPath = video.FullName.Replace(video.Extension, FileExtension.Ts); Convert( video, new FileInfo(destinationPath), VideoType.Ts ); return(destinationPath); }).ToList(); var args = ArgumentsStringifier.InputConcat(temporaryVideoParts) + ArgumentsStringifier.Copy() + ArgumentsStringifier.BitStreamFilter(Channel.Audio, Filter.Aac_AdtstoAsc) + ArgumentsStringifier.Output(output); try { if (!RunProcess(args, output)) { throw new FFMpegException(FFMpegExceptionType.Operation, "Could not join the provided video files."); } return(new VideoInfo(output)); } finally { Cleanup(temporaryVideoParts); } }