-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.php
112 lines (83 loc) · 2.63 KB
/
index.php
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>FFmpeg Command Execution</title>
<link rel='stylesheet' href='./assets/bootstrap.min.css'>
<script src="./assets/jquery.min.js"></script>
<style>
.mycheckbox{position:absolute;width:100%;left:0;height:50%;}
.log{display:none;white-space:pre-line;text-align:left;overflow-y:scroll;height:300px;}
</style>
</head>
<body class="my-3" style="background:#EEE;">
<div class="container">
<div class="row">
<div class="col-md-8 my-3 m-auto">
<h3 class="text-center mb-3">Upload Video</h3>
<div class="p-4 shadow bg-white">
<div class="col">
<div class="form-group">
<input type="file" name="file" id="file" class="form-control border-0">
</div>
<label class="ml-3">Allowed Formats: mp4, mkv, avi, flv, 3gp</label>
</div>
<div class="col mt-3 text-center">
<div id="status_file"></div>
</div>
</div>
<h3 class="text-center my-4">Video List</h3>
<div class="col shadow p-4 bg-white">
<div class="row text-center my-2">
<div class="col-md-6 pt-2 font-weight-bold">
Video Name
</div>
<div class="col-md-6 pt-2 font-weight-bold">
Select Video
</div>
</div>
<?php
$allowed_ext = ['mp4', 'mkv', 'avi', 'flv', '3gp'];
foreach(glob(__DIR__ . '/input/*') as $file){
$ext = pathinfo($file, PATHINFO_EXTENSION);
if(in_array($ext, $allowed_ext)){
?>
<div class="row">
<div class="col-md-6 pt-2 border">
<?php echo basename($file); ?>
</div>
<div class="col-md-6 pt-2 border" id="selection">
<input class="mycheckbox" name="select_video" type="radio" data-video="<?php echo basename($file); ?>">
</div>
</div>
<?php }
}
?>
<input type="hidden" name="video" id="video" value="">
<hr/>
<h5 class="text-center">Enter FFmpeg Parameters<br/><small class="text-center mt-3 d-block text-muted">(use INPUT instead of input video path and use OUTPUT instead of output video path)</small></h5>
<textarea id="code" rows="3" class="form-control">ffmpeg -i INPUT OUTPUT</textarea>
<div class="col-md-12 text-center my-2">
<button id="start" class="btn btn-danger text-white">
Start Encode Video
</button>
</div>
<div class="col-md-12 text-center mt-4">
<div class="progress" style="display:none;">
<div class="progress-bar" id="prog" role="progressbar"
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
</div>
<div class="col-md-12 mt-4">
<div id="log" class="log"></div>
</div>
</div>
</div>
</div><!-- row -->
</div><!-- container -->
<script src="./assets/bootstrap.min.js"></script>
<script src="./assets/simpleUpload.js"></script>
<script src="./assets/app.js"></script>
</body>
</html>