rien / reStream

Stream your reMarkable screen over SSH.
MIT License
734 stars 56 forks source link

Use ffmpeg native options to do scaling and padding math #34

Closed murph closed 3 years ago

murph commented 3 years ago

While testing my remarkable 2, I found the scaling in webcam mode a bit off.

It turns out that we don't need to do this math at all, ffmpeg has options to scale based on one dimension and pad to center automatically.

Documentation for "pad" - https://ffmpeg.org/ffmpeg-filters.html#pad-1 Documentation for "scale" - https://ffmpeg.org/ffmpeg-filters.html#scale-1

Tested on remarkable 2 (so, merged with that branch) and a relatively modern version of ffmpeg on my machine.

beardhatcode commented 3 years ago

Tested on rM1, it works.

The wording in ffmpegs documentation was a bit too complicated to spot this functionality on the first read.

Thank you for your contribution @murph :+1: