-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
60 lines (44 loc) · 1.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
<?php
require_once('getID3/getid3/getid3.php');
if (isset($_POST["submit"]))
{
$file_name = $_FILES["video"]["tmp_name"];
$vid_duration = $_POST["duration"];
$videoname = $_POST["videoname"];
$output_file_path = "split/".$videoname;
$getID3 = new getID3();
$fileinfo = $getID3->analyze($file_name);
$str_time=$fileinfo['playtime_string'];
sscanf($str_time, "%d:%d:%d", $hours, $minutes, $seconds);
$time_seconds = isset($seconds) ? $hours * 3600 + $minutes * 60 + $seconds : $hours * 60 + $minutes;
$loop = ceil(floatval($time_seconds)/$vid_duration);
$cut_from_time = 0;
for ($i=0 ; $i < $loop ; $i++ ) {
$command = "C:/ffmpeg/bin/ffmpeg -i " . $file_name . " -vcodec copy -ss " . $cut_from_time . " -t " . $vid_duration. " " . $output_file_path.$i.".mp4";
system($command);
$cut_from_time = $cut_from_time + $vid_duration;
}
}
?>
<link rel="stylesheet" href="bootstrap-darkly.min.css">
<div class="container" style="margin-top: 100px;">
<div class="row">
<div class="offset-md-4 col-md-4">
<form method="POST" enctype="multipart/form-data">
<div class="form-group">
<label>Video</label>
<input type="file" name="video" class="form-control" >
</div>
<div class="form-group">
<label>Duration</label>
<input type="text" name="duration" class="form-control" placeholder="300.0">
</div>
<div class="form-group">
<label>Name Video</label>
<input type="text" name="videoname" class="form-control" placeholder="Video name Enter">
</div>
<input type="submit" name="submit" class="btn btn-primary" value="Split">
</form>
</div>
</div>
</div>