How to create a Telegram bot for downloading and converting files? Is hosting on Raspberry Pi possible?

I want to create a custom Telegram bot that can handle file downloads and conversions. Here’s what I need it to do:

When I send a URL to the bot, it should automatically fetch the file from that link and convert it to video format if needed. After processing, the bot uploads the converted video directly to Telegram servers and sends it back to me.

The main benefit is having streamable content similar to YouTube that I can access from anywhere on my phone or computer. This would be really useful for personal use.

I’m planning to build this bot myself and need advice on what programming languages, libraries, and hosting requirements I should consider. Would a Raspberry Pi have enough processing power to handle the file downloads and video conversions? What other technical components do I need to make this work reliably?

hey, raspberry pi 4 can handle lighter video conversions but may lag with bigger files. python with ffmpeg is great for that, and check out pyrogram for the telegram api. just make sure you have cooling since it can get pretty hot when processing vids!

Watch out for storage limits on your Pi - video files eat up space fast. I’d use Python with the python-telegram-bot library and yt-dlp for downloads. FFmpeg works great for conversions, but it’ll be slower than a proper server. Set up a queue system for multiple requests and add error handling for failed downloads or weird formats. Make sure you’ve got auto-restarts and disk monitoring so it doesn’t crash mid-conversion.

Been running this setup for 8 months - learned some hard lessons. Pi 4 with 8GB works fine for most conversions, but you need proper cooling. Got a fan case after my first Pi throttled on longer jobs. Nobody’s mentioned bandwidth yet - if your internet sucks, large downloads will kill everything. Add download resume and maybe a web interface to watch job progress. Docker containers are worth it too - makes updates and fixes way easier. Electricity costs basically nothing vs cloud hosting, which is why I went Pi in the first place.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.