![ffmpeg 在结束前约 1.5 秒停止生成 mp4](https://linux22.com/image/1508037/ffmpeg%20%E5%9C%A8%E7%BB%93%E6%9D%9F%E5%89%8D%E7%BA%A6%201.5%20%E7%A7%92%E5%81%9C%E6%AD%A2%E7%94%9F%E6%88%90%20mp4.png)
我不是 ffmpeg 专家。我试图生成一个视频,并在其顶部叠加匹配的图像以创建电影效果。对于基本测试,我运行了这个,但它在输出视频结束前约 1.5 秒停止创建帧。
ffmpeg -ss 10.0000 -t 15.00000 -i waterfall.mp4 -loop 1 -i output.png -an output1.mp4
有人能告诉我为什么会发生这种情况吗?非常感谢大家的帮助!
完整的控制台输出如下。
ffmpeg version N-81646-gc19da0c Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 29.100 / 55. 29.100
libavcodec 57. 55.101 / 57. 55.101
libavformat 57. 48.103 / 57. 48.103
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 62.100 / 6. 62.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'waterfall.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.25.101
Duration: 00:00:30.06, start: 0.000000, bitrate: 3424 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 3291 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
Metadata:
handler_name : SoundHandler
[png_pipe @ 0000000001e848c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #1, png_pipe, from 'output.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgb24(pc), 1920x1080 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
[libx264 @ 0000000001eabca0] using SAR=1/1
[libx264 @ 0000000001eabca0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 @ 0000000001eabca0] profile High, level 4.0
[libx264 @ 0000000001eabca0] 264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=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_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=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=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0000000001eaab40] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to 'output1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.48.103
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.55.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 31 fps= 30 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 47 fps= 25 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 55 fps= 22 q=29.0 size= 219kB time=00:00:00.06 bitrate=26830.3kbitsframe= 61 fps= 20 q=29.0 size= 276kB time=00:00:00.26 bitrate=8458.8kbits/frame= 64 fps= 18 q=29.0 size= 351kB time=00:00:00.36 bitrate=7827.8kbits/frame= 72 fps= 17 q=29.0 size= 533kB time=00:00:00.63 bitrate=6886.6kbits/frame= 80 fps= 16 q=29.0 size= 610kB time=00:00:00.90 bitrate=5549.9kbits/frame= 88 fps= 15 q=29.0 size= 762kB time=00:00:01.16 bitrate=5347.8kbits/frame= 96 fps= 15 q=29.0 size= 867kB time=00:00:01.43 bitrate=4951.5kbits/frame= 104 fps= 15 q=29.0 size= 952kB time=00:00:01.70 bitrate=4581.2kbits/frame= 112 fps= 14 q=29.0 size= 1109kB time=00:00:01.96 bitrate=4613.3kbits/frame= 120 fps= 14 q=29.0 size= 1222kB time=00:00:02.23 bitrate=4479.6kbits/frame= 128 fps= 14 q=29.0 size= 1303kB time=00:00:02.50 bitrate=4266.3kbits/frame= 135 fps= 14 q=29.0 size= 1454kB time=00:00:02.73 bitrate=4353.5kbits/frame= 138 fps= 14 q=29.0 size= 1508kB time=00:00:02.83 bitrate=4354.4kbits/frame= 146 fps= 14 q=29.0 size= 1581kB time=00:00:03.10 bitrate=4174.3kbits/frame= 153 fps= 14 q=29.0 size= 1648kB time=00:00:03.33 bitrate=4045.6kbits/frame= 160 fps= 13 q=29.0 size= 1786kB time=00:00:03.57 bitrate=4097.2kbits/frame= 167 fps= 13 q=29.0 size= 1883kB time=00:00:03.80 bitraframe= 448 fps= 11 q=29.0 size= 6114kB time=00:00:13.17 bitrate=3800.2kbits/s speed=0.317x
如果我退出视频生成,它也会告诉我这些。没有与 av_interleaved_write_frame() 相关的明确错误,所以我不确定哪里出了问题。
av_interleaved_write_frame(): Immediate exit requested13.17 bitrate=3800.2kbits/s speed=0.36x = 19 q=29.0 size= 370kB time=00:00:00.40 bitrate=7573.1kbits/frame= 72 fps= 18 q=29.0 size= 533kB time=00:00:00.63 bitrate=6886.6kbits/s speed=0.155x
Error writing trailer of output1.mp4: Immediate exit requestedframe= 450 fps=6.8 q=29.0 Lsize= 6160kB time=00:00:13.27 bitrate=3800.1kbits/s speed= 0.2x
video:6170kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 000000000063bca0] frame I:2 Avg QP:19.84 size:199254
[libx264 @ 000000000063bca0] frame P:425 Avg QP:22.90 size: 15119
[libx264 @ 000000000063bca0] frame B:23 Avg QP:27.74 size: 4877
[libx264 @ 000000000063bca0] consecutive B-frames: 89.8% 10.2% 0.0% 0.0%
[libx264 @ 000000000063bca0] mb I I16..4: 7.3% 56.7% 36.0%
[libx264 @ 000000000063bca0] mb P I16..4: 2.2% 4.0% 0.2% P16..4: 18.9% 3.8% 1.7% 0.0% 0.0% skip:69.1%
[libx264 @ 000000000063bca0] mb B I16..4: 0.3% 0.5% 0.0% B16..8: 20.4% 1.4% 0.2% direct: 0.8% skip:76.3% L0:69.6% L1:17.2% BI:13.2%
[libx264 @ 000000000063bca0] 8x8 transform intra:62.2% inter:58.4%
[libx264 @ 000000000063bca0] coded y,uvDC,uvAC intra: 43.4% 25.8% 2.1% inter: 9.5% 6.0% 0.0%
[libx264 @ 000000000063bca0] i16 v,h,dc,p: 16% 20% 10% 54%
[libx264 @ 000000000063bca0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 20% 22% 4% 5% 6% 4% 6% 6%
[libx264 @ 000000000063bca0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 14% 18% 7% 9% 8% 7% 7% 7%
[libx264 @ 000000000063bca0] i8c dc,h,v,p: 64% 20% 14% 3%
[libx264 @ 000000000063bca0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000000063bca0] ref P L0: 73.8% 20.8% 3.9% 1.4%
[libx264 @ 000000000063bca0] ref B L0: 94.7% 5.3%
[libx264 @ 000000000063bca0] kb/s:3695.53
Exiting normally, received signal 2.
Terminate batch job (Y/N)? y