1

I am trying to create thumbnail image from a MP4 file using ffmpeg php library.

I have

 $ffmpeg ="/usr/bin/ffmpeg";

 $image_source_path = '/project/a1/a1.mp4';

 $ALL_PLACE_WIDTH = 300;
 $ALL_PLACE_HEIGHT = 270;

 $image_cmd = " -r 1 -r 0.0001 -s ".$ALL_PLACE_WIDTH."x".$ALL_PLACE_HEIGHT." -f image2 ";

 $dest_image_path = '/project/a1/foo-%03d.png';

 $str_command= $ffmpeg  ." -i " . $image_source_path . $image_cmd .$dest_image_path;

 shell_exec($str_command);

I only need the first frame of the video but my codes would generate 2 images of the video which is not what I desired. Can anyone help me about the problem?

thanks so much!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.