1

I'm capturing HTML animation with use of Puppeteer and MediaRecorder API.

Before starting the capturing I'm waiting for networkidle event (I tried networkidle0-2 but result is identical)

await page.goto(url, { waitUntil: 'networkidle0' })

For some reason, the animation starts to play 2-3 seconds after the capturing starts, and thus, white frames are captures. Similar, at the end of the video there are identical frames because capturing duration is a bit longer than animation plays.

Thus I want to detect and cut off those repeating white frames at the beginning and repeating non-white frames at the end of the video (mp4/webm).

I tried some solutions, like described here, for instance

ffmpeg -i input.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB out.mp4

It does remove duplicates, but the problem is that it cuts off dups in the middle as well.

Thus, if I have a 15 sec animation,it removes all dups at the beginning, all dups at the end and all dups in the middle, and what is left after it is just a several identical frames which are pack into less than 1 sec video.

humkins
  • 9,635
  • 11
  • 57
  • 75
  • Can you post the code you're trying to debug? – Todd Price Sep 21 '20 at 19:44
  • Hi @ToddPrice, I'm not sure what code you are talking about. If you mean the one which captures video from html, that is https://github.com/Ventricule/html2screen project, with the only important difference that I'm opening local HTML file via `file` protocol instead of HTTP. But anyway, I also would like to know how to fix described problem with existing video. – humkins Sep 22 '20 at 08:47

0 Answers0