discord / lilliput

Resize images and animated GIFs in Go
https://discord.com/blog/how-discord-resizes-150-million-images-every-day-with-go-and-c
Other
1.94k stars 124 forks source link

Handle video resolution mismatch #146

Closed skidder closed 4 months ago

skidder commented 4 months ago

Handle resolution mismatches between the source video frames and the destination matrix. Previously, our code included a strict requirement that the resolution of the destination matrix (mat) had to exactly match the resolution of the incoming video frames. This approach, while straightforward, lacks the flexibility to handle cases where the resolution metadata is incorrect.

This change ensures that even if the video resolution doesn't align with the resolution indicated by the codec parameters (typically derived from the MP4 container header), we can still perform scaling operations effectively.

This change was tested using clips with resolution discrepancies, supplied by @rcombs