Is there any way to create multiple thumbnails from a video through php? I don't have ffmpeg installed in my hosting account's web server. What should I do now?
-
2Install ffmpeg in your hosting account's web server. – phihag Nov 29 '11 at 14:54
-
1You can always install mplayer and use exec() to generate the thumbnails. – Meisam Mulla Nov 29 '11 at 15:03
3 Answers
You have to install FFMpeg package in your server, only then you'll be able to create your required thumbnails for the videos. You can find out the installation process and do follow the steps.

- 11
- 2
Assuming the videos are hosted on your own server, your best bet would be to request that ffmpeg be installed by your hosting provider. If the videos are hosted by a third-party such as YouTube or Vimeo, you can use their APIs to request the thumbnails (see How do I get a YouTube video thumbnail from the YouTube API? for an example of Youtube thumbnail handling).
-
Thanks for confirming me about what I doubted. But is it like that, the one and only possible way is through ffmpeg and PHP don't have any abilities at all? – Samik Chattopadhyay Nov 29 '11 at 15:03
-
There may be alternatives to ffmpeg, but they too would need installation on the server -- PHP itself cannot transcode video without the supporting libraries. An alternative may be to look for hosted ffmpeg services. Otherwise, manually uploading thumbnails may be your only option. – Mike Fahy Nov 29 '11 at 15:10
You have two options with ffmpeg (after you have made it available on your server) to create multiple thumbnails:
- Either you invoke it multiple times, once per thumbnail.
- You invoke it once and create a thumbnail every X seconds.
Depending on how many thumbnails you want to create, the one method is faster than the other or vice versa.
For commandline examples, PHP code and speed comparison please see the following blog post: Capturing multiple thumbnails from a movie using ffmpeg.
If you don't have ffmpeg installed on your server, you need some other library/tool that is able to extract thumbnails from videos. However I would say, when something is offered, it's ffmpeg and not something else (e.g. apple quicktime), so I would not look much around for alternatives.

- 193,403
- 52
- 435
- 836