tungs / timesnap

Node.js program that takes screenshots at smooth intervals of web pages with JavaScript animations
BSD 3-Clause "New" or "Revised" License
234 stars 57 forks source link

canvasCaptureMode:true error. #44

Closed sonygod closed 4 years ago

sonygod commented 4 years ago

when add config canvasCaptureMode:true, will throw this error . test on ubuntu18,node 12.x

[image2 @ 0x55728c9d7900] Could find no file with path '/root/project/timecut-temp-1601454842663/image-%09d.jpeg' and index in the range 0-4

/root/project/timecut-temp-1601454842663/image-%09d.jpeg: No such file or directory

const timecut = require('timecut');

var time=new Date();
timecut({
      url: 'https://tungs.github.io/truchet-tiles-original/#autoplay=true&switchStyle=random',
      viewport: {
              width: 800,               // sets the viewport (window size) to 800x600
              height: 600
            },

      launchArguments:['-no-sandbox'],
      canvasCaptureMode:true,
      selector: '#container',     // crops each frame to the bounding box of '#container'
      left: 20, top: 40,          // further crops the left by 20px, and the top by 40px
      right: 6, bottom: 30,       // and the right by 6px, and the bottom by 30px
      fps: 30,                    // saves 30 frames for each virtual second
      duration: 1,               // for 20 virtual seconds 
      screenshotType:"jpeg",
      output: './video.mp4',

      preparePageForScreenshot:function(page,frameNumber,totalFrame){

          if(frameNumber==1){
              time=new Date();
          }
         console.log(frameNumber,totalFrame);
         console.log(frameNumber,totalFrame);
      }       
}).then(function () {
      console.log('Done!'+(new Date()-time));
});