/**
  * Completes track information from a given path using ffmpeg.
  * @param Track $track
  */
 public function autocompleteTrack(Track $track)
 {
     if (!$track->getPath()) {
         throw new \BadMethodCallException('Input track has no path defined');
     }
     $file = $track->getPath();
     $movie = new \ffmpeg_movie($file, false);
     $finfo = new \finfo();
     if (!$this->fileHasMediaContent($finfo, $file)) {
         throw new \InvalidArgumentException("This file has no video nor audio tracks");
     }
     $only_audio = true;
     // General
     $track->setMimetype($finfo->file($file, FILEINFO_MIME_TYPE));
     $track->setBitrate($movie->getBitRate());
     $track->setDuration(ceil($movie->getDuration()));
     $track->setSize(filesize($file));
     if ($movie->hasVideo()) {
         $only_audio = false;
         $track->setVcodec($movie->getVideoCodec());
         $track->setFramerate($movie->getFrameRate());
         $track->setWidth($movie->getFrameWidth());
         $track->setHeight($movie->getFrameHeight());
     }
     if ($movie->hasAudio()) {
         $track->setAcodec($movie->getAudioCodec());
         $track->setChannels($movie->getAudioChannels());
     }
     $track->setOnlyAudio($only_audio);
 }
 public function getVideoSize($fileName)
 {
     $ffmpegInstance = new ffmpeg_movie($fileName);
     $video_size['width'] = $ffmpegInstance->getFrameWidth();
     $video_size['height'] = $ffmpegInstance->getFrameHeight();
     $video_size['duration'] = $ffmpegInstance->getDuration();
     $video_size['frame_rate'] = $ffmpegInstance->getFrameRate();
     $video_size['frame_count'] = $ffmpegInstance->getFrameCount();
     return $video_size;
 }
 function get_info($file)
 {
     if (!class_exists('ffmpeg_movie') or !($movie = new ffmpeg_movie($file))) {
         //ffmpeg extension required
         return false;
     }
     $duration = $movie->getDuration();
     $width = $movie->getFrameWidth();
     $height = $movie->getFrameHeight();
     $framerate = $movie->getFrameRate();
     $data = '';
     if ($duration) {
         $data .= "Duration: {$duration}\n";
     }
     if ($width and $height) {
         $data .= "Dimensions: {$width} x {$height} px\n";
     }
     if ($framerate) {
         $data .= "Framerate: {$framerate} fps\n";
     }
     return $data;
 }
Beispiel #4
0
 public function getDetails()
 {
     $path = Yii::getPathOfAlias('application');
     $file = $path . '/files/' . uid() . DS . $this->file;
     /*
             $command = '/usr/bin/ffmpeg -i ' . escapeshellarg($file) . ' 2>&1';
             $dimensions = array('width'=>0,'height'=>0);
             exec($command, $output, $status);
     	if(preg_match("/Duration: (?P<hour>[0-9]{2})\:(?P<minute>[0-9]{2})\:(?P<seconds>[0-9]{2})\.[0-9]{2}/",implode("\n",$output),$arr))
     		$dimensions['duration'] = $arr['hour']*3600 + $arr['minute']*60 + $arr['seconds'];
     	else
     		$dimensions['duration'] = 0;
             if (!preg_match('/Stream #(?:[0-9\.]+)(?:.*)\: Video: (?P<videocodec>.*) (?P<width>[0-9]*)x(?P<height>[0-9]*)/', implode('\n', $output), $matches)) {
                 preg_match('/Could not find codec parameters \(Video: (?P<videocodec>.*) (?P<width>[0-9]*)x(?P<height>[0-9]*)\)/', implode('\n', $output), $matches);
             }
     */
     if (class_exists('ffmpeg_movie')) {
         $movie = new ffmpeg_movie($file, false);
         if ($movie == NULL) {
             return NULL;
         }
         $dimensions['duration'] = $movie->getDuration();
         $dimensions['width'] = $movie->getFrameWidth();
         $dimensions['height'] = $movie->getFrameHeight();
     } else {
         $dimensions['duration'] = 0;
         $dimensions['width'] = 640;
         $dimensions['height'] = 360;
     }
     /* if (!empty($matches['width']) && !empty($matches['height'])) {
                 $dimensions['width'] = $matches['width'];
                 $dimensions['height'] = $matches['height'];
             }
     	*/
     return $dimensions;
 }
