我有一系列 .png 文件,我想将它们转换成电影。问题是,当我尝试将其转换为 avi 格式时,ffmpeg 说“块太大”:。
我正在运行以下命令:
ffmpeg -f image2 -i images%d.png -vcodec libx264 -preset veryslow -crf 22 -threads 0 output_video.avi
我该如何修复它才能获得适用于 PowerPoint 的电影?我尝试了各种编码方案,并参考了: 无损通用视频格式用于初始命令。
日志:
fmpeg version 2.7.1 Copyright (c) 2000-2015 the FFmpeg developers
built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.7.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, image2, from 'images%d.png':
Duration: 00:00:12.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 927x1152, 25 fps, 25 tbr, 25 tbn, 25 tbc
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x7fed82138e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fed82138e00] profile High 4:4:4 Predictive, level 5.0, 4:4:4 8-bit
Output #0, avi, to 'output_video.avi':
Metadata:
ISFT : Lavf56.36.100
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 927x1152, q=-1--1, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc56.41.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
> Press [q] to stop, [?] for help
[png @ 0x7fed82e89e00] chunk too big 92kB time=00:00:07.12 bitrate= 106.2kbits/s
frame= 299 fps= 61 q=-1.0 Lsize= 202kB time=00:00:11.88 bitrate= 139.1kbits/s
video:189kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 6.723067%
[libx264 @ 0x7fed82138e00] frame I:2 Avg QP:17.68 size: 46814
[libx264 @ 0x7fed82138e00] frame P:46 Avg QP:18.10 size: 1270
[libx264 @ 0x7fed82138e00] frame B:251 Avg QP:17.13 size: 166
[libx264 @ 0x7fed82138e00] consecutive B-frames: 0.7% 0.7% 2.0% 6.7% 6.7% 18.1% 18.7% 37.5% 9.0%
[libx264 @ 0x7fed82138e00] mb I I16..4: 20.3% 59.4% 20.3%
[libx264 @ 0x7fed82138e00] mb P I16..4: 0.1% 0.1% 0.2% P16..4: 0.5% 0.1% 0.1% 0.0% 0.0% skip:99.0%
[libx264 @ 0x7fed82138e00] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 1.4% 0.0% 0.0% direct: 0.0% skip:98.5% L0:65.2% L1:34.6% BI: 0.2%
[libx264 @ 0x7fed82138e00] 8x8 transform intra:57.2% inter:5.1%
[libx264 @ 0x7fed82138e00] direct mvs spatial:97.2% temporal:2.8%
[libx264 @ 0x7fed82138e00] coded y,u,v intra: 12.5% 5.2% 5.1% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x7fed82138e00] i16 v,h,dc,p: 69% 28% 3% 0%
[libx264 @ 0x7fed82138e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 65% 6% 29% 0% 0% 0% 0% 0% 0%
[libx264 @ 0x7fed82138e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 20% 19% 3% 4% 4% 4% 4% 5%
[libx264 @ 0x7fed82138e00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fed82138e00] ref P L0: 53.9% 2.6% 28.5% 5.2% 3.1% 2.8% 1.2% 0.8% 0.5% 0.3% 0.1% 0.2% 0.2% 0.2% 0.2% 0.1%
[libx264 @ 0x7fed82138e00] ref B L0: 42.7% 19.9% 7.0% 5.6% 3.7% 3.7% 2.7% 2.7% 2.1% 2.7% 2.1% 2.2% 1.7% 1.0% 0.2%
[libx264 @ 0x7fed82138e00] ref B L1: 94.7% 5.3%
[libx264 @ 0x7fed82138e00] kb/s:129.51
答案1
如果你需要 AVI,那么尝试一下
ffmpeg -f image2 -i images%d.png -vf scale=928x1152,setsar=1 -c:v libx264 -pix_fmt yuv420p -profile:v main -coder 0 -preset veryslow -crf 22 -threads 0 output_video.avi
但请先尝试 MP4
ffmpeg -f image2 -i images%d.png -vf scale=928x1152,setsar=1 -c:v libx264 -pix_fmt yuv420p -profile:v main -coder 0 -preset veryslow -crf 22 -threads 0 output_video.mp4
FFmpeg 将假设图像序列的帧率为 25(因此将其保留在输出中)。您可以通过在序列帧率之前添加来更改该设置-framerate N
。-i
N