I have installed ffmpeg in my linux box and have this code to generate thumbnails while I upload videos to my webserver. I am trying to save thumbnails in the same folder where I am uploading my videos
php:
if (isset($_FILES['attachments']))
{
$msg = "";
$targetFile = "upload/" . basename($_FILES['attachments']['name'][0]);
if (file_exists($targetFile))
$msg = array("status" => 0, "msg" => "File already exists!");
else if (move_uploaded_file($_FILES['attachments']['tmp_name'][0],$targetFile))
$msg = array("status" => 1, "msg" => "File Has Been Uploaded", "path" => $targetFile);
$ffmpeg = "upload/";
$videoFile = $_FILES["attachments"]["tmp_name"];
$size = "120x90";
for($num = 1; $num <= 3; $num++)
{
$interval = $num * 3;
shell_exec("$ffmpeg -i $videoFile -an -ss $interval -s $size $num.jpg");
echo "Thumbnail Created! - $num.jpg<br />";
}
}
But I am only getting my uploaded videos in that folder? I find the documentation to use ffmpeg is quite confusing and don't if I am doing it right or not.
Output :
and when I ran the "ffmpeg" in the command line: