RandomPersonRR commited on
Commit
985c99f
·
verified ·
1 Parent(s): ed9e4c3

Update html.html

Browse files
Files changed (1) hide show
  1. html.html +153 -91
html.html CHANGED
@@ -2,124 +2,186 @@
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
- <title>Video Processing Tool</title>
 
 
 
6
  <style>
7
  body {
8
  font-family: Arial, sans-serif;
9
- background-color: #f4f4f9;
10
  margin: 0;
11
- padding: 20px;
12
- color: #333;
 
 
 
13
  }
14
-
15
  h1 {
16
  color: #333;
17
  text-align: center;
18
  }
19
-
20
- form {
21
- background: #fff;
22
- max-width: 500px;
23
- margin: auto;
24
  padding: 20px;
25
- border-radius: 5px;
26
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
 
27
  }
28
-
29
  label {
30
- font-weight: bold;
31
- display: block;
32
- margin-top: 10px;
33
  }
34
-
35
- input[type="file"],
36
- select,
37
- input[type="text"],
38
- button {
39
  width: 100%;
40
- padding: 8px;
41
- margin-top: 5px;
42
- margin-bottom: 10px;
43
- border: 1px solid #ddd;
44
- border-radius: 4px;
 
 
 
 
45
  }
46
-
47
  button {
48
- background-color: #28a745;
49
  color: #fff;
50
  border: none;
51
  cursor: pointer;
52
- font-weight: bold;
53
  }
54
-
55
  button:hover {
56
- background-color: #218838;
57
  }
58
 
59
- /* Processing indicator */
60
- #processing-indicator {
61
- display: none;
62
- text-align: center;
63
- color: #ff9900;
64
- font-weight: bold;
65
  margin-top: 10px;
 
66
  }
67
- </style>
68
- <script>
69
- function processVideo(event) {
70
- event.preventDefault();
71
- const formData = new FormData(document.getElementById('video-form'));
72
-
73
- // Show processing indicator
74
- document.getElementById('processing-indicator').style.display = 'block';
75
-
76
- fetch('/process', { method: 'POST', body: formData })
77
- .then(response => {
78
- if (!response.ok) throw new Error("Error during processing");
79
- return response.blob();
80
- })
81
- .then(blob => {
82
- const downloadUrl = URL.createObjectURL(blob);
83
- const a = document.createElement('a');
84
- a.href = downloadUrl;
85
- a.download = "output.mp4";
86
- document.body.appendChild(a);
87
- a.click();
88
- a.remove();
89
- })
90
- .catch(error => alert(error.message))
91
- .finally(() => {
92
- // Hide processing indicator
93
- document.getElementById('processing-indicator').style.display = 'none';
94
- });
95
  }
96
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  </head>
98
  <body>
99
- <h1>Video Processing Tool</h1>
100
- <form id="video-form" onsubmit="processVideo(event)">
101
- <label for="video">Upload Video:</label>
102
- <input type="file" id="video" name="video" required>
103
-
104
- <label for="action">Action:</label>
105
- <select id="action" name="action">
106
- <option value="Convert Format">Convert Format</option>
107
- <option value="Trim Video">Trim Video</option>
108
- <option value="Resize Video">Resize Video</option>
109
- <option value="Extract Audio">Extract Audio</option>
110
- <option value="Extract Frames">Extract Frames</option>
111
- <option value="Change Video Speed">Change Video Speed</option>
112
- </select>
113
-
114
- <label for="format">Format:</label>
115
- <input type="text" id="format" name="format">
116
-
117
- <label><input type="checkbox" name="copy_streams"> Copy Streams</label>
118
-
119
- <button type="submit">Process Video</button>
120
- </form>
121
-
122
- <!-- Processing indicator -->
123
- <div id="processing-indicator">Processing your video, please wait...</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  </body>
125
  </html>
 
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Video Processing</title>
7
+
8
+ <!-- Styling for better visuals -->
9
  <style>
10
  body {
11
  font-family: Arial, sans-serif;
12
+ background-color: #f3f3f3;
13
  margin: 0;
14
+ padding: 0;
15
+ display: flex;
16
+ justify-content: center;
17
+ align-items: center;
18
+ height: 100vh;
19
  }
20
+
21
  h1 {
22
  color: #333;
23
  text-align: center;
24
  }
25
+
26
+ .form-container {
27
+ background-color: #fff;
 
 
28
  padding: 20px;
29
+ border-radius: 10px;
30
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
31
+ width: 300px;
32
  }
33
+
34
  label {
35
+ font-size: 16px;
36
+ margin-bottom: 5px;
37
+ color: #333;
38
  }
39
+
40
+ input, select, button {
 
 
 
41
  width: 100%;
42
+ padding: 10px;
43
+ margin: 10px 0;
44
+ border: 1px solid #ccc;
45
+ border-radius: 5px;
46
+ box-sizing: border-box;
47
+ }
48
+
49
+ input[type="file"] {
50
+ padding: 5px;
51
  }
52
+
53
  button {
54
+ background-color: #007BFF;
55
  color: #fff;
56
  border: none;
57
  cursor: pointer;
58
+ font-size: 16px;
59
  }
