Text to video generator

AI Text-to-Video Generator

AI Text-to-Video Generator

⏳ Generating...
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap'); * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; } body { background: linear-gradient(135deg, #FF5733, #3498DB); color: white; display: flex; justify-content: center; align-items: center; height: 100vh; text-align: center; padding: 20px; } .container { background: rgba(255, 255, 255, 0.2); padding: 20px; border-radius: 12px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); max-width: 600px; width: 100%; } h1 { margin-bottom: 15px; } textarea { width: 100%; height: 80px; padding: 10px; border: none; border-radius: 5px; font-size: 16px; background: #34495E; color: white; } button { width: 100%; padding: 10px; margin: 10px 0; border: none; border-radius: 5px; font-size: 16px; cursor: pointer; transition: 0.3s; background: #2ECC71; color: white; } button:hover { opacity: 0.8; } .loading { display: none; font-size: 16px; color: yellow; margin-top: 10px; } #videoContainer { margin-top: 15px; } video { max-width: 100%; border-radius: 10px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); } const apiKey = "YOUR_FREE_API_KEY"; // Replace with a valid API key async function generateVideo() { let prompt = document.getElementById("promptInput").value; let loading = document.getElementById("loading"); let videoContainer = document.getElementById("videoContainer"); let downloadBtn = document.getElementById("downloadBtn"); if (!prompt) { alert("Please enter a description!"); return; } loading.style.display = "block"; videoContainer.innerHTML = ""; downloadBtn.style.display = "none"; try { const response = await fetch("https://api.deepai.org/api/text2video", { method: "POST", headers: { "Content-Type": "application/json", "api-key": apiKey }, body: JSON.stringify({ text: prompt }) }); const data = await response.json(); let videoUrl = data.output_url; let videoElement = document.createElement("video"); videoElement.src = videoUrl; videoElement.controls = true; videoContainer.appendChild(videoElement); downloadBtn.style.display = "block"; downloadBtn.onclick = () => downloadVideo(videoUrl); } catch (error) { alert("Error generating video. Please try again."); } finally { loading.style.display = "none"; } } function downloadVideo(videoUrl) { let link = document.createElement("a"); link.href = videoUrl; link.download = "AI-Generated-Video.mp4"; document.body.appendChild(link); link.click(); document.body.removeChild(link); }

Contact Form