ffmpeg 在创建视频时未添加所有图像

ffmpeg 在创建视频时未添加所有图像

我正在用 38,179 张图像制作视频。ffmpeg 成功制作了视频,但只包含前 20,998 张图像。它不包含最后 17xxx 张图像。我运行的是 Windows 7 64 位。

这些文件都在同一个目录中,名为 1000000.jpg - 1038179.jpg。

这是我使用的命令:

ffmpeg -r 16 -i 1%6d.jpg -r 16 video.mp4

我怎样才能让它包含所有图像?

这是输出的最后一屏:

frame=20998 fps=6.4 q=27.0 size=  478740kB time=00:19:23.66 bitrate=3370.2kbits/
frame=20998 fps=6.4 q=27.0 size=  478740kB time=00:19:23.66 bitrate=3370.2kbits/
frame=20998 fps=6.4 q=27.0 size=  478740kB time=00:19:23.66 bitrate=3370.2kbits/
frame=20998 fps=6.4 q=27.0 size=  478740kB time=00:19:23.66 bitrate=3370.2kbits/
frame=20998 fps=6.4 q=27.0 size=  478740kB time=00:19:23.66 bitrate=3370.2kbits/
frame=20998 fps=6.4 q=-1.0 Lsize=  480427kB time=00:19:26.44 bitrate=3374.1kbits
/s dup=0 drop=17182
video:480204kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.046423%

[libx264 @ 00000000041aa020] frame I:332   Avg QP:18.87  size:110978
[libx264 @ 00000000041aa020] frame P:10468 Avg QP:21.59  size: 32633
[libx264 @ 00000000041aa020] frame B:10198 Avg QP:23.35  size: 11108
[libx264 @ 00000000041aa020] consecutive B-frames: 22.7% 35.1%  7.9% 34.3%
[libx264 @ 00000000041aa020] mb I  I16..4: 13.2% 84.6%  2.2%
[libx264 @ 00000000041aa020] mb P  I16..4:  9.6% 30.7%  0.3%  P16..4: 30.1%  6.9%  3.0%  0.0%  0.0%    skip:19.4%
[libx264 @ 00000000041aa020] mb B  I16..4:  1.3%  4.4%  0.0%  B16..8: 33.4%  3.3%  0.4%  direct: 2.2%  skip:54.9%  L0:43.9% L1:51.4% BI: 4.8%
[libx264 @ 00000000041aa020] 8x8 transform intra:76.3% inter:90.0%
[libx264 @ 00000000041aa020] coded y,uvDC,uvAC intra: 46.6% 62.7% 10.4% inter: 12.3% 22.3% 0.5%
[libx264 @ 00000000041aa020] i16 v,h,dc,p: 42% 24%  9% 25%
[libx264 @ 00000000041aa020] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 22% 33%  2%  2% 3%  2%  3%  2%
[libx264 @ 00000000041aa020] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 16% 11%  5% 10% 12%  7%  6%  3%
[libx264 @ 00000000041aa020] i8c dc,h,v,p: 46% 23% 27%  4%
[libx264 @ 00000000041aa020] Weighted P-Frames: Y:1.0% UV:0.5%
[libx264 @ 00000000041aa020] ref P L0: 65.7% 11.6% 17.0%  5.7%  0.0%
[libx264 @ 00000000041aa020] ref B L0: 86.8% 11.6%  1.6%
[libx264 @ 00000000041aa020] ref B L1: 96.3%  3.7%
[libx264 @ 00000000041aa020] kb/s:3372.17

编辑这是开始的输出:

ffmpeg -r 16 -i 1%6d.jpg -r 16 video1.mp4 -report
ffmpeg started on 2013-09-25 at 16:25:30
Report written to "ffmpeg-20130925-162530.log"
ffmpeg version N-49610-gc2dd5a1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb  5 2013 13:26:02 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --e
nable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --e
nable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-
libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable
-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 35.101 /  3. 35.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, image2, from '1%6d.jpg':
  Duration: 00:28:02.80, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 2
5 tbr, 25 tbn, 25 tbc
[graph 0 input from stream 0:0 @ 0000000000312fc0] w:1920 h:1080 pixfmt:yuvj420p
 tb:1/16 fr:16/1 sar:1/1 sws_param:flags=2
[graph 0 input from stream 0:0 @ 0000000000312fc0] TB:0.062500 FRAME_RATE:16.000
000 SAMPLE_RATE:nan
[libx264 @ 000000000030de00] using SAR=1/1
[libx264 @ 000000000030de00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShu
ffle SSE4.2 AVX
[libx264 @ 000000000030de00] profile High, level 4.0
[libx264 @ 000000000030de00] 264 - core 129 r2245 bc13772 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 r
ef=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed
_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pski
p=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 deci
mate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_
adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1
6 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.6
0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'video1.mp4':
  Metadata:
    encoder         : Lavf54.61.104
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 1920x1080 [SAR
1:1 DAR 16:9], q=-1--1, 16384 tbn, 16 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> libx264)
Press [q] to stop, [?] for help
frame=   52 fps=8.7 q=-1.0 Lsize=    1152kB time=00:00:03.12 bitrate=3020.1kbits
/s
video:1151kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.114819%
[libx264 @ 000000000030de00] frame I:2     Avg QP:19.64  size: 93604
[libx264 @ 000000000030de00] frame P:21    Avg QP:21.21  size: 33175
[libx264 @ 000000000030de00] frame B:29    Avg QP:22.12  size: 10130
[libx264 @ 000000000030de00] consecutive B-frames: 25.0%  0.0%  5.8% 69.2%
[libx264 @ 000000000030de00] mb I  I16..4: 13.0% 80.1%  6.9%
[libx264 @ 000000000030de00] mb P  I16..4:  7.7% 31.7%  0.4%  P16..4: 32.1%  7.3
%  3.4%  0.0%  0.0%    skip:17.5%
[libx264 @ 000000000030de00] mb B  I16..4:  1.0%  3.7%  0.0%  B16..8: 33.8%  3.8
%  0.4%  direct: 3.3%  skip:54.0%  L0:46.1% L1:49.3% BI: 4.6%
[libx264 @ 000000000030de00] 8x8 transform intra:79.6% inter:91.8%
[libx264 @ 000000000030de00] coded y,uvDC,uvAC intra: 52.0% 73.1% 16.8% inter: 1
0.7% 24.2% 0.5%
[libx264 @ 000000000030de00] i16 v,h,dc,p: 40% 23%  9% 27%
[libx264 @ 000000000030de00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 23% 35%  2%  1%
 2%  1%  2%  1%
[libx264 @ 000000000030de00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 20%  9%  5%  6%
 6%  5%  5%  3%
[libx264 @ 000000000030de00] i8c dc,h,v,p: 42% 23% 31%  4%
[libx264 @ 000000000030de00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000000030de00] ref P L0: 64.3% 10.7% 19.8%  5.3%
[libx264 @ 000000000030de00] ref B L0: 83.9% 13.2%  3.0%
[libx264 @ 000000000030de00] ref B L1: 92.4%  7.6%
[libx264 @ 000000000030de00] kb/s:2898.83

答案1

我在 Linux 和 Windows 上遇到了同样的问题。对我来说,解决方案是观察转换在 0 字节的图像上停止。当我删除该图像时,ffmpeg 继续处理其余图像。

答案2

我遇到了类似的问题。我不知道发生了什么,但当我多次复制最后一帧并将其重命名为更高的数字时,我得到了我想要的视频。

答案3

尝试调整图像大小,最好使用“不带前导零”重命名方案('filename-%d.png')。在我的情况下,这种方法很有效。

或者,将 fps 调整为较低或均匀的值,奇怪的是,在这些情况下它对我有效,但没有证据表明这些特定设置存在错误或已知问题。

相关内容