WP File Manager
Current Path:
/
home
/
itutorethiopia
/
public_html
/
app
/
Library
/
Name
Action
..
799651
BigBlueButton.php
Edit
ImageMagic.php
Edit
S3.php
Edit
SiteSettings.php
Edit
VideoHelpers.php
Edit
ZipHelpers.php
Edit
bsetecHelpers.php
Edit
bsetecHelpers_25.php
Edit
cacert.pem
Edit
index.php
Edit
smilies.php
Edit
Editing: VideoHelpers.php
<?php namespace App\Library; class VideoHelpers { private $ffmpeg_path; private $file_path; private $file_name; private $data; public function __construct($path,$file,$name){ $this->ffmpeg_path = $path; $this->file_path = $file; $this->file_name = $name; $this->data['split_duration'] = 10; $this->data['size'] = '320x480'; } public function getDuration(){ $cmd = shell_exec("$this->ffmpeg_path -i \"{$this->file_path}\" 2>&1"); preg_match('/Duration: (.*?),/', $cmd, $matches); // print_r($matches);exit; // echo $this->ffmpeg_path;exit; if(count($matches)>0){ return $matches[1]; }else{ return ''; } } public function convertImages(){ $cmd = "$this->ffmpeg_path -i \"{$this->file_path}\" -an -ss ".$this->data['split_duration']." -s {$this->data['size']} ./uploads/images/{$this->file_name}.jpg"; if(!shell_exec($cmd)){ return true; }else{ return false; } } public function convertVideos($given_type){ // if($given_type == "video/mp4"){ // $this->webMConversion(); // $this->oggConversion(); // }else{ $this->mp4Conversion(); $this->webMConversion(); $this->oggConversion(); // } } private function oggConversion(){ $cmd = "$this->ffmpeg_path -i $this->file_path -acodec libvorbis -b:a 128k -vcodec libtheora -b:v 400k -f ogg ./uploads/videos/{$this->file_name}.ogv"; if(!shell_exec($cmd)){ return true; }else{ return false; } } private function webMConversion(){ $cmd = "$this->ffmpeg_path -i $this->file_path -acodec libvorbis -b:a 128k -ac 2 -vcodec libvpx -b:v 400k -f webm ./uploads/videos/{$this->file_name}.webm"; if(!shell_exec($cmd)){ return true; }else{ return false; } } private function mp4Conversion(){ $cmd = "$this->ffmpeg_path -i $this->file_path -acodec aac -strict experimental ./uploads/videos/{$this->file_name}.mp4"; if(!shell_exec($cmd)){ return true; }else{ return false; } } }