Which video format is right for `sendVideo` method in Telegram Bot API

telegram-botvideo

Which video format can be used in Telegram Bot API sendVideo method?

On the page they only mention "H.264/MPEG-4 AVC"

So if I convert a video (without sound) with

ffmpeg -i input -an -c:v libx264 -crf 26 out.m4v

I get an ok:true as response but I can't see the preview (blurred still image) in the Telegram client.

Best Answer

This was really driving me nuts: It's important that the file extension is ".mp4". If you upload a video with ".m4v" extension you'll not see a preview window and the video is opened in an external player.

So here is my final command to reencode and resize a video and send it to the bot using curl:

ffmpeg -i input -an -c:v libx264 -crf 26 -vf scale=640:-1 out.mp4
curl -v -F chat_id=CHATID -F video=@out.mp4 -F caption=foobar https://api.telegram.org/bot<TOKEN>/sendVideo
Related Topic