Faced with issue, when i am trying to send GIF to my bot, but bot can't access to original size of image. Seems like telegram servers converting it to mp4 (it is a good idea, looks fine) and when i trying to download it - it always looks like a thumbnail with maximum 320px of bigger side.
Looks, like it is an api bug, because for example here :
It describes as 600x473px, but real downloaded mp4 size is :
So, trying to understand - where i'm wrong here, as original gif size require for my project needs... Maybe any workaround exists here?
ps. in case of converting gif to mp4 manually with saving quality and size and then submitting to bot - it works awesome, without any additional compression and etc, but it is unacceptable to ask use do it before using bot.
update :
To reproduce (you need you bot/bot_token and also, be able to receive webhook with json) :
1) sending this gif (https://c2n.me/47Y3H37.gif) to the bot via windows 10 telegram client (v2.1.10). Using "send without compression". Gif size : 600x473, 3.35MB
2) Bot received and Telegram sending webhook :
{
"update_id": 290360893,
"message": {
"message_id": 21,
"from": {
"id": 101483786,
"is_bot": false,
"first_name": "edited",
"last_name": "edited",
"username": "edited",
"language_code": "en"
},
"chat": {
"id": edited,
"first_name": "edited",
"last_name": "edited",
"username": "edited",
"type": "private"
},
"date": 1591962500,
"animation": {
"file_name": "9Ywn9p.gif.mp4",
"mime_type": "video/mp4",
"duration": 4,
"width": 600,
"height": 473,
"thumb": {
"file_id": "AAMCAgADGQEAAxVe42t2MTQQrFMyXbskwWiNkHjm3wACKwgAAtZ-GEtFrAh9bgzTOnpJm5QuAAMBAAdtAAMIgQACGgQ",
"file_unique_id": "AQADekmblC4AAwiBAAI",
"file_size": 15304,
"width": 320,
"height": 252
},
"file_id": "CgACAgIAAxkBAAMVXuNrdjE0EKxTMl27JMFojZB45t8AAisIAALWfhhLRawIfW4M0zoaBA",
"file_unique_id": "AgADKwgAAtZ-GEs",
"file_size": 68253
},
"document": {
"file_name": "9Ywn9p.gif.mp4",
"mime_type": "video/mp4",
"thumb": {
"file_id": "AAMCAgADGQEAAxVe42t2MTQQrFMyXbskwWiNkHjm3wACKwgAAtZ-GEtFrAh9bgzTOnpJm5QuAAMBAAdtAAMIgQACGgQ",
"file_unique_id": "AQADekmblC4AAwiBAAI",
"file_size": 15304,
"width": 320,
"height": 252
},
"file_id": "CgACAgIAAxkBAAMVXuNrdjE0EKxTMl27JMFojZB45t8AAisIAALWfhhLRawIfW4M0zoaBA",
"file_unique_id": "AgADKwgAAtZ-GEs",
"file_size": 68253
}
}
}
, so you can see there, that size is correct, but weight - no, it is only 68253 bytes = 66.65kb, instead of ~3.35MB (some less, because of converting)
3) Get File_id : CgACAgIAAxkBAAMVXuNrdjE0EKxTMl27JMFojZB45t8AAisIAALWfhhLRawIfW4M0zoaBA from this webhook and trying to use it in api by calling GET "https://api.telegram.org/bot{your_bot_token}/getFile?file_id=CgACAgIAAxkBAAMVXuNrdjE0EKxTMl27JMFojZB45t8AAisIAALWfhhLRawIfW4M0zoaBA" and you will receive :
{
"ok": true,
"result": {
"file_id": "CgACAgIAAxkBAAMVXuNrdjE0EKxTMl27JMFojZB45t8AAisIAALWfhhLRawIfW4M0zoaBA",
"file_unique_id": "AgADKwgAAtZ-GEs",
"file_size": 68253,
"file_path": "animations/file_12.mp4"
}
}
4) Downloading file using this file_path : GET "https://api.telegram.org/file/bot{your_bot_token}/animations/file_12.mp4" and... getting this mp4 file : https://c2n.me/47Y4oAv.mp4 , with loss quality, weight and size (320x252)
But when you are trying to download it from Telegram client - by clicking "save as" - works fine, mp4 with appropriate size/weight. So seems like an api bug...
update#2 : tried to submit it via tfs telegram support, but also, can't login using my phone number... (https://c2n.me/47Yqswl.png). @pavel_durov, could you please fix it all :))