Use of ffmpeg-php on Windows systems

Source: Internet
Author: User

These days to do project, one of the requirements is that the user uploads the video file to the server, and then the server automatically intercepts the video as the corresponding thumbnail image, the server-side language is written in PHP, find a half-day data, found that ffmpeg-php can meet the demand, So here's a quick introduction to the configuration and usage of the extension library.

The test server environment Wampserver Version 2.1,php5.3.5,ffmpeg-php Configuration and usage steps are as follows:

1. Download ffmpeg-php,

2. Place the Php_ffmpeg.dll in the PHP extension directory (e.g. E:\Program files\wamp\bin\php\php5.3.5\ext)

3. Place other DLL files in the system directory (e.g. C:\Windows\System32)

4. Modify PHP.ini, add the Extension=php_ffmpeg.dll configuration item, the result is as follows:


( note : To modify php.ini in the Apache directory (for example, E:\Program Files\wamp\bin\apache\apache2.2.17\bin\php.ini) in the Wamp environment, and to enable GD2 and GetText module)

5. Restart the Apache server

6. Print out the phpinfo to see if the output is as follows, and if so, the ffmpeg-php module is properly configured


ffmpeg-php version 0.6.0-svn
Ffmpeg-php built on SEP 8 2010 12:13:47
ffmpeg-php GD Support Enabled
FFmpeg libavcodec Version Lavc52.87.4
FFmpeg Libavformat Version Lavf52.78.3
FFmpeg Swscaler Version SwS0.11.0

Directive Local Value Master Value
Ffmpeg.allow_persistent 0 0
Ffmpeg.show_warnings 0 0

7. Write the test code, the sample code intercepts the second frame of the video as a thumbnail image

1  Public functionTestmp4 ()2 {3 if(extension_loaded(' FFmpeg ')) {//determine if FFmpeg is loaded4 $mov=NewFfmpeg_movie (' E:\\program files\\wamp\\www\\bbshow\\test\\guangfa15s.mp4 ');//the path to the video5Dump$mov);6 $ff _frame=$mov->getframe (2);7 $GD _image=$ff _frame-togdimage ();8 $img=$_server[' Document_root ']. " /test.jpg ";//to create an absolute path to a picture9Imagejpeg ($GD _image,$img);//creating a JPG imageTenImagedestroy ($GD _image);//destroying an image One}Else{ A Echo"FFmpeg not Loaded"; - } -}

8. Run the test code to generate a JPG thumbnail image on the server side

9. Please refer to the Official API ( for detailed instructions on using the ffmpeg-php.

Use of ffmpeg-php on Windows systems

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.