Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using AForge.Video.FFMPEG;
  8. using AForge.Imaging.Filters;
  9.  
  10. namespace FrameSub
  11. {
  12. class Program
  13. {
  14. static void Main(string[] args)
  15. {
  16. string path = System.IO.Directory.GetCurrentDirectory() + "/1.mp4";
  17. VideoFileReader reader = new VideoFileReader();
  18. VideoFileWriter writer = new VideoFileWriter();
  19.  
  20. reader.Open(path);
  21. writer.Open(path, reader.Width, reader.Height, reader.FrameRate, VideoCodec.MPEG4);
  22. Difference diff = new Difference(reader.ReadVideoFrame());
  23. for (int i = 1; i < reader.FrameCount; i++)
  24. {
  25. Bitmap frame = reader.ReadVideoFrame();
  26. Bitmap result = diff.Apply(frame);
  27. writer.WriteVideoFrame(result);
  28.  
  29. diff.OverlayImage = frame;
  30. result.Dispose();
  31. }
  32. writer.Close();
  33. reader.Close();
  34. Console.ReadKey();
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement