Bot De Telegram Para Cambiar - Caras En Videos 2021

El año 2021 fue la "edad de oro" de los bots de Telegram para el face swap en vídeos. Democratizaron una tecnología que hasta entonces era exclusiva de laboratorios o de usuarios con GPUs de alta gama.

Aunque hoy la tecnología ha avanzado hacia la generación de vídeo por texto (IA generativa), aquellos pequeños robots en la nube nos enseñaron que cualquiera con un teléfono y 20 segundos podía ser un mago del deepfake. Si encuentras un bot activo hoy que replique la funcionalidad de 2021, atesóralo: es una reliquia funcional de la rápida evolución de la inteligencia artificial.

¿Quieres más guías sobre edición de vídeo con IA? Comenta abajo y dime qué otras herramientas de 2021 te gustaría redescubrir.


Palabras clave relacionadas: cambiar cara video, face swap telegram, deepfakes 2021, bot de inteligencia artificial, editar vídeos con IA.

In 2021, various Telegram bots emerged as popular, accessible tools for creating face-swapped videos using deepfake technology. These bots typically work by processing a source image (your face) and a target video, then using AI to merge them Popular Telegram Face Swap Bots

Several bots gained traction during this period for their ease of use:

: A widely cited bot specifically designed to swap faces in both standard videos and Telegram video messages. FaceSwapStudy_Bot

: Offers a credit-based system where users receive initial free credits to perform swaps on photos and videos. Face Fusion Bot

: Provides a limited number of free credits for video and photo face swapping. Adjuface Bot

: A versatile bot that handles face swapping in images and has been noted for its ongoing development in video capabilities. How to Use a Face Swap Bot

While each bot has a unique interface, the general workflow follows these steps: Start the Bot : Search for the bot's username (e.g., @fraimebot ) in Telegram and press Upload the Face bot de telegram para cambiar caras en videos 2021

: Send a high-quality, clear photo of the face you want to use as the source. Upload the Video

: Send the video or video message where you want the face to be replaced. Confirm and Process

: Some bots may ask you to select specific faces if multiple are detected. Once confirmed, the bot processes the video on its servers.

: After a few minutes, the bot will send back the updated video with the swapped face. Key Considerations Credits and Pricing

: Most bots operate on a "freemium" model. You might get a few free swaps, but longer videos or higher quality usually require purchasing credits.

: Be cautious when uploading personal photos to third-party bots. Always check if the bot has a clear privacy policy regarding how long they store your data.

: Results vary based on the original video's lighting and the angle of the source photo. Clear, front-facing photos generally yield the most realistic results. face-swapping bot for better privacy?

¡Claro! Aquí te dejo un artículo sobre cómo crear un bot de Telegram para cambiar caras en videos en 2021:

Introducción

En la actualidad, los bots de Telegram se han vuelto muy populares debido a su capacidad para automatizar tareas y ofrecer servicios de manera eficiente. Uno de los usos más interesantes de estos bots es la capacidad de editar videos, específicamente cambiar caras en videos. En este artículo, te mostraremos cómo crear un bot de Telegram para cambiar caras en videos en 2021. El año 2021 fue la "edad de oro"

Requisitos previos

Antes de empezar, debes tener:

Funcionamiento del bot

El bot que crearemos tendrá las siguientes funcionalidades:

Código del bot

A continuación, te mostramos el código del bot:

import logging
from telegram.ext import Updater, CommandHandler, MessageHandler
import cv2
import numpy as np
logging.basicConfig(level=logging.INFO)
TOKEN = 'TU_TOKEN_DE_BOT'
def start(update, context):
    context.bot.send_message(chat_id=update.effective_chat.id, text='¡Hola! Estoy aquí para cambiar caras en videos.')
def cambiar_cara(update, context):
    video = update.message.video
    video_path = video.file_id
# Descargar el video
    video_file = context.bot.get_file(video_path)
    video_file.download('video.mp4')
# Cargar la cara que se quiere cambiar
    cara_path = 'cara.jpg'  # ruta a la imagen de la cara que se quiere cambiar
    cara_img = cv2.imread(cara_path)
