Video file displays black screen when sent via Telegram bot API with curl

I’m having trouble with video playback when sending files through my Telegram bot. I’m using this curl command to send the video:

curl -X POST "https://api.telegram.org/bot<my_token>/sendVideo" -F chat_id=<user_id> -F video="@clip.mp4"

The video file (clip.mp4) gets sent successfully to the user, but there’s a weird issue with playback. When I open the video on iPad or iPhone Telegram app, it shows just a black screen. But if I save that same video to my device’s photo library, it plays perfectly fine. On Mac desktop Telegram, I can right-click and open it with QuickTime and it works normally.

The video specs are 640x480 resolution and roughly 3MB in size. Text messages and image uploads work without any problems using similar curl commands.

Before I switched to using bots, I was sending videos through telegram-cli and never had this black screen issue. Has anyone experienced this problem with the sendVideo API method? What parameters or settings might fix the playback issue on mobile clients?

This sounds like a container format issue, not just codec problems. Telegram’s mobile clients are picky about videos that don’t have proper MOOV atom positioning. When you upload through the bot API, files get processed differently than regular uploads. Try moving the metadata to the front of your MP4 using -movflags +faststart when encoding. This moves the MOOV atom to the beginning, which mobile players need for streaming. I had the same issue with programmatically uploaded videos last month - this flag fixed the black screen on iOS while desktop playback stayed fine.

Same issue here with Telegram bot uploads. Add -f mp4 to your curl command and include duration, width, and height parameters. Mobile Telegram needs these metadata hints or it freaks out. Also check if your mp4 file’s corrupted - sometimes plays fine locally but breaks on mobile after upload compression.

I’ve hit this exact issue before - it’s a codec problem. Telegram’s mobile apps are super picky about video encoding, especially with older H.264 profiles. Your video plays fine locally, but the bot API handles things differently than manual uploads. Re-encode with FFmpeg using: -vcodec libx264 -profile:v baseline -level 3.0 -pix_fmt yuv420p. The baseline profile is key for mobile compatibility. Also check that your video has proper metadata - missing duration info can cause black screens on mobile. Had the same problem last year and baseline profile encoding fixed it completely.