-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathffmg.php
executable file
·46 lines (43 loc) · 1.03 KB
/
ffmg.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
<?php
set_time_limit(0);
/*$url = array();
$file = fopen("/var/www/duration/part3.txt","r");
echo file_get_contents($file);
while(! feof($file))
{
$url[] = fgetcsv($file);
}
fclose($file);
foreach($url[0] as $k => $v)
{*/
$section = file_get_contents('/var/www/duration/music_full_tack.txt');
$data = explode("\n",$section);
foreach($data as $k => $v){
$video_duration = get_video_duration($v);
echo $output = "$v   $video_duration<br>";
$output = "$v \t $video_duration\n";
filewrite($output);
}
function get_video_duration($video_url)
{
extension_loaded('ffmpeg');
$ffmpegInstance = new ffmpeg_movie($video_url);
if($ffmpegInstance)
{
$duration_temp = $ffmpegInstance->getDuration();
$duration = gmdate("i:s",$duration_temp);
return $duration;
}
else
{
return 0;
}
}
function filewrite($output){
$filepath = '/var/www/duration/log.txt';
$file = fopen($filepath, "a+") or die("Unable to open file!");
chmod($filepath, 0777);
fwrite($file,$output);
fclose($file);
}
?>