The php extension ffmpeg configuration is successful, screenshots are taken, and images are automatically output.

Source: Internet
Author: User
The php extension ffmpeg configuration is successful and the image is automatically output.
$ FN = "C:/inetpub/wwwroot/"; if (extension_loaded ('ffmpeg ') {// judge whether ffmpeg is loaded $ mov = new ffmpeg_movie ($ fN. "44.mp4"); // Video path $ count = $ mov-> getFrameCount (); $ ff_frame = $ mov-> getFrame (80 ); // capture an 80-frame image if ($ ff_frame) {$ gd_image = $ ff_frame-> toGDImage (); $ img = "/test.jpg "; // The absolute path header ('content-Type: image/jpeg ') of the image to be generated; imagejpeg ($ gd_image); // Create a jpg image, you can display // imagejpeg ($ gd_image, $ fN. $ img); // Create a jpg image. The image imagedestroy ($ gd_image) cannot be output; // destroy an image} else {echo "ffmpeg not loaded ";}


In php5.4, ffmpeg is successfully configured. the code above indicates that the video is a local video source and imagejpeg ($ gd_image) is called ); this can display a screenshot in the browser of the Test environment built on the local machine. However, if you call imagejpeg ($ gd_image, $ fN. $ img), the image in the output local path cannot be generated. Please check if any code is missing?


Reply to discussion (solution)

Imagejpeg ($ gd_image); yes
Imagejpeg ($ gd_image, $ fN. $ img );
Check whether the permission is sufficient.

$ FN = "C:/inetpub/wwwroot /";
Are you using IIS?
By default, directories managed by IIS do not have the write permission. you need to set the permission in the manager.

Imagejpeg ($ gd_image); yes
Imagejpeg ($ gd_image, $ fN. $ img );
Check whether the permission is sufficient.

$ FN = "C:/inetpub/wwwroot /";
Are you using IIS?
By default, directories managed by IIS do not have the write permission. you need to set the permission in the manager.


Well, I am using IIS. Thanks. thank you!

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: info-contact@alibabacloud.com 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.