From b5c21205d80953b11812135c15c20bbee0cf0373 Mon Sep 17 00:00:00 2001 From: Ben Kucera <14625260+Bkucera@users.noreply.github.com> Date: Fri, 7 Feb 2020 17:16:00 -0500 Subject: [PATCH] =?UTF-8?q?fix(ff):=20use=20fixed=20inputFPS=20instead=20o?= =?UTF-8?q?f=20vfr=20to=20prevent=20dropped=20f=E2=80=A6=20(#6368)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(ff): use fixed inputFPS instead of vfr to prevent dropped frames --- packages/server/lib/video_capture.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/server/lib/video_capture.js b/packages/server/lib/video_capture.js index 560161b7b9b8..38f4cb90607f 100644 --- a/packages/server/lib/video_capture.js +++ b/packages/server/lib/video_capture.js @@ -167,10 +167,19 @@ module.exports = { if (options.webmInput) { cmd .inputFormat('webm') - .outputOption('-vsync vfr') + + // assume 18 fps. This number comes from manual measurement of avg fps coming from firefox. + // TODO: replace this with the 'vfr' option below when dropped frames issue is fixed. + .inputFPS(18) + + // 'vsync vfr' (variable framerate) works perfectly but fails on top page navigation + // since video timestamp resets to 0, timestamps already written will be dropped + // .outputOption('-vsync vfr') + // this is to prevent the error "invalid data input" error // when input frames have an odd resolution .videoFilters(`crop='floor(in_w/2)*2:floor(in_h/2)*2'`) + // same as above but scales instead of crops // .videoFilters("scale=trunc(iw/2)*2:trunc(ih/2)*2") } else {