File size: 7,055 Bytes
a83f70a
 
 
 
985c99f
 
 
3a32f23
d559fe3
 
 
985c99f
d559fe3
985c99f
 
 
 
 
d559fe3
985c99f
d559fe3
 
 
 
985c99f
 
 
d559fe3
985c99f
 
 
d559fe3
985c99f
d559fe3
985c99f
 
 
d559fe3
985c99f
 
d559fe3
985c99f
 
 
 
 
 
 
 
 
d559fe3
985c99f
d559fe3
985c99f
d559fe3
 
 
985c99f
d559fe3
985c99f
d559fe3
985c99f
d559fe3
 
985c99f
d559fe3
985c99f
d559fe3
985c99f
 
 
a83f70a
985c99f
 
 
 
 
 
 
 
 
 
 
 
 
3a32f23
 
 
 
 
985c99f
a83f70a
 
985c99f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3a32f23
985c99f
 
 
 
 
3a32f23
985c99f
 
 
 
 
 
 
 
 
 
 
 
3a32f23
985c99f
 
 
 
 
 
 
 
3a32f23
985c99f
 
 
 
 
 
 
 
3a32f23
985c99f
 
 
 
 
 
 
 
 
 
3a32f23
985c99f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3a32f23
985c99f
 
 
 
 
3a32f23
 
985c99f
 
 
3a32f23
985c99f
 
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Video Processing</title>

    <!-- Add some basic styling for better visuals -->
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f3f3f3;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        h1 {
            color: #333;
            text-align: center;
        }

        .form-container {
            background-color: #fff;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            width: 300px;
        }

        label {
            font-size: 16px;
            margin-bottom: 5px;
            color: #333;
        }

        input, select, button {
            width: 100%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 5px;
            box-sizing: border-box;
        }

        input[type="file"] {
            padding: 5px;
        }

        button {
            background-color: #007BFF;
            color: #fff;
            border: none;
            cursor: pointer;
            font-size: 16px;
        }

        button:hover {
            background-color: #0056b3;
        }

        .options-container {
            margin-top: 10px;
            padding-left: 15px;
        }

        .hidden {
            display: none;
        }

        #copy-streams-container {
            background-color: #f9f9f9;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 5px;
            margin-top: 15px;
        }

        #copy-streams-container label {
            font-size: 14px;
            color: #555;
        }

        .form-container select,
        .form-container input {
            background-color: #f9f9f9;
        }
    </style>
</head>
<body>
    <div class="form-container">
        <h1>Video Processing</h1>
        <form id="video-form" action="/process" method="POST" enctype="multipart/form-data">
            <label for="video">Select Video:</label>
            <input type="file" name="video" id="video" required><br><br>

            <label for="action">Select Action:</label>
            <select name="action" id="action" required>
                <option value="Convert Format">Convert Format</option>
                <option value="Trim Video">Trim Video</option>
                <option value="Resize Video">Resize Video</option>
                <option value="Extract Audio">Extract Audio</option>
                <option value="Extract Frames">Extract Frames</option>
                <option value="Change Video Speed">Change Video Speed</option>
            </select><br><br>

            <!-- Show Copy Streams checkbox only for Convert Format and Trim Video -->
            <div id="copy-streams-container" class="hidden">
                <label for="copy_streams">Copy Streams (No Re-encoding):</label>
                <input type="checkbox" name="copy_streams" id="copy_streams"><br><br>
            </div>

            <!-- Inputs for Convert Format action -->
            <div id="format-options" class="hidden options-container">
                <label for="format">Select Output Format:</label>
                <select name="format" id="format">
                    <option value="mp4">MP4</option>
                    <option value="avi">AVI</option>
                    <option value="mkv">MKV</option>
                    <option value="mov">MOV</option>
                    <option value="flv">FLV</option>
                    <option value="webm">WEBM</option>
                </select><br><br>
            </div>

            <!-- Inputs for Trim Video action -->
            <div id="trim-options" class="hidden options-container">
                <label for="start_time">Start Time (for Trim Video):</label>
                <input type="text" name="start_time" id="start_time"><br><br>

                <label for="duration">Duration (for Trim Video):</label>
                <input type="text" name="duration" id="duration"><br><br>
            </div>

            <!-- Inputs for Resize Video action -->
            <div id="resize-options" class="hidden options-container">
                <label for="width">Width (for Resize Video):</label>
                <input type="text" name="width" id="width"><br><br>

                <label for="height">Height (for Resize Video):</label>
                <input type="text" name="height" id="height"><br><br>
            </div>

            <!-- Inputs for Change Video Speed action -->
            <div id="speed-options" class="hidden options-container">
                <label for="speed_factor">Speed Factor (for Change Video Speed):</label>
                <input type="text" name="speed_factor" id="speed_factor"><br><br>
            </div>

            <button type="submit">Submit</button>
        </form>
    </div>

    <script>
        // Show or hide the corresponding inputs based on selected action
        document.getElementById('action').addEventListener('change', function() {
            const action = this.value;
            const copyStreamsContainer = document.getElementById('copy-streams-container');
            const formatOptions = document.getElementById('format-options');
            const trimOptions = document.getElementById('trim-options');
            const resizeOptions = document.getElementById('resize-options');
            const speedOptions = document.getElementById('speed-options');

            // Hide all extra options initially
            formatOptions.classList.add('hidden');
            trimOptions.classList.add('hidden');
            resizeOptions.classList.add('hidden');
            speedOptions.classList.add('hidden');
            copyStreamsContainer.classList.add('hidden');

            // Show options based on selected action
            if (action === 'Trim Video') {
                trimOptions.classList.remove('hidden');
                copyStreamsContainer.classList.remove('hidden');  // Show the copy streams option for Trim Video
            } else if (action === 'Resize Video') {
                resizeOptions.classList.remove('hidden');
            } else if (action === 'Change Video Speed') {
                speedOptions.classList.remove('hidden');
            } else if (action === 'Convert Format') {
                formatOptions.classList.remove('hidden');  // Show the format selection for Convert Format
                copyStreamsContainer.classList.remove('hidden');  // Show the copy streams option for Convert Format
            }
        });

        // Trigger the change event to set initial visibility based on the default selection
        document.getElementById('action').dispatchEvent(new Event('change'));
    </script>
</body>
</html>