Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using AForge.Video.FFMPEG;
- using AForge.Imaging.Filters;
- namespace FrameSub
- {
- class Program
- {
- static void Main(string[] args)
- {
- string path = System.IO.Directory.GetCurrentDirectory() + "/1.mp4";
- VideoFileReader reader = new VideoFileReader();
- VideoFileWriter writer = new VideoFileWriter();
- reader.Open(path);
- writer.Open(path, reader.Width, reader.Height, reader.FrameRate, VideoCodec.MPEG4);
- Difference diff = new Difference(reader.ReadVideoFrame());
- for (int i = 1; i < reader.FrameCount; i++)
- {
- Bitmap frame = reader.ReadVideoFrame();
- Bitmap result = diff.Apply(frame);
- writer.WriteVideoFrame(result);
- diff.OverlayImage = frame;
- result.Dispose();
- }
- writer.Close();
- reader.Close();
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement