示例#1
0
        public void ReadFromVideo(string path)
        {
            pathToFile = new Uri(AnaglyphParameters.VideoPath.LocalPath);
            AnaglyphParameters.PathToRead  = pathToFile.LocalPath;
            AnaglyphParameters.PathToWrite = path.Split('.')[0] + "1.mp4";
            reader.Open(pathToFile.LocalPath);

            SetWriter(reader, writer);


            for (int i = 0; i < reader.FrameCount; i++)
            {
                OnOnFrameDone(i, (int)reader.FrameCount);
                try
                {
                    using (Bitmap videoFrame = reader.ReadVideoFrame(i))
                    {
                        using (Bitmap videoFrameChanged = new Fitler().Calc(videoFrame))
                        {
                            writer.WriteVideoFrame(videoFrameChanged, (uint)i);
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.StackTrace);
                }
            }
            reader.Close();
            writer.Close();

            VideoToFrames.AddAudioToVideo(path);
            OnOnProcessDone();
        }
示例#2
0
 public static VideoToFrames GetInstance()
 {
     if (videoToFrames == null)
     {
         videoToFrames = new VideoToFrames();
     }
     return(videoToFrames);
 }