1

I've created a video slideshow from images with a background image but I want to be able to add another picture at the bottom left of the video.

enter image description here How can I make the -i "C:/test/logo.png" show at the bottom left.

This the following ffmpeg command.

    runtime = createObject("java", "java.lang.Runtime").getRuntime();
    command = '#ffmpegPath#' &
    ' -loop 1' &
    ' -framerate 1' &
    ' -i "C:/test/bg.jpg"' & 
    ' -framerate 1/5' &
    ' -i "C:/test/%03d.jpg"' & 
    ' -i "C:/test/logo.png"' & 
    ' -i "C:/test/music.mp3"' &
    ' -filter_complex' &
        ' "[1:v]drawbox=t=5:c=white[fg];[0:v][fg]overlay=(W-w)/2:(H-h)/2:shortest=1,' & 
        ' drawtext="fontsize=50:fontfile=/Windows/Fonts/arial.ttf:fontcolor=White:text=Eterni-T:x=(w-text_w)/2:y=40",' & 
        ' drawtext="fontsize=50:fontfile=/Windows/Fonts/arial.ttf:fontcolor=White:text="Laurence Collard (Simard) 1925-1999":x=w-text_w-10:y=h-text_h-10",' &
        ' drawbox=x=0:y=10:w=5000:h=100:[email protected]:t=50[bg];' &
        ' [bg][2:v]overlay=10:H-h-10,' &
        ' format=yuv420p[v]"' &
        ' -map "[v]"' &
    ' -c:v libx264' &
    ' -c:a aac -strict experimental' &
    ' -b:a 192k' &
    ' -r 30' &
    ' -movflags +faststart' &
    ' -shortest' &
    ' "C:/test/out.mp4"';

Log:

ffmpeg version N-69587-g15a8846 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --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-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 18.100 / 54. 18.100
  libavcodec     56. 21.102 / 56. 21.102
  libavformat    56. 19.100 / 56. 19.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5.  9.103 /  5.  9.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, image2, from 'C:/test/bg.jpg':
  Duration: 00:00:01.00, start: 0.000000, bitrate: 1900 kb/s
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1360 [SAR 1:1 DAR 24:17], 1 fps, 1 tbr, 1 tbn, 1 tbc
Input #1, image2, from 'C:/test/%03d.jpg':
  Duration: 00:00:15.00, start: 0.000000, bitrate: N/A
    Stream #1:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 540x800, 0.20 fps, 0.20 tbr, 0.20 tbn, 0.20 tbc
Input #2, png_pipe, from 'C:/test/logo.png':
  Duration: N/A, bitrate: N/A
    Stream #2:0: Video: png, rgba, 453x209, 25 tbr, 25 tbn, 25 tbc
[mp3 @ 0000000005039ee0] Estimating duration from bitrate, this may be inaccurate
Input #3, mp3, from 'C:/test/music.mp3':
  Duration: 00:02:18.40, start: 0.000000, bitrate: 224 kb/s
    Stream #3:0: Audio: mp3, 44100 Hz, stereo, s16p, 224 kb/s
Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (C:/test/out.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
[swscaler @ 00000000049c9000] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 00000000049dbac0] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0000000004b386a0] using SAR=1/1
[libx264 @ 0000000004b386a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000004b386a0] profile High, level 5.0
[libx264 @ 0000000004b386a0] 264 - core 144 r2525 40bb568 - 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 'C:/test/out.mp4':
  Metadata:
    encoder         : Lavf56.19.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1360 [SAR 1:1 DAR 24:17], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc56.21.102 libx264
Stream mapping:
  Stream #0:0 (mjpeg) -> overlay:main
  Stream #1:0 (mjpeg) -> drawbox
  Stream #2:0 (png) -> overlay:overlay
  format -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
Input stream #1:0 frame changed from size:540x800 fmt:yuvj444p to size:1115x672 fmt:yuvj444p
[swscaler @ 0000000004bb3e20] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000000004b1d640] deprecated pixel format used, make sure you did set range correctly
frame=  120 fps=0.0 q=29.0 size=     366kB time=00:00:02.06 bitrate=1450.0kbits/s dup=117 drop=0    
frame=  150 fps= 98 q=29.0 size=     369kB time=00:00:03.06 bitrate= 984.5kbits/s dup=146 drop=0    
frame=  180 fps= 74 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
Input stream #1:0 frame changed from size:1115x672 fmt:yuvj444p to size:1000x607 fmt:yuvj444p
[swscaler @ 0000000004bb3e20] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000000006990ee0] deprecated pixel format used, make sure you did set range correctly
frame=  120 fps=0.0 q=29.0 size=     366kB time=00:00:02.06 bitrate=1450.0kbits/s dup=117 drop=0    
frame=  150 fps=100 q=29.0 size=     369kB time=00:00:03.06 bitrate= 984.5kbits/s dup=146 drop=0    
frame=  180 fps= 75 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
Input stream #1:0 frame changed from size:1115x672 fmt:yuvj444p to size:1000x607 fmt:yuvj444p
[swscaler @ 00000000050dc160] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000000004c8ae80] deprecated pixel format used, make sure you did set range correctly
frame=  180 fps= 62 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 53 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 46 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 41 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 37 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 33 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 30 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 28 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 26 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 24 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 23 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 21 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 20 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 19 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 18 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 17 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    
frame=  180 fps= 17 q=29.0 size=     371kB time=00:00:04.06 bitrate= 747.9kbits/s dup=175 drop=0    

1 Answer 1

2

You just need to add another overlay filter. The new overlay filter will use the output from the previous overlay as an input along with the logo image.

-loop 1 \
-framerate 1 \
-i logo.png \
…
-filter_complex \
"[1:v]drawbox=t=5:c=white[fg]; \
 [0:v][fg]overlay=(W-w)/2:(H-h)/2:shortest=1,drawtext=…,drawtext=…,drawbox=…[bg]; \
 [bg][2:v]overlay=10:H-h-10:shortest=1,format=yuv420p[v]" \
-map "[v]" \
-map 3:a \
  • I replaced some of the options for each filter with so you can visualize the filtergraph easier.

  • This example is assuming that the logo image file is [2:v]; the third video input (ffmpeg starts counting from 0). I also made the logo file loop or else the second overlay may encode indefinitely if your inputs change attributes (frame size, pixel format, etc).

  • shortest=1 was not included in the second overlay because your logo image was not set to loop, but I think it will still work.

  • I tend to use format=yuv420p last, so I removed it from the first overlay and put it at the end of the filtergraph. Alternatively you could remove format=yuv420p completely and use the -pix_fmt yuv420p option outside of the filtergraph, but I like to use format instead when filtering so I have more control.

8
  • I've updated my post with your changes. But I get the following error message (see post)
    – Yannick
    Feb 11, 2015 at 19:57
  • 1
    @Yannick Your second filterchain has no output label. You need to add [bg] (or whatever arbitrary label you prefer) to the end of it: [email protected]:t=50[bg];
    – llogan
    Feb 11, 2015 at 20:27
  • Thanks...But now I get the following error message (see updated post)
    – Yannick
    Feb 11, 2015 at 21:30
  • @Yannick You can ignore that warning, but other messages seem to show that your input images are changing frame sizes. I'm not sure how the result will appear. Also, the complete text output is much more helpful than screenshots.
    – llogan
    Feb 11, 2015 at 21:45
  • Sorry for the screenshot. The thing is that it never ends. I need to kill the process. Stop at 371kb.
    – Yannick
    Feb 11, 2015 at 21:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .