Created
January 19, 2017 08:25
-
-
Save subhashdasyam/c1e136c12ae9f9e0855222d6defadd72 to your computer and use it in GitHub Desktop.
FFmpeg PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ffmpegpath = "ffmpeg.exe"; | |
$input = 'wattan.flv'; | |
$output = 'wattan.jpg'; | |
if (make_jpg($input, $output)){ | |
echo 'success'; | |
}else{ | |
echo 'bah!'; | |
} | |
function make_jpg($input, $output, $fromdurasec="01") { | |
global $ffmpegpath; | |
if(!file_exists($input)) return false; | |
$command = "$ffmpegpath -i $input -an -ss 00:00:$fromdurasec -r 1 -vframes 1 -f mjpeg -y $output"; | |
@exec( $command, $ret ); | |
if(!file_exists($output)) return false; | |
if(filesize($output)==0) return false; | |
return true; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment