I am trying to generate the images
from mp4
video file with ffmpeg
.
I only want the first 3 second of every video in the file.
I have the following command..
$videoFile = $mp4File; //I have many mp4 files
$ffmpeg ="/usr/ffmpeg";
$image_path = $videoFile;
$ALL_PLACE_WIDTH = 300;
$ALL_PLACE_HEIGHT = 220;
$image_cmd = " -r 1 -r 0.03 -s ".$ALL_PLACE_WIDTH."x".$ALL_PLACE_HEIGHT." -f image2 ";
$dest_path = 'project/image-%01d.png';
$str_command= $ffmpeg ." -i " . $image_path . $image_cmd .$dest_path;
shell_exec($str_command);
I am trying to generate firt 3 second image of every mp4
file but my script will genearte a lot of images and it create images across entire mp4
file.
Can I restrict the script to get only the first 3 seconds images only? Thanks a lot!