For generating an image (thumbnail) from a video file using php with ffmpeg library, use the following code to achieve this.
exec("ffmpeg -itsoffset -0 -i $target_path -vcodec mjpeg -vframes 1 -an -f rawvideo -s 200x200 $imgPath");
Use php exec() function to do this. In the above code $target_path is the path where your video file located. $imgPath is the path where you want to store the image to be created. Size of the image to be generated, you can change by changing the value 200×200.
If you don’t know, how to install ffmpeg library in a LAMP environment see the post