Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(video): crop all odd resolutions to be even #15295

Merged
merged 1 commit into from
Mar 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions packages/server/lib/video_capture.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ module.exports = {
return ended.resolve()
})

// 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'`)

if (options.webmInput) {
cmd
.inputFormat('webm')
Expand All @@ -227,13 +231,6 @@ module.exports = {
// '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 {
cmd
.inputFormat('image2pipe')
Expand Down