Beispiel #5
0
 public function generateFFMPEG()
 {
     $ff = new ffmpeg_movie($this->path . $this->data['path'] . '/' . $this->data['name']);
     if (!$ff) {
         $this->unknown = true;
         return false;
     }
     $this->info = array('width' => $ff->getFrameWidth(), 'height' => $ff->getFrameHeight(), 'duration' => $ff->getDuration(), 'mime' => $this->mime, 'size' => filesize($this->path . $this->data['path'] . '/' . $this->data['name']));
     if ($ff->getFrameCount() > 20) {
         $frame = $frame = $ff->getFrame(20);
     } else {
         $frame = $frame = $ff->getFrame($ff->getFrameCount() - 1);
     }
     $gd = $frame->toGDImage();
     $this->generateGDimage($gd, 'video');
     $this->updateDB();
 }
Beispiel #6
0
    ?>
</strong> (Dimple : <?php 
    echo $mediaAccess->getCategorie() . ' / ' . $mediaAccess->getDescription();
    ?>
)
        	<p><?php 
    echo $mediaAccess->getRelatedAvionsListAsString();
    ?>
</strong> (Rank <?php 
    echo $mediaAccess->getRank();
    ?>
) - Technical information :
			<?php 
    $video_source = getFtpMediasRoot() . $mediaAccess->srcname;
    $movie = new ffmpeg_movie($video_source);
    echo round($movie->getDuration());
    ?>
s /
            <?php 
    echo $movie->getFrameWidth();
    ?>
 x <?php 
    echo $movie->getFrameHeight();
    ?>
 px / <?php 
    echo $mediaAccess->getFileSize();
    ?>
