Spaces:
Paused
Paused
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Video Processing Tool</title> | |
<script> | |
function processVideo(event) { | |
event.preventDefault(); | |
const formData = new FormData(document.getElementById('video-form')); | |
fetch('/process', { method: 'POST', body: formData }) | |
.then(response => { | |
if (!response.ok) throw new Error("Error during processing"); | |
return response.blob(); | |
}) | |
.then(blob => { | |
const downloadUrl = URL.createObjectURL(blob); | |
const a = document.createElement('a'); | |
a.href = downloadUrl; | |
a.download = "output.mp4"; | |
document.body.appendChild(a); | |
a.click(); | |
a.remove(); | |
}) | |
.catch(error => alert(error.message)); | |
} | |
</script> | |
</head> | |
<body> | |
<h1>Video Processing Tool</h1> | |
<form id="video-form" onsubmit="processVideo(event)"> | |
<label for="video">Upload Video:</label> | |
<input type="file" id="video" name="video" required> | |
<label for="action">Action:</label> | |
<select id="action" name="action"> | |
<option value="Convert Format">Convert Format</option> | |
<option value="Trim Video">Trim Video</option> | |
<!-- Other actions... --> | |
</select> | |
<label for="format">Format:</label> | |
<input type="text" id="format" name="format"> | |
<label><input type="checkbox" name="copy_streams"> Copy Streams</label> | |
<button type="submit">Process Video</button> | |
</form> | |
</body> | |
</html> |