Play speed of some video stickers on iOS client is faster than Desktop/Android client.
The following sticker packs could demonstrate the behaviour. https://t.me/addstickers/joke_bear_3 marked as [1]
When played on Windows Desktop client or Android client, the play speed is normal. However on iOS client the play speed is very fast.
Since I made both packs myself, the difference between the two packs is their framerate.
Source stickers of both packs are firstly split into individual frames. Then FFmpeg is used to generate WebM videos from frames.
Pack [1] has a non-uniform framerate. I converted this pack using individual frame and duration of each frame. The command is like:
ffmpeg -f concat -i .\list.txt out.webm
Where in list.txt, there are frames and their durations.
Pack [2] has a uniform framerate. The command is like:
ffmpeg -framerate 7 -i frame-%d.png output.webm
Thank you!
Steps to reproduce
Open sticker pack [1] and [2] on iOS client (iOS 14.7, v8.5.1).
Open sticker pack [1] and [2] on Telegram Desktop (Windows 10, v3.5.1) or Android (Android 12, v8.5.2 (2563) arm64-v8a).
The play speed of [1] is different. [2] is the same.
Device info
Telegram iOS 8.5.1 (22882), iPhone SE (2nd gen), 14.7
The stickers with emoji 1️⃣ have non-uniform framerate. 2️⃣ have uniform framerate. I noticed that in the video metadata it seems the framerate of 1️⃣ is set to 25fps. Telegram iOS could be using only the framerate as play speed but Desktop/Android is following the frame durations.
I'm not familiar with Swift, but I guess what I saw there should be the problem. The WebM video is played using a constant framerate.
If you check this link: https://www.webmproject.org/docs/container/ , framerate is now deprecated and informational only, which means framerate shouldn't be used as the play speed of WebM video.
My workaround about the issue for now is set the framerate to an average - but this will somehow change the timings of the animations. Hope this could be improved soon.
Log in here to report bugs or suggest features. Please enter your phone number in the international format and we will send a confirmation message to your account via Telegram.
The stickers with emoji 1️⃣ have non-uniform framerate. 2️⃣ have uniform framerate. I noticed that in the video metadata it seems the framerate of 1️⃣ is set to 25fps. Telegram iOS could be using only the framerate as play speed but Desktop/Android is following the frame durations.
https://github.com/TelegramMessenger/Telegram-iOS/blob/release-8.5.1/submodules/AnimatedStickerNode/Sources/AnimatedStickerNode.swift#L417
I'm not familiar with Swift, but I guess what I saw there should be the problem. The WebM video is played using a constant framerate.
If you check this link: https://www.webmproject.org/docs/container/ , framerate is now deprecated and informational only, which means framerate shouldn't be used as the play speed of WebM video.
My workaround about the issue for now is set the framerate to an average - but this will somehow change the timings of the animations. Hope this could be improved soon.