</p>
			<?php 
    // Affichage du formulaire d'édition
    if ($active_media && !isset($confirm)) {
Beispiel #7
0
 public function generateFFMPEG()
 {
     $ff = new ffmpeg_movie($this->pathname . $this->filename);
     if (!$ff) {
         $this->unknown = true;
         return false;
     }
     $this->info = array('width' => $ff->getFrameWidth(), 'height' => $ff->getFrameHeight(), 'duration' => $ff->getDuration(), 'mime' => $this->mime, 'size' => filesize($this->pathname . $this->filename));
     if ($ff->getFrameCount() > 20) {
         $frame = $frame = $ff->getFrame(20);
     } else {
         $frame = $frame = $ff->getFrame($ff->getFrameCount() - 1);
     }
     $gd = $frame->toGDImage();
     imagejpeg($gd, $this->pathcache . $this->getBaseName());
     $this->mime = 'image/jpeg';
     $this->type = array('video', 'jpeg');
     $this->pathname = $this->pathcache;
     $this->filename = $this->getBaseName();
 }
Beispiel #8
0
function analyzeMediaFile(&$metaData, $filePath = NULL, $cachePath = NULL)
{
    if (!isset($metaData->fileName) || !isset($metaData->fileType)) {
        throw new Exception("meta data invalid");
    }
    $file = $filePath . DIRECTORY_SEPARATOR . $metaData->fileName;
    if (!is_file($file) || !is_readable($file)) {
        throw new Exception("file does not exist");
    }
    if (!is_dir($cachePath)) {
        throw new Exception("cache dir does not exist");
    }
    switch ($metaData->fileType) {
        case "video/quicktime":
        case "application/ogg":
        case "audio/mpeg":
        case "video/mp4":
        case "video/x-msvideo":
        case "video/ogg":
        case "video/webm":
        case "video/x-ms-asf":
        case "video/x-flv":
        case "audio/x-wav":
        case "application/octet-stream":
            if (isMediaFile($metaData, $filePath)) {
                $media = new ffmpeg_movie($file, FALSE);
                /****************************************************
                 * VIDEO
                 ****************************************************/
                if ($media->hasVideo()) {
                    $metaData->video->codec = $media->getVideoCodec();
                    $metaData->video->width = $media->getFrameWidth();
                    $metaData->video->height = $media->getFrameHeight();
                    $metaData->video->bitrate = $media->getVideoBitRate();
                    $metaData->video->framerate = $media->getFrameRate();
                    $metaData->video->duration = $media->getDuration();
                    /* Video Still */
                    $stillFile = $cachePath . DIRECTORY_SEPARATOR . uniqid("ft_") . ".png";
                    $fc = (int) ($media->getFrameCount() / 32);
                    /* frame count is not necessarily reliable! */
                    foreach (array($fc, 100, 10, 1) as $fno) {
                        if ($fno == 0) {
                            continue;
                        }
                        $f = $media->getFrame($fno);
                        if ($f !== FALSE) {
                            imagepng($f->toGDImage(), $stillFile);
                            $metaData->video->still = basename($stillFile);
                            break;
                        }
                    }
                    /* Video Thumbnails */
                    $thumbSizes = array(90, 180, 360);
                    foreach ($thumbSizes as $tS) {
                        $thumbFile = $cachePath . DIRECTORY_SEPARATOR . uniqid("ft_") . ".png";
                        list($thumb_width, $thumb_height) = generateThumbnail($stillFile, $thumbFile, $tS);
                        $metaData->video->thumbnail->{$tS}->file = basename($thumbFile);
                        $metaData->video->thumbnail->{$tS}->width = $thumb_width;
                        $metaData->video->thumbnail->{$tS}->height = $thumb_height;
                    }
                    /* Schedule for transcoding */
                    $transcodeSizes = array(360);
                    $metaData->transcodeStatus = 'WAITING';
                    $metaData->transcodeProgress = 0;
                    foreach ($transcodeSizes as $tS) {
                        $transcodeFile = $cachePath . DIRECTORY_SEPARATOR . uniqid("ft_") . ".webm";
                        list($width, $height) = scaleVideo($media->getFrameWidth(), $media->getFrameHeight(), $tS);
                        $metaData->video->transcode->{$tS}->file = basename($transcodeFile);
                        $metaData->video->transcode->{$tS}->width = $width;
                        $metaData->video->transcode->{$tS}->height = $height;
                    }
                }
                /****************************************************
                 * AUDIO
                 ****************************************************/
                if ($media->hasAudio()) {
                    $metaData->audio->codec = $media->getAudioCodec();
                    $metaData->audio->bitrate = $media->getAudioBitRate();
                    $metaData->audio->samplerate = $media->getAudioSampleRate();
                    $metaData->audio->duration = $media->getDuration();
                    $metaData->transcodeStatus = 'WAITING';
                    $metaData->transcodeProgress = 0;
                    $transcodeFile = $cachePath . DIRECTORY_SEPARATOR . uniqid("ft_") . ".ogg";
                    $metaData->audio->transcode->file = basename($transcodeFile);
                }
            } else {
                /* No media? */
            }
            break;
        case "image/jpeg":
        case "image/png":
        case "image/gif":
        case "image/bmp":
            list($width, $height) = getimagesize($file);
            $metaData->image->width = $width;
            $metaData->image->height = $height;
            $thumbFile = $cachePath . DIRECTORY_SEPARATOR . uniqid("ft_") . ".png";
            list($thumb_width, $thumb_height) = generateThumbnail($file, $thumbFile, 360);
            $metaData->image->thumbnail->{360}->file = basename($thumbFile);
            $metaData->image->thumbnail->{360}->width = $thumb_width;
            $metaData->image->thumbnail->{360}->height = $thumb_height;
            break;
        default:
            /* no idea about this file, let it go... */
    }
}
Beispiel #9
0
 private function _getMovieInfo()
 {
     $movieinfo = NULL;
     if (extension_loaded('ffmpeg') && false) {
         $movie = new ffmpeg_movie($this->tmpfile);
         $duration = $movie->getDuration();
         $movieinfo = array('duration' => $duration);
     } else {
         require_once FS_ROOT . 'include/ffmpeg/FFmpegAutoloader.php';
         $ffmpegOutput = new FFmpegOutputProvider(Core::config('ffmpeg_binary'));
         $ffmpeMovie = new FFmpegMovie($this->tmpfile, $ffmpegOutput, Core::config('ffmpeg_binary'));
         $duration = $ffmpeMovie->getDuration();
         $artist = $ffmpeMovie->getArtist();
         $rotate = $ffmpeMovie->getRotate();
         $movieinfo = array('duration' => $duration, 'artist' => $artist, 'orientation' => $rotate);
     }
     return $movieinfo;
 }
printf("libavcodec build number: %d<br/>", LIBAVCODEC_BUILD_NUMBER);
echo "</td></tr></table>";
echo "<p/>";
print_class_methods("ffmpeg_movie");
echo "<p/>";
print_class_methods("ffmpeg_frame");
// get an array for movies from the test media directory
$movies = getDirFiles(dirname(__FILE__) . '/tests/test_media');
$i = 1;
foreach ($movies as $movie) {
    $mov = new ffmpeg_movie($movie);
    echo '<table width="90%" class="hor-minimalist-a">';
    printf('<caption>Processing Test File: %s...</caption>', basename($mov->getFilename()));
    printf('<thead><tr><th width="150">Method</th><th>Result<br/></th></tr></thead>', $mov->getFileName());
    printf("<tr><td>file name:</td><td>%s<br/></td></tr>", $mov->getFileName());
    printf("<tr><td>duration</td><td>%s seconds<br/></td></tr>", $mov->getDuration());
    printf("<tr><td>frame count</td><td>%s<br/></td></tr>", $mov->getFrameCount());
    printf("<tr><td>frame rate</td><td>%0.3f fps<br/></td></tr>", $mov->getFrameRate());
    printf("<tr><td>comment</td><td>%s<br/></td></tr>", $mov->getComment());
    printf("<tr><td>title</td><td>%s<br/></td></tr>", $mov->getTitle());
    printf("<tr><td>author</td><td>%s<br/></td></tr>", $mov->getAuthor());
    printf("<tr><td>copyright</td><td>%s<br/></td></tr>", $mov->getCopyright());
    printf("<tr><td>get bit rate</td><td>%d<br/></td></tr>", $mov->getBitRate());
    printf("<tr><td>has audio</td><td>%s<br/></td></tr>", $mov->hasAudio() == 0 ? 'No' : 'Yes');
    if ($mov->hasAudio()) {
        printf("<tr><td>get audio stream id</td><td>%s<br/></td></tr>", $mov->getAudioStreamId());
        printf("<tr><td>get audio codec</td><td>%s<br/></td></tr>", $mov->getAudioCodec());
        printf("<tr><td>get audio bit rate</td><td>%d<br/></td></tr>", $mov->getAudioBitRate());
        printf("<tr><td>get audio sample rate</td><td>%d<br/></td></tr>", $mov->getAudioSampleRate());
        printf("<tr><td>get audio channels</td><td>%s<br/></td></tr>", $mov->getAudioChannels());
    }
Beispiel #11
0
<!-- attempts to play webpage video and desktop video synchronously and capturing snapshot -->
<!DOCTYPE html>
<html>
	<link type = "text/css" rel = "stylesheet" href = "stylesheet.css" />
	<body>

	<h1>billboard.com</h1>

	<button id="button" onclick="getCurTime()" type="button">Snapshot</button>
	<?php 
$video = new ffmpeg_movie("bunny.webm", false);
$duration = $video->getDuration();
$time_start = strtotime("06/01/2015 14:53:00");
$time_end = time();
$lapse = $time_end - $time_start;
//find time lapse between current time and start of desktop video
global $play_vid;
$play_vid = floor($lapse % $duration);
//finds the time at which webpage video should play
echo $play_vid;
?>
	
	<!-- plays the video automatically at the right point -->
	<video id="myVideo" width = "500" height = "500" autoplay loop onplay="seek()">
		<source src="bunny.webm" type="video/webm" onseeked="play()">	<!-- once start position is seeked, the video should play -->
	Not supported
	</video>
	
	<script>
	
	var vid = document.getElementById("myVideo"); 
Beispiel #12
0
 $files4[$i] = str_replace("(", "_", $files3[$i]);
 $files5[$i] = str_replace("'", "_", $files4[$i]);
 $files5[$i] = str_replace("á", "a", $files5[$i]);
 $files5[$i] = str_replace("é", "e", $files5[$i]);
 $files5[$i] = str_replace("í", "i", $files5[$i]);
 $files5[$i] = str_replace("ó", "o", $files5[$i]);
 $files5[$i] = str_replace("ú", "u", $files5[$i]);
 $files5[$i] = str_replace("ü", "u", $files5[$i]);
 $files5[$i] = str_replace("ć", "c", $files5[$i]);
 $files5[$i] = str_replace("ë", "e", $files5[$i]);
 if (move_uploaded_file($_FILES['archivo']['tmp_name'][$i], $peltmp . $files5[$i])) {
     echo "<div id='rs'>Ya subio, ahora espera un rato para que este disponible!!!</div>";
     //Duracion del video
     $peldur = "{$peltmp}{$files5[$i]}";
     $movie = new ffmpeg_movie($peldur);
     $seg = $movie->getDuration();
     $horas = floor($seg / 3600);
     $minutos = floor(($seg - $horas * 3600) / 60);
     if ($minutos < 10) {
         $min = "0{$minutos}";
     } else {
         $min = "{$minutos}";
     }
     $segundos = number_format($seg - $horas * 3600 - $minutos * 60);
     $dura = $horas . ':' . $min . ':' . $segundos;
     if ($sd == '0') {
         //Insertar base de datos de Peliculas
         $sql1 = "INSERT INTO lista (titulo, fecha, titucom, direccion, bueno, malo, dura) VALUES ('{$pelnom}', '{$ap}', '{$pelnomf}', '{$dp}', '0', '0', '{$dura}' )";
         mysql_query($sql1, $connect);
     } elseif ($sd == '1') {
         //Insertar base de datos de Cortometraje
 public function updateMetadata(MediaInterface $media, $force = false)
 {
     $file = sprintf('%s/%s/%s', $this->getFilesystem()->getAdapter()->getDirectory(), $this->generatePath($media), $media->getProviderReference());
     $fileinfos = new ffmpeg_movie($file, false);
     $img_par_s = $fileinfos->getFrameCount() / $fileinfos->getDuration();
     // Récupère l'image
     $frame = $fileinfos->getFrame(15 * $img_par_s);
     //$media->setContentType($media->getProviderReference()->getMimeType());
     $media->setContentType(mime_content_type($file));
     $media->setSize(filesize($file));
     $media->setWidth($frame->getWidth());
     $media->setHeight($frame->getHeight());
     $media->setLength($fileinfos->getDuration());
     $media->setMetadataValue('bitrate', $fileinfos->getBitRate());
 }
Beispiel #14
0
//Tests out timer functions of PHP in order to 
//sync video playing on webpage (webpage video) with video playing on desktop (desktop video)

<?php 
//play the video on the desktop
exec("cd /opt/lampp/htdocs/WEB/");
exec("xdg-open bunny.webm");
//get the start time of playing the desktop video
$time_start = microtime();
//get the duration of the video
$movie = new ffmpeg_movie("bunny.mpeg");
$duration = $movie->getDuration();
while (null) {
    //find the time difference between desktop ($time_start) and webpage ($time_end) video
    $time_end = microtime();
    $lapse = $time_end - $time_start;
    //determine at which point the webpage video needs to start by
    //finding remainder from time elapsed divided by video duration
    $play = $lapse % $duration;
}
Beispiel #15
0
if (php_sapi_name() != 'cli') {
    echo '<pre>';
}
printf("ffmpeg-php version string: %s\n", FFMPEG_PHP_VERSION_STRING);
printf("ffmpeg-php build date string: %s\n", FFMPEG_PHP_BUILD_DATE_STRING);
printf("libavcodec build number: %d\n", LIBAVCODEC_BUILD_NUMBER);
printf("libavcodec version number: %d\n", LIBAVCODEC_VERSION_NUMBER);
print_class_methods("ffmpeg_movie");
print_class_methods("ffmpeg_frame");
// get an array for movies from the test media directory
$movies = getDirFiles(dirname(__FILE__) . '/tests/test_media');
echo "--------------------\n\n";
foreach ($movies as $movie) {
    $mov = new ffmpeg_movie($movie);
    printf("file name = %s\n", $mov->getFileName());
    printf("duration = %s seconds\n", $mov->getDuration());
    printf("frame count = %s\n", $mov->getFrameCount());
    printf("frame rate = %0.3f fps\n", $mov->getFrameRate());
    printf("comment = %s\n", $mov->getComment());
    printf("title = %s\n", $mov->getTitle());
    printf("author = %s\n", $mov->getAuthor());
    printf("copyright = %s\n", $mov->getCopyright());
    printf("get bit rate = %d\n", $mov->getBitRate());
    printf("has audio = %s\n", $mov->hasAudio() == 0 ? 'No' : 'Yes');
    if ($mov->hasAudio()) {
        printf("get audio stream id= %s\n", $mov->getAudioStreamId());
        printf("get audio codec = %s\n", $mov->getAudioCodec());
        printf("get audio bit rate = %d\n", $mov->getAudioBitRate());
        printf("get audio sample rate = %d \n", $mov->getAudioSampleRate());
        printf("get audio channels = %s\n", $mov->getAudioChannels());
    }
Beispiel #16
0
 /**
  * Search datadir for folders and generate new playlists. Videos will be shown as separate playlists. 
  * Images will be added to the playlist named after the folder they reside in. 
  *
  * @return void
  * @author  
  */
 public static function refreshPlaylist($datadir)
 {
     if (!file_exists($datadir) || !is_dir($datadir)) {
         throw new Exception('Nincs ilyen könyvtár', 1);
     }
     $playlist = array();
     if (file_exists($datadir) && is_dir($datadir)) {
         $i = 1;
         foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($datadir)) as $file => $object) {
             $screen = null;
             if (is_file($file) && count(preg_grep(sprintf("/%s/i", $object->getExtension()), self::$valid_video_extensions))) {
                 if (false !== ($movie = new \ffmpeg_movie($file))) {
                     // This is a valid and supported video file (based on file extension and on the fact that ffmpeg could open it)
                     $screen = array('duration' => ceil(($duration = $movie->getDuration()) * 1000), 'assets' => array(array('type' => 'video', 'name' => sprintf('%s (%s)', basename($file), $duration > 3600 ? gmdate('H:i:s', $duration) : gmdate('i:s', $duration)), 'filename' => $file)));
                 }
             }
             if (is_file($file) && count(preg_grep(sprintf("/%s/i", $object->getExtension()), array_keys(self::$valid_image_extensions)))) {
                 if (false !== ($d = getimagesize($file)) && in_array($d['mime'], self::$valid_image_extensions)) {
                     // This is a valid and supported image file (based on file extension and on the fact that getimagesize() could open it)
                     $screen = array('duration' => 5000, 'assets' => array(array('type' => 'image', 'dimensions' => 'auto', 'name' => sprintf('%s', basename($file)), 'filename' => $file)));
                 }
             }
             if (is_array($screen)) {
                 // The playlist key is a hash from the directory which contains the file, so everything in the same directory will
                 // belong to the same playlist
                 $key = md5(dirname($file));
                 if (!array_key_exists(sprintf('playlist_%s', $key), $playlist)) {
                     // This is a new playlist, set the default values
                     $playlist[sprintf('playlist_%s', $key)] = array('id' => $key, 'name' => substr(dirname($file), strlen($datadir) + 1) . ' könyvtár: ', 'starttime' => 0, 'endtime' => 0, 'priority' => 1000 - $i++, 'enabled' => false, 'loop' => true, 'screens' => array($screen));
                 } else {
                     // This playlist is already exists, add the new screen to it
                     $playlist[sprintf('playlist_%s', $key)]['screens'][] = $screen;
                     //						$playlist[sprintf('playlist_%s', $key)]['name'] .= ', ' . $name;
                 }
             }
         }
     }
     foreach ($playlist as $key => $pl) {
         // Sort playlist screens by filename (of the first asset)
         $playlist[$key]['screens'] = multiSort($pl['screens'], SORT_ASC, 'assets/0/filename');
         // Update the visible name of the playlists (now it's ordered correctly)
         $names = array();
         foreach ($playlist[$key]['screens'] as $screen) {
             $names[] = $screen['assets'][0]['name'];
         }
         $playlist[$key]['name'] .= implode(', ', $names);
     }
     // Sort playlists by name
     $playlist = multiSort($playlist, SORT_ASC, 'name');
     self::$data = $playlist;
     self::savePlaylist();
     return true;
 }
Beispiel #17
-23
function captureVideoPosterImg($movie_file = '')
{
    extension_loaded('ffmpeg');
    $movie_file = 'http://upload.freelabel.net/server/php/files/JXL%20%23CrunkDUpTour%20Promo.mp4';
    // Instantiates the class ffmpeg_movie so we can get the information you want the video
    $movie = new ffmpeg_movie($movie_file);
    // Get The duration of the video in seconds
    echo $Duration = round($movie->getDuration(), 0);
    // Get the number of frames of the video
    $TotalFrames = $movie->getFrameCount();
    // Get the height in pixels Video
    $height = $movie->getFrameHeight();
    // Get the width of the video in pixels
    $width = $movie->getFrameWidth();
    //Receiving the frame from the video and saving
    // Need to create a GD image ffmpeg-php to work on it
    $image = imagecreatetruecolor($width, $height);
    // Create an instance of the frame with the class ffmpeg_frame
    $Frame = new ffmpeg_frame($image);
    // Choose the frame you want to save as jpeg
    $thumbnailOf = (int) round($movie->getFrameCount() / 2.5);
    // Receives the frame
    $frame = $movie->GetFrame($thumbnailOf);
    // Convert to a GD image
    $image = $frame->toGDImage();
    // Save to disk.
    //echo $movie_file.'.jpg';
    imagejpeg($image, $movie_file . '.jpg', 100);
    return $movie_file . '.jpg';
}