60
+
61
  button:hover {
62
+ background-color: #0056b3;
63
  }
64
 
65
+ .options-container {
 
 
 
 
 
66
  margin-top: 10px;
67
+ padding-left: 15px;
68
  }
69
+
70
+ .hidden {
71
+ display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  }
73
+
74
+ #copy-streams-container {
75
+ background-color: #f9f9f9;
76
+ padding: 10px;
77
+ border: 1px solid #ddd;
78
+ border-radius: 5px;
79
+ margin-top: 15px;
80
+ }
81
+
82
+ #copy-streams-container label {
83
+ font-size: 14px;
84
+ color: #555;
85
+ }
86
+ </style>
87
  </head>
88
  <body>
89
+ <div class="form-container">
90
+ <h1>Video Processing</h1>
91
+ <form id="video-form" action="/process" method="POST" enctype="multipart/form-data">
92
+ <label for="video">Select Video:</label>
93
+ <input type="file" name="video" id="video" required><br><br>
94
+
95
+ <label for="action">Select Action:</label>
96
+ <select name="action" id="action" required>
97
+ <option value="Convert Format">Convert Format</option>
98
+ <option value="Trim Video">Trim Video</option>
99
+ <option value="Resize Video">Resize Video</option>
100
+ <option value="Extract Audio">Extract Audio</option>
101
+ <option value="Extract Frames">Extract Frames</option>
102
+ <option value="Change Video Speed">Change Video Speed</option>
103
+ </select><br><br>
104
+
105
+ <!-- Copy Streams option shown only for Convert Format and Trim Video -->
106
+ <div id="copy-streams-container" class="hidden">
107
+ <label for="copy_streams">Copy Streams (No Re-encoding):</label>
108
+ <input type="checkbox" name="copy_streams" id="copy_streams"><br><br>
109
+ </div>
110
+
111
+ <!-- Format selection for Convert Format action -->
112
+ <div id="format-options" class="hidden options-container">
113
+ <label for="format">Select Output Format:</label>
114
+ <select name="format" id="format">
115
+ <option value="mp4">MP4</option>
116
+ <option value="avi">AVI</option>
117
+ <option value="mkv">MKV</option>
118
+ <option value="mov">MOV</option>
119
+ <option value="flv">FLV</option>
120
+ <option value="webm">WEBM</option>
121
+ </select><br><br>
122
+ </div>
123
+
124
+ <!-- Trim Video inputs -->
125
+ <div id="trim-options" class="hidden options-container">
126
+ <label for="start_time">Start Time (for Trim Video):</label>
127
+ <input type="text" name="start_time" id="start_time"><br><br>
128
+
129
+ <label for="duration">Duration (for Trim Video):</label>
130
+ <input type="text" name="duration" id="duration"><br><br>
131
+ </div>
132
+
133
+ <!-- Resize Video inputs -->
134
+ <div id="resize-options" class="hidden options-container">
135
+ <label for="width">Width (for Resize Video):</label>
136
+ <input type="text" name="width" id="width"><br><br>
137
+
138
+ <label for="height">Height (for Resize Video):</label>
139
+ <input type="text" name="height" id="height"><br><br>
140
+ </div>
141
+
142
+ <!-- Change Video Speed inputs -->
143
+ <div id="speed-options" class="hidden options-container">
144
+ <label for="speed_factor">Speed Factor (for Change Video Speed):</label>
145
+ <input type="text" name="speed_factor" id="speed_factor"><br><br>
146
+ </div>
147
+
148
+ <button type="submit">Submit</button>
149
+ </form>
150
+ </div>
151
+
152
+ <script>
153
+ // Show/hide inputs based on selected action
154
+ document.getElementById('action').addEventListener('change', function() {
155
+ const action = this.value;
156
+ const copyStreamsContainer = document.getElementById('copy-streams-container');
157
+ const formatOptions = document.getElementById('format-options');
158
+ const trimOptions = document.getElementById('trim-options');
159
+ const resizeOptions = document.getElementById('resize-options');
160
+ const speedOptions = document.getElementById('speed-options');
161
+
162
+ // Hide all extra options initially
163
+ formatOptions.classList.add('hidden');
164
+ trimOptions.classList.add('hidden');
165
+ resizeOptions.classList.add('hidden');
166
+ speedOptions.classList.add('hidden');
167
+ copyStreamsContainer.classList.add('hidden');
168
+
169
+ // Show options based on selected action
170
+ if (action === 'Trim Video') {
171
+ trimOptions.classList.remove('hidden');
172
+ copyStreamsContainer.classList.remove('hidden'); // Show for Trim Video
173
+ } else if (action === 'Resize Video') {
174
+ resizeOptions.classList.remove('hidden');
175
+ } else if (action === 'Change Video Speed') {
176
+ speedOptions.classList.remove('hidden');
177
+ } else if (action === 'Convert Format') {
178
+ formatOptions.classList.remove('hidden');
179
+ copyStreamsContainer.classList.remove('hidden'); // Show for Convert Format
180
+ }
181
+ });
182
+
183
+ // Trigger the change event to set initial visibility
184
+ document.getElementById('action').dispatchEvent(new Event('change'));
185
+ </script>
186
  </body>
187
  </html>