File size: 1,753 Bytes
a83f70a
 
 
 
9f97732
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a83f70a
9f97732
a83f70a
 
9f97732
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<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>