我正在尝试使用 filter_complex 将一个视频叠加到另一个视频上。但是它无法正确叠加,并显示“缓冲区队列溢出”。如果我不使用 -itsoffset 来消除延迟,它就可以正常工作。请告诉我该怎么做才能解决这个问题。我正在使用最新版本的 ffmpeg。它是 2.2 N-62296-g4484152。
这是我正在尝试的命令。
ffmpeg -i .Files/1szqpq/hjmuqD/creation/overlaid-video.mp4 -itsoffset 22.952 -i .Files/1szqpq/hjmuqD/creation/07eda82db409f6c212ffa829287d9c0d_clip.webm -filter_complex "overlay=x='if(gte(t,34.28),NAN,0)':y=0" -y .Files/1szqpq/hjmuqD/creation/overlaid-video-2.mp4
这是输出日志。
ffmpeg version 2.2-tessus Copyright (c) 2000-2014 the FFmpeg developers
built on Mar 24 2014 22:25:11 with llvm-gcc 4.2.1 (LLVM build 2336.1.00)
configuration: --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-libmodplug --enable-fontconfig --enable-libfreetype --enable-libass --enable-libbluray --enable-filters --enable-runtime-cpudetect
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '.Files/1szqpq/hjmuqD/creation/overlaid-video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.33.100
Duration: 00:00:44.91, start: 0.000000, bitrate: 443 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 392 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, matroska,webm, from '.Files/1szqpq/hjmuqD/creation/07eda82db409f6c212ffa829287d9c0d_clip.webm':
Metadata:
encoder : libebml v1.2.0 + libmatroska v1.1.0
creation_time : 2014-04-09 06:16:15
Duration: 00:00:11.33, start: 0.000000, bitrate: 996 kb/s
Stream #1:0: Video: vp8, yuv420p, 274x486, SAR 1:1 DAR 137:243, 30.05 fps, 30.05 tbr, 1k tbn, 1k tbc (default)
Stream #1:1: Audio: vorbis, 48000 Hz, stereo, fltp (default)
[libx264 @ 0x104000600] using SAR=1/1
[libx264 @ 0x104000600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x104000600] profile High, level 3.1
[libx264 @ 0x104000600] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=12 lookahead_threads=2 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
Output #0, mp4, to '.Files/1szqpq/hjmuqD/creation/overlaid-video-2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.33.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 11988 tbn, 29.97 tbc (default)
Stream #0:1(und): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 (h264) -> overlay:main (graph 0)
Stream #1:0 (vp8) -> overlay:overlay (graph 0)
overlay (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (aac -> libvo_aacenc)
Press [q] to stop, [?] for help
[Parsed_overlay_0 @ 0x103800000] [framesync @ 0x1038000e8] Buffer queue overflow, dropping.
Last message repeated 624 times
frame= 1345 fps=181 q=-1.0 Lsize= 2130kB time=00:00:44.81 bitrate= 389.4kbits/s dup=624 drop=0
video:1851kB audio:251kB subtitle:0 data:0 global headers:0kB muxing overhead 1.348262%
[libx264 @ 0x104000600] frame I:8 Avg QP:13.93 size: 30628
[libx264 @ 0x104000600] frame P:402 Avg QP:17.93 size: 2802
[libx264 @ 0x104000600] frame B:935 Avg QP:20.63 size: 560
[libx264 @ 0x104000600] consecutive B-frames: 2.4% 14.4% 1.1% 82.1%
[libx264 @ 0x104000600] mb I I16..4: 9.0% 73.4% 17.6%
[libx264 @ 0x104000600] mb P I16..4: 1.7% 1.7% 0.3% P16..4: 10.9% 2.3% 0.9% 0.0% 0.0% skip:82.2%
[libx264 @ 0x104000600] mb B I16..4: 0.1% 0.1% 0.0% B16..8: 7.6% 0.4% 0.0% direct: 0.1% skip:91.7% L0:46.5% L1:50.8% BI: 2.8%
[libx264 @ 0x104000600] 8x8 transform intra:53.1% inter:78.0%
[libx264 @ 0x104000600] coded y,uvDC,uvAC intra: 31.4% 36.8% 7.9% inter: 1.1% 2.3% 0.0%
[libx264 @ 0x104000600] i16 v,h,dc,p: 31% 27% 7% 35%
[libx264 @ 0x104000600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 41% 20% 23% 3% 3% 3% 3% 3% 3%
[libx264 @ 0x104000600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 25% 14% 3% 4% 4% 4% 3% 3%
[libx264 @ 0x104000600] i8c dc,h,v,p: 74% 12% 11% 2%
[libx264 @ 0x104000600] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x104000600] ref P L0: 68.4% 8.7% 17.1% 5.8%
[libx264 @ 0x104000600] ref B L0: 85.5% 13.7% 0.8%
[libx264 @ 0x104000600] ref B L1: 97.5% 2.5%
[libx264 @ 0x104000600] kb/s:337.78
答案1
这是 ffmpeg 中的一个已知错误,12 个月前已修复:
#2467 -itsoffset 与覆盖过滤器缓冲区队列溢出。
您应该确保使用的是最新版本的 ffmpeg。如果您使用的是该版本,但问题仍然存在,您应该重新打开错误报告。
stackoverflow 线程中包含了一些解决方法 FFMPEG-合并视频时出错,主要涉及使用 avisynth(Windows)或 avxsynth(avisynth 的 Linux 端口),或将文件转换并覆盖为 x264。