Posted By

davebowker on 10/31/10


Tagged

movie frame capture brendan dawes cinema


Versions (?)

Cinema Redux


 / Published in: Processing
 

URL: http://www.processing.org/exhibition/works/redux/moviemap3.pde

  1. // Cinema Redux by Brendan Dawes
  2. // www.brendandawes.com
  3. // Cinema Redux is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
  4. // http://creativecommons.org/licenses/by-nc-sa/3.0/
  5. // This code was created with Processing V.67
  6. // It may not run on other versions of the software
  7.  
  8. int xpos = 0;
  9. int ypos = 0;
  10. int VWIDTH = 8; // width of capture
  11. int VHEIGHT = 6; // height of capture
  12. int MOVIEWIDTH = VWIDTH * 60; // width is equivalent to 1 minute of film time
  13. int MOVIEHEIGHT = VHEIGHT * 130; // 130 minutes
  14. int MAXWIDTH = MOVIEWIDTH - VWIDTH;
  15. int MAXHEIGHT = MOVIEHEIGHT - VHEIGHT;
  16. boolean capture = false;
  17. boolean newFrame = false;
  18.  
  19. void setup()
  20. {
  21. size(MOVIEWIDTH, MOVIEHEIGHT);
  22. background(0);
  23. beginVideo(VWIDTH, VHEIGHT, 1);
  24. }
  25.  
  26. void mousePressed() {
  27. // click screen to start capture
  28. // click again to take screengrab if required
  29. if (capture == false) {
  30. capture = true;
  31. }
  32. else {
  33. saveFrame();
  34. }
  35.  
  36. }
  37.  
  38. void videoEvent()
  39. {
  40. newFrame = true;
  41. }
  42.  
  43. void loop()
  44. {
  45. if(newFrame && capture==true) {
  46.  
  47. image(video,xpos, ypos);
  48. xpos += VWIDTH;
  49. if (xpos > MAXWIDTH) {
  50. xpos = 0;
  51. ypos += VHEIGHT;
  52. }
  53. if (ypos > MAXHEIGHT) {
  54. saveFrame();
  55. ypos = 0;
  56. background(0);
  57. }
  58. newFrame = false;
  59. }
  60. }

Report this snippet  

You need to login to post a comment.