# Cargar el video
    cap = cv2.VideoCapture('video.mp4')
# Crear un video writer
    fourcc = cv2.VideoWriter_fourcc(*'mp4v')
    fps = cap.get(cv2.CAP_PROP_FPS)
    frame_size = (int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
    out = cv2.VideoWriter('output.mp4', fourcc, fps, frame_size)
while True:
        ret, frame = cap.read()
        if not ret:
            break
# Detectar la cara en el frame
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
        face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')
        faces = face_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=5)
for (x, y, w, h) in faces:
            # Cambiar la cara
            cara_cropped = cara_img[y:y+h, x:x+w]
            frame[y:y+h, x:x+w] = cara_cropped
out.write(frame)
cap.release()
    out.release()
# Enviar el video editado
    with open('output.mp4', 'rb') as f:
        context.bot.send_video(chat_id=update.effective_chat.id, video=f)
def main():
    updater = Updater(TOKEN, use_context=True)
dp = updater.dispatcher
dp.add_handler(CommandHandler('start', start))
    dp.add_handler(MessageHandler(Filters.video, cambiar_cara))
updater.start_polling()
    updater.idle()
if __name__ == '__main__':
    main()

Explicación del código

El código del bot utiliza la biblioteca python-telegram-bot para interactuar con la API de Telegram y la biblioteca opencv-python para procesar los videos.

El bot tiene dos funciones: start y cambiar_cara. La función start envía un mensaje de bienvenida al usuario. La función cambiar_cara se activa cuando el usuario envía un video al bot. Esta función descarga el video, carga la cara que se quiere cambiar, detecta la cara en cada frame del video y la cambia por la cara seleccionada.

Conclusión

En este artículo, hemos creado un bot de Telegram que puede cambiar caras en videos. El bot utiliza la biblioteca python-telegram-bot para interactuar con la API de Telegram y la biblioteca opencv-python para procesar los videos. El bot puede ser utilizado para fines de entretenimiento o para aplicaciones más serias, como la edición de videos para publicidad o medios de comunicación.

Recuerda que debes reemplazar TU_TOKEN_DE_BOT con el token de tu bot de Telegram. ¡Espero que disfrutes utilizando este bot!


After deploying, test with:

| Limit | Solution | |-------|----------| | Telegram file size (50MB max) | Use ffmpeg -crf 28 -b:v 1M to compress. Reject videos >20MB before processing. | | Processing time (>60s) | Show progress bar with edit_message_text every 10 frames. | | Concurrent users | Use python-telegram-bot’s updater.start_polling(drop_pending_updates=True) + a queue system. | | GPU memory leak | Restart model every 50 swaps: swapper.prepare(ctx_id=0, det_size=(640,640)). |

| Bot de Telegram | Especialidad | Límite de video | | :--- | :--- | :--- | | @Deepfake_bot | Alto realismo, pero lento | 10 segundos | | @Reface_tele_bot | Famoso por hacer bailar a fotos estáticas | 5 segundos | | @Swap_video_bot | Permitía intercambiar 2 caras dentro del mismo video | 15 segundos |

Aunque estos bots específicos hayan desaparecido, el procedimiento general sigue siendo útil para los actuales:

⚠️ Advertencia 2021 vs hoy: Muchos de estos bots almacenaban los videos en servidores rusos o ucranianos. La privacidad era un riesgo real.

# Ubuntu 20.04 / Windows WSL2
sudo apt install ffmpeg python3.9 python3-pip
pip3 install torch==1.8.1+cu111 torchvision==0.9.1+cu111 -f https://download.pytorch.org/whl/torch_stable.html
pip3 install insightface==0.2.1 opencv-python-headless python-telegram-bot==13.7 numpy

swapper = insightface.model_zoo.get_model('inswapper_128.onnx') swapper.prepare(ctx_id=0)

Note: As of 2021, inswapper_128.onnx is the only lightweight model that runs under 5 sec/frame on a GPU.

Sí, con matices.