There is no official way of doing so as far as I know. Small MP4 files without audio are automatically converted into GIFs. But you can trick Telegram into doing what you want - this method seems to be working as of January 2023 on both the iOS desktop app and the official API.
You might want to do that because you cannot group GIFs in an album. It works fine with JPGs and MP4s, but when you mix GIFs into that - the API suddenly throws 400 errors. You can’t create an album of GIFs alone either. Very annoying.
The trick is to add a silent audio track on top of your MP4 file; I used this method:
ffmpeg -f lavfi -i aevalsrc=0 -i input.mp4 \ -c:v copy -c:a aac -map 0 -map 1:v -shortest output.mp4
That seems to be doing the trick, if you want to call it in your Go program using
os/exec it will look something like this:
cmnd := exec.Command("ffmpeg", "-y", "-f", "lavfi", "-i", "aevalsrc=0", "-i", inputPath, "-c:v", "copy", "-c:a", "aac", "-map", "0", "-map", "1:v", "-shortest", outputPath, ) output, err := cmnd.CombinedOutput()