Create Thumbnails From Videos PHP Code
Page 1 of 1
Create Thumbnails From Videos PHP Code
Vid coming Soon!
This will generate png for web servers (apache for example)
using video files in given folder / directory
- Code:
<?php
// (c)J~Net 2021
// jnet.sytes.net
// https://jnet.forumotion.com/t1726-creat-thumbnails-from-videos-php-code#2674
$pathToDir="/var/www/html/xxx/vids";
$folder="path/1";
$extensions=array('mp4','webm','avi');
$result=array();
$directory=new DirectoryIterator("$folder");
//
foreach ($directory as $fileinfo) {
// must be a file
if ($fileinfo->isFile()) {
// file extension
$extension=strtolower(pathinfo($fileinfo->getFilename(), PATHINFO_EXTENSION));
// check if extension match
if(in_array($extension, $extensions)) {
// add to result
//$result[]=$fileinfo->getFilename();
$vidfile=$fileinfo->getFilename();;
// my custom links
$Full="$pathToDir/$folder/$vidfile";
$lname=substr($Full, 0, -4);
echo "<p>$Full</p>";
if(!file_exists($lname-thumbnail.png)) {
$command="/usr/local/bin/ffmpeg -i ".$Full." -vf fps=1/60 ".$lname."-thumbnail.png"; // %03d
// system($command);
shell_exec($command);
//echo "<p>Thumbnail Created!<br></p>";
// $links .= '<a href="play.php?r='.$fileinfo->getFilename().'">'.$lname.'</a> <p>';
echo "<p>Missing Thumbnail Created!<br></p>";
}
}
}
}
?>
This will generate png for web servers (apache for example)
using video files in given folder / directory
Similar topics
» php code website base full of open source code
» How to Stream Videos Over the Internet With VLC
» Download Youtube Videos With Linux CLI
» Download Protected Youtube Videos On Linux
» avidemux desktop editing software for videos and audio
» How to Stream Videos Over the Internet With VLC
» Download Youtube Videos With Linux CLI
» Download Protected Youtube Videos On Linux
» avidemux desktop editing software for videos and audio
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum