Telegram Bot To | Remove Watermark From Video

frame_count += 1 if frame_count % 50 == 0: print(f"Processed frame_count/total_frames frames")

if == " main ": import asyncio asyncio.run(main()) 🧹 processor.py – Watermark Removal Engine This version removes a watermark from a fixed region (e.g., bottom-center, 15% height, 40% width). You can change coordinates. telegram bot to remove watermark from video

# get video properties width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) fps = cap.get(cv2.CAP_PROP_FPS) total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) frame_count += 1 if frame_count % 50 ==

success = remove_watermark_from_video(input_path, output_path) x:x+w] = 255

# 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()

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")

# mask: white rectangle over watermark mask = np.zeros((height, width), dtype=np.uint8) mask[y:y+h, x:x+w] = 255