Spaces:
Paused
Paused
File size: 3,622 Bytes
a83f70a 9f97732 d559fe3 9f97732 d559fe3 9f97732 d559fe3 a83f70a 9f97732 a83f70a 9f97732 d559fe3 a83f70a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Video Processing Tool</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f9;
margin: 0;
padding: 20px;
color: #333;
}
h1 {
color: #333;
text-align: center;
}
form {
background: #fff;
max-width: 500px;
margin: auto;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
label {
font-weight: bold;
display: block;
margin-top: 10px;
}
input[type="file"],
select,
input[type="text"],
button {
width: 100%;
padding: 8px;
margin-top: 5px;
margin-bottom: 10px;
border: 1px solid #ddd;
border-radius: 4px;
}
button {
background-color: #28a745;
color: #fff;
border: none;
cursor: pointer;
font-weight: bold;
}
button:hover {
background-color: #218838;
}
/* Processing indicator */
#processing-indicator {
display: none;
text-align: center;
color: #ff9900;
font-weight: bold;
margin-top: 10px;
}
</style>
<script>
function processVideo(event) {
event.preventDefault();
const formData = new FormData(document.getElementById('video-form'));
// Show processing indicator
document.getElementById('processing-indicator').style.display = 'block';
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))
.finally(() => {
// Hide processing indicator
document.getElementById('processing-indicator').style.display = 'none';
});
}
</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>
<!-- Processing indicator -->
<div id="processing-indicator">Processing your video, please wait...</div>
</body>
</html> |