-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
301 lines (292 loc) · 14.7 KB
/
index.html
File metadata and controls
301 lines (292 loc) · 14.7 KB
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<!DOCTYPE html>
<html>
<head>
<title>Hardsub Code</title>
<meta charset="utf-8" />
<meta name="description" content="Web GUI for making basic FFmpeg hardsub commands.">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://apis.google.com/js/api.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/html-duration-picker@latest/dist/html-duration-picker.min.js"></script>
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="theme-color" content="#ffffff">
<script>
function executehardsubber(){
var inputFilename = document.getElementById('inputFile').value;
var assFilename = document.getElementById('assFile').value;
var outputFilename = document.getElementById('outputFile').value;
if(document.getElementById("inputMP4").checked == true){
var inputExtension = ".mp4";
}
if(document.getElementById("inputMKV").checked == true){
var inputExtension = ".mkv";
}
if(document.getElementById("outputMP4").checked == true){
var outputExtension = ".mp4";
}
if(document.getElementById("outputMKV").checked == true){
var outputExtension = ".mkv";
}
var result = 'ffmpeg -i "' + inputFilename + inputExtension + '" -c:a copy -vf subtitles="' + assFilename + '.ass" -crf 17 "' + outputFilename + outputExtension + '"';
document.getElementById('resulthardsubber').innerHTML = result;
}
function executegreenscreener1(){
var inputFilenameGS = document.getElementById('inputFilenameGS').value;
var timeresult = 'ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 -sexagesimal "' + inputFilenameGS + '.mp4"';
document.getElementById('resultgreenscreener1').innerHTML = timeresult;
}
function executegreenscreener2(){
var videoDuration = document.getElementById('videoDuration').value;
var assFilenameGS = document.getElementById('assFilenameGS').value;
var outputFilenameGS = document.getElementById('outputFilenameGS').value;
var renderresult = 'ffmpeg -f lavfi -i color=color=0x00FF00:s=1920x1080 -t ' + videoDuration + ' -vf "format=pix_fmts=rgb32,ass='' + assFilenameGS + '.ass':fontsdir=fonts,format=pix_fmts=yuv420p" -crf 17 "' + outputFilenameGS + '.mp4"';
document.getElementById('resultgreenscreener2').innerHTML = renderresult;
}
function executearchiver(){
var ytLink = document.getElementById('ytLink').value;
var result = 'yt-dlp -o "[%(upload_date)s] %(title)s [%(id)s]\%(title)s [%(id)s].%(ext)s" --sub-langs all --sub-format srv3 --write-subs --write-thumbnail --get-comments -f bestvideo[ext=mp4]+bestaudio[ext=m4a] ' + ytLink;
document.getElementById('resultarchiver').innerHTML = result;
}
function executelivearchiver(){
var streamLink = document.getElementById('streamLink').value;
var result = 'ytarchive --add-metadata --debug --threads 4 --write-description --write-thumbnail ' + streamLink + ' best';
document.getElementById('resultlivearchiver').innerHTML = result;
}
function executeclipper(){
var ytLinkCL = document.getElementById('ytLinkCL').value;
var timestampStart = document.getElementById('timestampStart').value;
var timestampEnd = document.getElementById('timestampEnd').value;
if(document.getElementById("forceKeyframes").checked == true){
var forceKeyframes = "--force-keyframes-at-cuts ";
}
else{
var forceKeyframes = "";
}
var timestampStartSplit = timestampStart.split(':');
var timestampEndSplit = timestampEnd.split(':');
var timestampStartSeconds = (+timestampStartSplit[0]) * 60 * 60 + (+timestampStartSplit[1]) * 60 + (+timestampStartSplit[2]);
var timestampEndSeconds = (+timestampEndSplit[0]) * 60 * 60 + (+timestampEndSplit[1]) * 60 + (+timestampEndSplit[2]);
var result = 'yt-dlp -f bestvideo[ext=mp4]+bestaudio[ext=m4a] --download-sections "*' + timestampStartSeconds + '-' + timestampEndSeconds + '" ' + forceKeyframes + ytLinkCL;
document.getElementById('resultclipper').innerHTML = result;
}
function copyhardsubber(){
document.querySelector("#resulthardsubber").select();
document.execCommand('copy');
}
function copygreenscreener1(){
document.querySelector("#resultgreenscreener1").select();
document.execCommand('copy');
}
function copygreenscreener2(){
document.querySelector("#resultgreenscreener2").select();
document.execCommand('copy');
}
function copyarchiver(){
document.querySelector("#resultarchiver").select();
document.execCommand('copy');
}
function copylivearchiver(){
document.querySelector("#resultlivearchiver").select();
document.execCommand('copy');
}
function copyclipper(){
document.querySelector("#resultclipper").select();
document.execCommand('copy');
}
</script>
<style>
.nav-tabs {
flex-wrap: nowrap;
overflow-x: auto;
overflow-y: clip;
font-size: 0.9rem;
height: 100%;
}
@media screen and (min-width: 601px) {
.main-div{
width: 550px;
margin: 20px auto;
}
.btn {
font-size: 1rem;
width: 100%
}
.form-control{
font-size: 1rem;
}
.logo {
padding: 3rem;
}
.logo-img{
width: 40%;
}
}
@media screen and (max-width: 600px) {
.main-div{
width: 100%;
}
.btn {
font-size: 1rem;
width: 100%;
}
.form-control{
font-size: 1rem;
}
.logo {
padding: 2rem;
}
.logo-img{
width: 60%;
}
}
.main-text{
text-align: center;
}
.tab-content{
padding:1rem;
border: 1px solid #DEE2E6;
border-radius: 0px 0px 5px 5px;
}
.row{
margin: 0.5rem;
}
</style>
</head>
<body>
<div class="main-div">
<!--HEADER-->
<div class="main-text">
<h1 style="padding-top: 0.5rem;">
<img src="hscode.png" width="40rem" style="padding-bottom: 0.5rem;"/> Hardsub Code
</h1>
<p>Lots of useful video commands.</p>
</div>
<!--TABS-->
<ul class="nav nav-tabs" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="hardsubber-tab" data-bs-toggle="tab" data-bs-target="#hardsubber" type="button" role="tab" aria-controls="hardsubber" aria-selected="true">🔥 Hardsubber</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="greenscreener-tab" data-bs-toggle="tab" data-bs-target="#greenscreener" type="button" role="tab" aria-controls="greenscreener" aria-selected="false">🟩 GreenScreener</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="archiver-tab" data-bs-toggle="tab" data-bs-target="#archiver" type="button" role="tab" aria-controls="archiver" aria-selected="false">🕰️ Archiver</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="livearchiver-tab" data-bs-toggle="tab" data-bs-target="#livearchiver" type="button" role="tab" aria-controls="livearchiver" aria-selected="false">🔴 LiveArchiver</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="clipper-tab" data-bs-toggle="tab" data-bs-target="#clipper" type="button" role="tab" aria-controls="clipper" aria-selected="false">✂️ Clipper</button>
</li>
</ul>
<!--TAB CONTENT-->
<div class="tab-content" id="myTabContent">
<!--HARDSUBBER-->
<div class="tab-pane fade show active" id="hardsubber" role="tabpanel" aria-labelledby="hardsubber-tab">
<h5>Hardsubber</h5>
<p>Create an FFmpeg command to hardsub an ASS file to a video.</p>
<input class="form-control" id="inputFile" placeholder="Input filename" onkeyup="executehardsubber()">
<div class="row">
<div class="form-check col">
<input class="form-check-input" type="radio" name="flexRadioDefault" id="inputMP4" onChange="executehardsubber()" checked>
<label class="form-check-label" for="inputMP4">
MP4
</label>
</div>
<div class="form-check col">
<input class="form-check-input" type="radio" name="flexRadioDefault" id="inputMKV" onChange="executehardsubber()">
<label class="form-check-label" for="inputMKV">
MKV
</label>
</div>
</div>
<input class="form-control" id="assFile" placeholder="ASS filename" onkeyup="executehardsubber()">
<br/>
<input class="form-control" id="outputFile" placeholder="Output filename" onkeyup="executehardsubber()">
<div class="row">
<div class="form-check col">
<input class="form-check-input" type="radio" name="flexRadioDefault2" id="outputMP4" onChange="executehardsubber()" checked>
<label class="form-check-label" for="outputMP4">
MP4
</label>
</div>
<div class="form-check col">
<input class="form-check-input" type="radio" name="flexRadioDefault2" id="outputMKV" onChange="executehardsubber()">
<label class="form-check-label" for="outputMKV">
MKV
</label>
</div>
</div>
<textarea id="resulthardsubber" class="form-control" rows="3" placeholder="Command goes here"></textarea>
<button onclick="copyhardsubber()" id="copyButtonHardsubber" class="btn btn-primary mb-3">Copy</button>
</div>
<!--GREENSCREENER-->
<div class="tab-pane fade" id="greenscreener" role="tabpanel" aria-labelledby="greenscreener-tab">
<h5>GreenScreener</h5>
<p>Create an FFmpeg command that makes a green screen hardsub.</p>
<input class="form-control" id="inputFilenameGS" placeholder="Input MP4 filename" onkeyup="executegreenscreener1()">
<br/>
<textarea id="resultgreenscreener1" class="form-control" rows="3" placeholder="Get video duration command goes here"></textarea>
<button onclick="copygreenscreener1()" id="copyButtonGreenScreener1" class="btn btn-primary mb-3">Copy</button>
<input class="form-control" id="videoDuration" placeholder="Video duration" onkeyup="executegreenscreener2()">
<br/>
<input class="form-control" id="assFilenameGS" placeholder="ASS filename" onkeyup="executegreenscreener2()">
<br/>
<input class="form-control" id="outputFilenameGS" placeholder="Output MP4 filename" onkeyup="executegreenscreener2()">
<br/>
<textarea id="resultgreenscreener2" class="form-control" rows="4" placeholder="Render command goes here"></textarea>
<button onclick="copygreenscreener2()" id="copyButtonGreenScreener2" class="btn btn-primary mb-3">Copy</button>
</div>
<!--ARCHIVER-->
<div class="tab-pane fade" id="archiver" role="tabpanel" aria-labelledby="archiver-tab">
<h5>Archiver</h5>
<p>Create a yt-dlp command to download a video for archival.</p>
<input class="form-control" id="ytLink" placeholder="YouTube link" onkeyup="executearchiver()">
<br/>
<textarea id="resultarchiver" class="form-control" rows="5" placeholder="Command goes here"></textarea>
<button onclick="copyarchiver()" id="copyButtonArchiver" class="btn btn-primary mb-3">Copy</button>
</div>
<!--LIVEARCHIVER-->
<div class="tab-pane fade" id="livearchiver" role="tabpanel" aria-labelledby="livearchiver-tab">
<h5>LiveArchiver</h5>
<p>Create a ytarchive command for downloading an ongoing livestream. Useful for unarchived streams.</p>
<input class="form-control" id="streamLink" placeholder="YouTube livestream link" onkeyup="executelivearchiver()">
<br/>
<textarea id="resultlivearchiver" class="form-control" rows="5" placeholder="Command goes here"></textarea>
<button onclick="copylivearchiver()" id="copyButtonLiveArchiver" class="btn btn-primary mb-3">Copy</button>
</div>
<!--CLIPPER-->
<div class="tab-pane fade" id="clipper" role="tabpanel" aria-labelledby="clipper-tab">
<h5>Clipper</h5>
<p>Create a clip from a YouTube video using yt-dlp.</p>
<input class="form-control" id="ytLinkCL" placeholder="YouTube link" onkeyup="executeclipper()">
<br/>
<label for="timestampStart">Start</label>
<input class="form-control html-duration-picker" id="timestampStart" onkeyup="executeclipper()">
 
<label for="timestampEnd">End</label>
<input class="form-control html-duration-picker" id="timestampEnd" onkeyup="executeclipper()">
 
<input class="form-check-input" type="checkbox" value="" id="forceKeyframes" onChange="executeclipper()">
<label class="form-check-label" for="forceKeyframes">Force keyframes at cut?</label>
<br/>
<br/>
<textarea id="resultclipper" class="form-control" rows="5" placeholder="Command goes here"></textarea>
<button onclick="copyclipper()" id="copyButtonClipper" class="btn btn-primary mb-3">Copy</button>
</div>
</div>
</div>
<!--FOOTER-->
<div style="bottom: 15px;text-align: center;width: 100%">Hardsub Code formatter built by <a href="https://mdkj.dev/">Madekuji-san</a> for <a href="https://www.youtube.com/channel/UCweNMiLJU3IsVUhZM3Uh0vg">Hololive Resort Subs</a>.
</div>
</body>
</html>