i have this page (very simple to show what i need) to upload flv files - i read some posts about ffmpeg-php but how to install in on the server if it's the solution and how to use it?
<?php
if(isset($_REQUEST['upload'])){
$tmp_name = $_FILES['video']['tmp_name'];
$name = $_FILES['video']['name'];
$path = "videos/";
move_uploaded_file($tmp_name,$path.$name);
}
else{
?>
<form action="" method="post" enctype="multipart/form-data">
<input name="video" type="file" /> <input name="upload" type="submit" value="upload" />
</form>
<?php
}
?>
and need to create a thumbnail for video uploaded in another folder with the same name any help ? thanks in advance
Or you can do it in the browser with HTML5's video tag and canvas, see: https://gist.github.com/adamjimenez/5917897
Installing ffmpeg should be straightforward. On any Ubuntu/Debian based distro, use apt-get:
After that, you can use it to create a thumbnail.
First you need to get a random time location from your file:
Now that your
$second
variable is set. Get the actual thumbnail:It will automatically save the thumbnail to
thumbnails/random_name.jpg
(you may want to change that name based on the uploaded video)If you want to resize the thumbnail, use the
-s
parameter (-s 300x300
)Check out the ffmpeg documentation for a complete list of parameters you can use.