[FFmpeg-user] Output doesn't stop when fading in image and overlaying

Werner Robitza werner.robitza at gmail.com
Sun Jan 19 18:29:48 CET 2014


I'm fading in / out an image (like a watermark) over a background
video. Of course the image needs to be looped, but the encoding
process never stops. It actually starts dropping frames before the end
of the input video is reached.

How can I avoid that?

ffmpeg -i video-cut.mp4 -f image2 -loop 1 -i subtitle.png
-filter_complex '[1] fade=t=in:st=2.5:d=1:alpha=1,
fade=t=out:st=5:d=1:alpha=1 [sub1fade]; [0:v][sub1fade]
overlay=shortest=1 [final]' -map '[final]' out.mp4

ffmpeg version 2.1.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Nov 28 2013 08:58:53 with Apple LLVM version 5.0
(clang-500.2.79) (based on LLVM 3.3svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.1.1
--enable-shared --enable-pthreads --enable-gpl --enable-version3
--enable-nonfree --enable-hardcoded-tables --enable-avresample
--enable-vda --cc=clang --host-cflags= --host-ldflags=
--enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
--enable-libfreetype --enable-libtheora --enable-libvorbis
--enable-libvpx --enable-librtmp --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libvo-aacenc --enable-libass
--enable-ffplay --enable-libspeex --enable-libschroedinger
--enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libcaca
--enable-libquvi --enable-libopenjpeg
--extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1/include/openjpeg-1.5
'
  libavutil      52. 48.101 / 52. 48.101
  libavcodec     55. 39.101 / 55. 39.101
  libavformat    55. 19.104 / 55. 19.104
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video-cut.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.19.104
  Duration: 00:00:20.02, start: 0.000000, bitrate: 586 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
768x432, 449 kb/s, 29.97 fps, 29.97 tbr, 30k 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, image2, from 'subtitle.png':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #1:0: Video: png, gray8a, 386x36 [SAR 72:72 DAR 193:18], 25
fps, 25 tbr, 25 tbn, 25 tbc
File 'out.mp4' already exists. Overwrite ? [y/N] y
[libx264 @ 0x7fbb5c034c00] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle SSE4.2 AVX
[libx264 @ 0x7fbb5c034c00] profile High, level 3.0
[libx264 @ 0x7fbb5c034c00] 264 - core 125 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2012 - 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 'out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.19.104
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021),
yuv420p, 768x432, q=-1--1, 30k tbn, 29.97 tbc (default)
Stream mapping:
  Stream #0:0 (h264) -> overlay:main
  Stream #1:0 (png) -> fade
  overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame=  601 fps= 76 q=-1.0 Lsize=    1023kB time=00:00:19.98 bitrate=
419.2kbits/s dup=0 drop=16355
video:1015kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.726464%
[libx264 @ 0x7fbb5c034c00] frame I:3     Avg QP:19.66  size: 13563
[libx264 @ 0x7fbb5c034c00] frame P:218   Avg QP:22.25  size:  3620
[libx264 @ 0x7fbb5c034c00] frame B:380   Avg QP:29.41  size:   550
[libx264 @ 0x7fbb5c034c00] consecutive B-frames: 14.0%  1.3% 11.5% 73.2%
[libx264 @ 0x7fbb5c034c00] mb I  I16..4: 44.2% 43.3% 12.6%
[libx264 @ 0x7fbb5c034c00] mb P  I16..4:  2.8%  3.8%  0.7%  P16..4:
22.2%  8.3%  3.6%  0.0%  0.0%    skip:58.7%
[libx264 @ 0x7fbb5c034c00] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8:
14.2%  1.7%  0.3%  direct: 0.3%  skip:83.2%  L0:33.9% L1:60.6% BI:
5.5%
[libx264 @ 0x7fbb5c034c00] 8x8 transform intra:51.5% inter:77.5%
[libx264 @ 0x7fbb5c034c00] coded y,uvDC,uvAC intra: 43.2% 54.1% 29.2%
inter: 5.9% 8.1% 0.5%
[libx264 @ 0x7fbb5c034c00] i16 v,h,dc,p: 75% 15%  4%  6%
[libx264 @ 0x7fbb5c034c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 22% 14%
2%  4%  6%  4%  6%  4%
[libx264 @ 0x7fbb5c034c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 23% 10%
3%  6%  8%  5%  6%  4%
[libx264 @ 0x7fbb5c034c00] i8c dc,h,v,p: 50% 19% 24%  7%
[libx264 @ 0x7fbb5c034c00] Weighted P-Frames: Y:7.8% UV:6.4%
[libx264 @ 0x7fbb5c034c00] ref P L0: 70.8% 17.5%  9.3%  2.3%  0.1%
[libx264 @ 0x7fbb5c034c00] ref B L0: 94.0%  5.1%  0.9%
[libx264 @ 0x7fbb5c034c00] ref B L1: 96.5%  3.5%
[libx264 @ 0x7fbb5c034c00] kb/s:414.49


More information about the ffmpeg-user mailing list