我使用以下代码将 GIF 转换为 MP4:$videoname = str_replace('.gif', '.mp4', $picname);$ffmpeg = FFMpeg\FFMpeg::create(array( 'ffmpeg.binaries' => 'ffmpeg/bin/ffmpeg.exe', 'ffprobe.binaries' => 'ffmpeg/bin/ffprobe.exe', 'timeout' => 6600, // The timeout for the underlying process 'ffmpeg.threads' => 12, // The number of threads that FFMpeg should use), $logger);$video = $ffmpeg->open('memes/' . $folder . '/' . $picname);$format = new \FFMpeg\Format\Video\X264('libvo_aacenc', 'libx264');$format->setAdditionalParameters(array('-profile:v', 'baseline', '-pix_fmt', 'yuv420p'));$video ->save($format, 'memes/' . $folder . '/' . $videoname);有些 GIF 正在转换,但有些则没有,这是错误消息:[16-Aug-2020 14:47:21 Europe/Berlin] PHP Fatal error: Uncaught Alchemy\BinaryDriver\Exception\ExecutionFailureException: ffmpeg failed to execute command "ffmpeg/bin/ffmpeg.exe" -y -i "memes/38/Dr5W6yzR_gif_38.gif" -threads 12 -vcodec libx264 -acodec libvo_aacenc -b:v 1000k -refs 6 -coder 1 -sc_threshold 40 -flags +loop -me_range 16 -subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -trellis 1 -b:a 128k -profile:v baseline -pix_fmt yuv420p -pass 1 -passlogfile "C:\Windows\TEMP\ffmpeg-passes5f392ad8ba750qewzr/pass-5f392ad8bb9b7" "memes/38/Dr5W6yzR_gif_38.mp4":Error Output: ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers built with gcc 9.2.1 (GCC) 20200122 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --e in C:\Inetpub\vhosts\yolol.de\vendor\php-ffmpeg\php-ffmpeg\src\FFMpeg\Media\AbstractVideo.php on line 106这都是些什么废话?
1 回答
慕码人8056858
TA贡献1803条经验 获得超6个赞
解决方案:
$format->setAdditionalParameters(array('-profile:v', 'baseline', '-pix_fmt', 'yuv420p', '-vf', 'scale=trunc(iw/2)*2:trunc(ih/2)*2'));
- 1 回答
- 0 关注
- 109 浏览
添加回答
举报
0/150
提交
取消