我曾经在一个PHP应用程序中创建一个FFMPEG缩略图,并试图如果视频是自下而上旋转缩略图(反转),但旋转图像无法正常工作。 下面的是用于图像旋转的代码
$video = $storeHere.$mediaFile;
$tImage = $upload_output['uploaded_file'].'.jpg';
$thumbnail = $storeHere.$tImage;
// shell command [highly simplified, please don't run it plain on your script!]
shell_exec("ffmpeg -i $video -deinterlace -an -ss 1 -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg -s 250x250 $thumbnail 2>&1");
/* image rotate fix */
$source = imagecreatefromjpeg($thumbnail);
$degrees = 270;
$rotate = imagerotate($source, $degrees, 0);
imagejpeg($rotate,$thumbnail);
/* rotate fix ends */