Video preview in album (media group) sometimes cropped incorrectly, squeezing the pixel aspect ratio
Steps to reproduce
This is an album or media group that a bot (which I control) sent me:
I forwarded it to the public group https://t.me/tgbetachat/2283835
It's an album or media group made up of three messages: the first is a video with a caption, the other two are photos. The video has a very vertical aspect ratio of about 9:16. (btw it's a single video that happens to be a collage of two cameras on top of each other, which might be confusing, sorry about that)
Expected behaviour
The layout of the album should never result in altering the pixel aspect ratio of any of the photos or videos. You can crop them however you want, and arrange them in whatever layout, but the pixel aspect ratio is absolutely sacred and should never be altered, that is, the photo or video should never be squeezed or stretched in any direction.
On mobile it looks like this, this is ok:
And this is the exact same set of files sent by the exact same bot in another instance, which for whatever reason did not reproduce the issue:
Note that here Telegram Desktop decided to put the vertical video on the left to optimize the layout and therefore didn't have to crop it too much. That is expected too. Interestingly, here the video is not automatically playing in loop, it has a play button instead, unlike in the first case which is affected by the issue, where the video was playing in loop and muted (like a GIF). It's the exact same file and it's sent with an identical API request by the bot in both cases.
Actual behaviour
The video is vertically squeezed to accomodate the arbitrarily chosen horizontal aspect ratio. It's actually also slightly cropped, but nowhere near as much as would be needed to fit the chosen aspect ratio with uniform scaling, i.e. without squeezing in any direction.
I'm unable to reproduce by sending the same files manually as a human through Telegram Desktop or Telegram. I only observe this when the messages are sent by my bot via the API, but note that the API doesn't provide any control at all on the layout, cropping, or aspect ratio, so it's impossible by definition that the issue is on my end.
I have been able to reproduce this systematically with different sets of videos and photos of similar proportions, but as shown in the two examples above, even with the exact same set of files, it reproduces under certain scenarios and not under others, and I can't tell what's different between the two scenarios: the API request that sends the album is exactly the same, the only difference (that I may have any control of) is in the sequence of API requests made immediately before, but of course that shouldn't have any such effect.
Operating system
manjaro linux
Version of Telegram Desktop
6.3.4
Installation source
Static binary from official website
Crash ID
No response
Logs
Source: telegramdesktop/tdesktop