Ejemplo n.º 1
0
        /// <summary>
        /// split video by time lines in Dir
        /// </summary>
        /// <param name="timeLines">time lines</param>
        public void Split(TimeLineVolume[] timeLines)
        {
            char   sep    = Path.DirectorySeparatorChar;
            FFMpeg ffmpeg = new FFMpeg();

            for (int i = 0; i < timeLines.Length; i++)
            {
                ArgumentContainer container = new ArgumentContainer();
                // input arg
                container.Add(new InputArgument(Source));

                // split arg
                container.Add(new SplitArgument(timeLines[i]));

                // output path
                VideoPartInfo partInfo = new VideoPartInfo()
                {
                    IsNoise       = timeLines[i].Volume == VolumeValue.Noise ? true: false,
                    Name          = "videoPart",
                    FileExtension = SourceExtension,
                    Number        = i,
                };
                string outputPath = $"{Dir.FullName}{sep}{partInfo.FullName}";
                container.Add(new OutputArgument(outputPath));

                // convert
                ffmpeg.Convert(container);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// from string to VideoPartInfo
        /// </summary>
        /// <param name="name">video file name</param>
        /// <returns>instance</returns>
        public static VideoPartInfo FromStringToVideoPartInfo(string name)
        {
            VideoPartInfo partInfo = new VideoPartInfo();

            partInfo.FromString(name);
            return(partInfo);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// get video parts info from directory
        /// </summary>
        /// <param name="dir">dir</param>
        /// <returns></returns>
        static VideoPartInfo[] GetVideoPartsInfo(DirectoryInfo dir)
        {
            List <VideoPartInfo> partsInfo = new List <VideoPartInfo>();

            foreach (var mediaFile in dir.GetFiles())
            {
                VideoPartInfo partInfo = VideoPartInfo.FromStringToVideoPartInfo(mediaFile.Name);
                partsInfo.Add(partInfo);
            }
            return(partsInfo.ToArray());
        }