Home >Backend Development >PHP Tutorial >PHP function sample code to obtain video preview image

PHP function sample code to obtain video preview image

怪我咯
怪我咯Original
2017-07-07 09:32:122067browse

This article mainly introduces the PHP simple method to obtain the video preview image, involving the skills of php operating multimedia files, which is of great practical value and needs Friends can refer to the following

This article describes an example of how to simply obtain the video preview in PHP. Share it with everyone for your reference. The specific implementation method is as follows:

The code is as follows:

<?php
convertToFlv( "some-video-input.avi", "output.jpg" );
function convertToFlv( $input, $output ) {
   echo "Converting $input to $output<br />";
   $command = "ffmpeg -v 0 -y -i $input -vframes 1 -ss 5 -vcodec mjpeg -f rawvideo -s 286x160 -aspect 16:9 $output ";
   echo "$command<br />";
   shell_exec( $command );
   echo "Converted<br />";
}
?>

The above is the detailed content of PHP function sample code to obtain video preview image. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn