frame_count = 0 while True: ret, frame = cap.read() if not ret: break
# cleanup for p in [input_path, output_path]: if os.path.exists(p): os.remove(p) async def main(): app = Application.builder().token(TOKEN).build() app.add_handler(CommandHandler("start", start)) app.add_handler(MessageHandler(filters.VIDEO, handle_video)) print("Bot running...") await app.run_polling() telegram bot to remove watermark from video
async def handle_video(update: Update, context: ContextTypes.DEFAULT_TYPE): msg = await update.message.reply_text("⏳ Downloading video...") video_file = await update.message.video.get_file() input_path = os.path.join(TEMP_DIR, f"input_update.message.message_id.mp4") output_path = os.path.join(TEMP_DIR, f"output_update.message.message_id.mp4") frame_count = 0 while True: ret, frame = cap