📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
reelsolusturmascripti.demodesign.com.tr
/
system
/
ajax
📝
video_create.php
← Geri Dön
<?php include ('../../config.php'); include ('../inc/sitedata.php'); $dataid = $_GET['dataid']; $queryVeriKontrol = mysqli_query($connect, "SELECT * FROM icerikler WHERE id = '$dataid'"); $fetchVeriKontrol = mysqli_fetch_array($queryVeriKontrol); $promptsonuc = $fetchVeriKontrol['promptsonuc']; $iceriksure = $fetchVeriKontrol['iceriksure']; $iceriktemplate = $fetchVeriKontrol['iceriktemplate']; $icerikfont = $fetchVeriKontrol['icerikfont']; //REFERRER ENGELİ ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Video Üzerine Metin Ekleme</title> <style> #progress-container { width: 100%; background-color: #ccc; margin-top: 20px; } #progress-bar { width: 0; height: 30px; background-color: #4caf50; text-align: center; line-height: 30px; color: white; } </style> </head> <body> <video id="video" controls> <source src="../videos/<?=$iceriktemplate;?>" type="video/mp4"> Tarayıcınız bu videoyu desteklemiyor. </video> <canvas id="canvas" style="display:none;"></canvas> <div id="duration"></div> <button id="process" style="display:none;">Metinli Videoyu İşle ve İndir</button> <div id="progress-container"> <div id="progress-bar">0%</div> </div> <script> // Video elementini seçin var videoxx = document.getElementById('video'); // Süreyi yazdıracağınız div'i seçin var durationDiv = document.getElementById('duration'); // Videonun yüklenmesini bekleyin videoxx.addEventListener('loadedmetadata', function() { // Videonun uzunluğunu alın (saniye cinsinden) var duration = videoxx.duration; // Uzunluğu div içine yazdırın durationDiv.textContent = 'Video süresi: ' + duration + ' saniye'; // İşlem butonunu tetikle document.getElementById('process').click(); }); const video = document.getElementById('video'); const canvas = document.getElementById('canvas'); const processButton = document.getElementById('process'); const ctx = canvas.getContext('2d'); const progressBar = document.getElementById('progress-bar'); // Metinlerin ve eklenecek saniyelerin çiftler halinde olduğu dizi const textsAndTimes = [ { text: 'Metin 1', time: 2 }, // 3. saniyede 'Metin 1' metni { text: 'Metin 2', time: 4 }, // 6. saniyede 'Metin 2' metni { text: 'Metin 3', time: 6 } // 9. saniyede 'Metin 3' metni ]; // Önceden yüklenmiş bir TrueType Font dosyası const customFont = new FontFace('CustomFont', 'url(../fonts/<?=$icerikfont;?>)'); processButton.addEventListener('click', () => { const stream = canvas.captureStream(); const mediaRecorder = new MediaRecorder(stream); const chunks = []; mediaRecorder.ondataavailable = function(event) { if (event.data.size > 0) { chunks.push(event.data); } }; mediaRecorder.onstop = function() { const blob = new Blob(chunks, { type: 'video/mp4' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'output.mp4'; a.click(); URL.revokeObjectURL(url); }; video.pause(); canvas.width = video.videoWidth; canvas.height = video.videoHeight; const totalFrames = Math.floor(video.duration * 30); // Assuming 30 FPS let processedFrames = 0; function updateProgressBar() { processedFrames++; const progress = Math.min((processedFrames / totalFrames) * 100, 100); progressBar.style.width = `${progress}%`; progressBar.textContent = `${Math.floor(progress)}%`; } async function drawFrame() { // Özel font yüklenene kadar bekleyin await customFont.load(); document.fonts.add(customFont); ctx.drawImage(video, 0, 0, canvas.width, canvas.height); updateProgressBar(); // Video zamanını kontrol ederek eşleşen metni ekleyin const currentTime = video.currentTime; textsAndTimes.forEach(({ text, time }) => { if (currentTime >= time && currentTime < time + 1) { // 1 saniyelik bir aralık ctx.font = '44px CustomFont'; // Özel fontu kullanın ctx.fillStyle = 'yellow'; // Metni videonun tam ortasına yerleştirin const textWidth = ctx.measureText(text).width; const textX = (canvas.width - textWidth) / 2; const textY = canvas.height / 2; ctx.fillText(text, textX, textY); } }); if (!video.paused && !video.ended) { requestAnimationFrame(drawFrame); } } video.currentTime = 0; video.play(); mediaRecorder.start(); video.addEventListener('play', function() { drawFrame(); video.addEventListener('ended', function() { mediaRecorder.stop(); }, { once: true }); }, { once: true }); }); </script> </body> </html>
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula