Ffmpeg Android – First image is skipped while making a slideshow

Issue : I have 7 images in a list (with different size, resolution and format). I am adding an mp3 audio file and fade effect while making a slideshow with them, as i am trying to do it by following command

val inputCommandinitial = arrayOf("-y", "-framerate", "1/5")
val arrTop = ArrayList<String>()

 //Add all paths
    for (i in images!!.indices) {
        arrTop.add("-loop")
        arrTop.add("1")
        arrTop.add("-t")
        arrTop.add("5")            
        arrTop.add("-i")
        arrTop.add(images!![i].path)
    }

    //Apply filter graph
    arrTop.add("-i")
    arrTop.add(audio!!.path)
    arrTop.add("-filter_complex")

    val stringBuilder = StringBuilder()

    for (i in images!!.indices) {
        stringBuilder.append("[$i:v]scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=5:d=1[v$i];")
    }

    for (i in images!!.indices) {
        stringBuilder.append("[v$i]")
    }

    //Concat command
    stringBuilder.append("concat=n=${images!!.size}:v=1:a=0,fps=25,format=yuv420p[v]")

    val endcommand = arrayOf("-map", "[v]", "-map", "${images!!.size}:a", "-c:a", "copy", "-preset", "ultrafast", "-shortest", outputLocation.path)
    val finalCommand = (inputCommandinitial + arrTop + stringBuilder.toString() + endcommand)

But, it skips the first image and shows the rest 6 images and video output duration is 30 seconds, i’ve been trying since 3 days now

Requirement: making a slideshow with different format, size, resolution etc, i.e. picked by user from gallery and show in slideshow adding an audio behind, with fade effect

Here is the complete log:

I/mobile-ffmpeg: Loading mobile-ffmpeg.
 I/mobile-ffmpeg: Loaded mobile-ffmpeg-full-gpl-x86-4.4-lts-20200803.
 D/mobile-ffmpeg: Callback thread started.
 I/mobile-ffmpeg: ffmpeg version v4.4-dev-416
 I/mobile-ffmpeg:  Copyright (c) 2000-2020 the FFmpeg developers
 I/mobile-ffmpeg:   built with Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn)
 I/mobile-ffmpeg:   configuration: --cross-prefix=i686-linux-android- --sysroot=/files/android-sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-x86/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=i686 --cpu=i686 --cc=i686-linux-android16-clang --cxx=i686-linux-android16-clang++ --extra-libs='-L/home/taner/Projects/mobile-ffmpeg/prebuilt/android-x86/cpu-features/lib -lndk_compat' --target-os=android --disable-neon --disable-asm --disable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-openssl --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --disable-audiotoolbox --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls --enable-libmp3lame --enable-libass --enable-iconv --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libopencore-amrnb --enable-libshine --enable-libspeex --enable-libwavpack --enable-libkvazaar --enable-libx264 --enable-gpl --enable-libxvid --enable-gpl --enable-libx265 --enable-gpl --enable-libvidstab --enable-gpl --enable-libilbc --enable-libopus --enable-libsnappy --enable-libsoxr --enable-libaom --enable-libtwolame --disable-sdl2 --enable-libvo-amrwbenc --enable-zlib --enable-mediacodec
 I/mobile-ffmpeg:   libavutil      56. 55.100 / 56. 55.100
 I/mobile-ffmpeg:   libavcodec     58. 96.100 / 58. 96.100
 I/mobile-ffmpeg:   libavformat    58. 48.100 / 58. 48.100
 I/mobile-ffmpeg:   libavdevice    58. 11.101 / 58. 11.101
 I/mobile-ffmpeg:   libavfilter     7. 87.100 /  7. 87.100
 I/mobile-ffmpeg:   libswscale      5.  8.100 /  5.  8.100
 I/mobile-ffmpeg:   libswresample   3.  8.100 /  3.  8.100
 I/mobile-ffmpeg: Input #0, png_pipe, from '/storage/emulated/0/FFMpeg Example/image1.png':
 I/mobile-ffmpeg:   Duration:
 I/mobile-ffmpeg: N/A
 I/mobile-ffmpeg: , bitrate:
 I/mobile-ffmpeg: N/A
 I/mobile-ffmpeg:     Stream #0:0
 I/mobile-ffmpeg: : Video: png, rgb24(pc), 800x500 [SAR 11811:11811 DAR 8:5]
 I/mobile-ffmpeg: ,
 I/mobile-ffmpeg: 0.20 tbr,
 I/mobile-ffmpeg: 0.20 tbn,
 I/mobile-ffmpeg: 0.20 tbc
 W/mobile-ffmpeg: [png_pipe @ 0xe1a8ec00] Stream #0: not enough frames to estimate rate; consider increasing probesize
 I/mobile-ffmpeg: Input #1, png_pipe, from '/storage/emulated/0/FFMpeg Example/image2.png':
 I/mobile-ffmpeg:   Duration:
 I/mobile-ffmpeg: N/A
 I/mobile-ffmpeg: , bitrate:
 I/mobile-ffmpeg: N/A
 I/mobile-ffmpeg:     Stream #1:0
 I/mobile-ffmpeg: : Video: png, rgb24(pc), 1920x1080 [SAR 3779:3779 DAR 16:9]
 I/mobile-ffmpeg: ,
 I/mobile-ffmpeg: 25 tbr,
 I/mobile-ffmpeg: 25 tbn,
 I/mobile-ffmpeg: 25 tbc
 I/mobile-ffmpeg: Input #2, png_pipe, from '/storage/emulated/0/FFMpeg Example/one.png':
 I/mobile-ffmpeg:   Duration:
 I/mobile-ffmpeg: N/A
 I/mobile-ffmpeg: , bitrate:
 I/mobile-ffmpeg: N/A
 I/mobile-ffmpeg:     Stream #2:0
 I/mobile-ffmpeg: : Video: png, rgba(pc), 720x1280
 I/mobile-ffmpeg: ,
 I/mobile-ffmpeg: 25 fps,
 I/mobile-ffmpeg: 25 tbr,
 I/mobile-ffmpeg: 25 tbn,
 I/mobile-ffmpeg: 25 tbc
 I/mobile-ffmpeg: Input #3, image2, from '/storage/emulated/0/FFMpeg Example/two.png':
 I/mobile-ffmpeg:   Duration:
 I/mobile-ffmpeg: 00:00:00.04
 I/mobile-ffmpeg: , start:
 I/mobile-ffmpeg: 0.000000
 I/mobile-ffmpeg: , bitrate:
 I/mobile-ffmpeg: 7955 kb/s
 I/mobile-ffmpeg:     Stream #3:0
 I/mobile-ffmpeg: : Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 564x1002 [SAR 72:72 DAR 94:167]
 I/mobile-ffmpeg: ,
 I/mobile-ffmpeg: 25 fps,
 I/mobile-ffmpeg: 25 tbr,
 I/mobile-ffmpeg: 25 tbn,
 I/mobile-ffmpeg: 25 tbc
 W/mobile-ffmpeg: [png_pipe @ 0xe1a90a00] Stream #0: not enough frames to estimate rate; consider increasing probesize
 I/mobile-ffmpeg: Input #4, png_pipe, from '/storage/emulated/0/FFMpeg Example/image3.png':
 I/mobile-ffmpeg:   Duration:
 I/mobile-ffmpeg: N/A
 I/mobile-ffmpeg: , bitrate:
 I/mobile-ffmpeg: N/A
 I/mobile-ffmpeg:     Stream #4:0
 I/mobile-ffmpeg: : Video: png, rgb24(pc), 1820x1024
 I/mobile-ffmpeg: ,
 I/mobile-ffmpeg: 25 tbr,
 I/mobile-ffmpeg: 25 tbn,
 I/mobile-ffmpeg: 25 tbc
 I/mobile-ffmpeg: Input #5, png_pipe, from '/storage/emulated/0/FFMpeg Example/image4.png':
 I/mobile-ffmpeg:   Duration:
 I/mobile-ffmpeg: N/A
 I/mobile-ffmpeg: , bitrate:
 I/mobile-ffmpeg: N/A
 I/mobile-ffmpeg:     Stream #5:0
 I/mobile-ffmpeg: : Video: png, rgb24(pc), 1920x800 [SAR 2835:2835 DAR 12:5]
 I/mobile-ffmpeg: ,
 I/mobile-ffmpeg: 25 fps,
 I/mobile-ffmpeg: 25 tbr,
 I/mobile-ffmpeg: 25 tbn,
 I/mobile-ffmpeg: 25 tbc
 I/mobile-ffmpeg: Input #6, image2, from '/storage/emulated/0/FFMpeg Example/image5.png':
 I/mobile-ffmpeg:   Duration:
 I/mobile-ffmpeg: 00:00:00.04
 I/mobile-ffmpeg: , start:
 I/mobile-ffmpeg: 0.000000
 I/mobile-ffmpeg: , bitrate:
 I/mobile-ffmpeg: 159573 kb/s
 I/mobile-ffmpeg:     Stream #6:0
 I/mobile-ffmpeg: : Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1600x900
 I/mobile-ffmpeg: ,
 I/mobile-ffmpeg: 25 fps,
 I/mobile-ffmpeg: 25 tbr,
 I/mobile-ffmpeg: 25 tbn,
 I/mobile-ffmpeg: 25 tbc
 W/mobile-ffmpeg: [mp3 @ 0xe1a92800] Estimating duration from bitrate, this may be inaccurate
 I/mobile-ffmpeg: Input #7, mp3, from '/storage/emulated/0/FFMpeg Example/shortmusic.mp3':
 I/mobile-ffmpeg:   Metadata:
 I/mobile-ffmpeg:     track           :
 I/mobile-ffmpeg: 25
 I/mobile-ffmpeg:     artist          :
 I/mobile-ffmpeg: longzijun
 I/mobile-ffmpeg:     title           :
 I/mobile-ffmpeg: Memoryne Music Box Version
 I/mobile-ffmpeg:     album_artist    :
 I/mobile-ffmpeg: longzijun
 I/mobile-ffmpeg:     genre           :
 I/mobile-ffmpeg: Soundtrack
 I/mobile-ffmpeg:     date            :
 I/mobile-ffmpeg: 2012
 I/mobile-ffmpeg:   Duration:
 I/mobile-ffmpeg: 00:00:57.70
 I/mobile-ffmpeg: , start:
 I/mobile-ffmpeg: 0.000000
 I/mobile-ffmpeg: , bitrate:
 I/mobile-ffmpeg: 320 kb/s
 I/mobile-ffmpeg:     Stream #7:0
 I/mobile-ffmpeg: : Audio: mp3, 48000 Hz, stereo, fltp, 320 kb/s
 I/mobile-ffmpeg: Stream mapping:
 I/mobile-ffmpeg:   Stream #0:0 (png) -> scale
 I/mobile-ffmpeg:   Stream #1:0 (png) -> scale
 I/mobile-ffmpeg:   Stream #2:0 (png) -> scale
 I/mobile-ffmpeg:   Stream #3:0 (mjpeg) -> scale
 I/mobile-ffmpeg:   Stream #4:0 (png) -> scale
 I/mobile-ffmpeg:   Stream #5:0 (png) -> scale
 I/mobile-ffmpeg:   Stream #6:0 (mjpeg) -> scale
 I/mobile-ffmpeg:   format
 I/mobile-ffmpeg:  -> Stream #0:0 (libx264)
 I/mobile-ffmpeg:   Stream #7:0 -> #0:1
 I/mobile-ffmpeg:  (copy)
 I/mobile-ffmpeg: Press [q] to stop, [?] for help
 I/mobile-ffmpeg: frame=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A
 W/mobile-ffmpeg: [graph 0 input from stream 0:0 @ 0xe1a1bec0] sws_param option is deprecated and ignored
 W/mobile-ffmpeg: [graph 0 input from stream 1:0 @ 0xe1a1bf20] sws_param option is deprecated and ignored
 W/mobile-ffmpeg: [graph 0 input from stream 2:0 @ 0xe1a1bfe0] sws_param option is deprecated and ignored
 W/mobile-ffmpeg: [graph 0 input from stream 3:0 @ 0xe1a1c0a0] sws_param option is deprecated and ignored
 W/mobile-ffmpeg: [graph 0 input from stream 4:0 @ 0xe1a1c160] sws_param option is deprecated and ignored
 W/mobile-ffmpeg: [graph 0 input from stream 5:0 @ 0xe1a1c220] sws_param option is deprecated and ignored
 W/mobile-ffmpeg: [graph 0 input from stream 6:0 @ 0xe1a1c2e0] sws_param option is deprecated and ignored
 W/mobile-ffmpeg: [swscaler @ 0xbf684840] deprecated pixel format used, make sure you did set range correctly
 W/mobile-ffmpeg: [swscaler @ 0xbf68fec0] deprecated pixel format used, make sure you did set range correctly
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] using SAR=1/1
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] using cpu capabilities: none!
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] profile Constrained Baseline, level 3.1, 4:2:0, 8-bit
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=4 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
 I/mobile-ffmpeg: Output #0, mp4, to '/storage/emulated/0/FFMpeg Example/video/movie_1615954349867.mp4':
 I/mobile-ffmpeg:   Metadata:
 I/mobile-ffmpeg:     encoder         :
 I/mobile-ffmpeg: Lavf58.48.100
 I/mobile-ffmpeg:     Stream #0:0
 I/mobile-ffmpeg: : Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x1280 [SAR 1:1 DAR 9:16], q=-1--1
 I/mobile-ffmpeg: ,
 I/mobile-ffmpeg: 25 fps,
 I/mobile-ffmpeg: 12800 tbn,
 I/mobile-ffmpeg: 25 tbc
 I/mobile-ffmpeg:  (default)
 I/mobile-ffmpeg:     Metadata:
 I/mobile-ffmpeg:       encoder         :
 I/mobile-ffmpeg: Lavc58.96.100 libx264
 I/mobile-ffmpeg:     Side data:
 I/mobile-ffmpeg:
 I/mobile-ffmpeg: cpb:
 I/mobile-ffmpeg: bitrate max/min/avg: 0/0/0 buffer size: 0
 I/mobile-ffmpeg: vbv_delay: N/A
 I/mobile-ffmpeg:     Stream #0:1
 I/mobile-ffmpeg: : Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s
 I/mobile-ffmpeg: frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
 I/mobile-ffmpeg: frame=    7 fps=3.8 q=20.0 size=       0kB time=00:00:00.04 bitrate=   9.6kbits/s speed=0.0215x
 I/mobile-ffmpeg: frame=   15 fps=6.3 q=22.0 size=       0kB time=00:00:00.36 bitrate=   1.1kbits/s speed=0.151x
 I/mobile-ffmpeg: frame=   24 fps=8.2 q=23.0 size=     256kB time=00:00:00.72 bitrate=2912.9kbits/s speed=0.245x
 I/mobile-ffmpeg: frame=   33 fps=9.5 q=14.0 size=     512kB time=00:00:01.08 bitrate=3883.7kbits/s speed=0.31x
 I/mobile-ffmpeg: frame=   44 fps= 11 q=12.0 size=     512kB time=00:00:01.52 bitrate=2759.5kbits/s speed=0.379x
 I/mobile-ffmpeg: frame=   55 fps= 12 q=12.0 size=     512kB time=00:00:01.96 bitrate=2140.1kbits/s speed=0.432x
 I/mobile-ffmpeg: frame=   68 fps= 13 q=12.0 size=     768kB time=00:00:02.48 bitrate=2537.0kbits/s speed=0.491x
 I/mobile-ffmpeg: frame=   77 fps= 14 q=12.0 size=     768kB time=00:00:02.84 bitrate=2215.4kbits/s speed=0.499x
 I/mobile-ffmpeg: frame=   84 fps= 13 q=12.0 size=     768kB time=00:00:03.12 bitrate=2016.6kbits/s speed=0.499x
 I/mobile-ffmpeg: frame=   94 fps= 14 q=12.0 size=     768kB time=00:00:03.52 bitrate=1787.4kbits/s speed=0.52x
 I/mobile-ffmpeg: frame=  102 fps= 14 q=12.0 size=     768kB time=00:00:03.84 bitrate=1638.5kbits/s speed=0.525x
 I/mobile-ffmpeg: frame=  116 fps= 15 q=12.0 size=     768kB time=00:00:04.40 bitrate=1429.9kbits/s speed=0.556x
 I/mobile-ffmpeg: frame=  127 fps= 15 q=12.0 size=     768kB time=00:00:04.84 bitrate=1299.9kbits/s speed=0.574x
 I/mobile-ffmpeg: frame=  134 fps= 15 q=21.0 size=     768kB time=00:00:05.12 bitrate=1228.9kbits/s speed=0.571x
 I/mobile-ffmpeg: frame=  140 fps= 15 q=22.0 size=    1024kB time=00:00:05.36 bitrate=1565.1kbits/s speed=0.56x
 I/mobile-ffmpeg: frame=  145 fps= 14 q=23.0 size=    1024kB time=00:00:05.56 bitrate=1508.8kbits/s speed=0.55x
 I/mobile-ffmpeg: frame=  151 fps= 14 q=23.0 size=    1280kB time=00:00:05.80 bitrate=1807.9kbits/s speed=0.546x
 I/mobile-ffmpeg: frame=  164 fps= 15 q=12.0 size=    1536kB time=00:00:06.32 bitrate=1991.0kbits/s speed=0.567x
 I/mobile-ffmpeg: frame=  172 fps= 15 q=12.0 size=    1536kB time=00:00:06.64 bitrate=1895.1kbits/s speed=0.569x
 I/mobile-ffmpeg: frame=  186 fps= 15 q=12.0 size=    1536kB time=00:00:07.20 bitrate=1747.7kbits/s speed=0.592x
 I/mobile-ffmpeg: frame=  207 fps= 16 q=12.0 size=    1536kB time=00:00:08.04 bitrate=1565.1kbits/s speed=0.634x
 I/mobile-ffmpeg: frame=  229 fps= 17 q=12.0 size=    1792kB time=00:00:08.92 bitrate=1645.8kbits/s speed=0.677x
 I/mobile-ffmpeg: frame=  249 fps= 18 q=12.0 size=    1792kB time=00:00:09.72 bitrate=1510.3kbits/s speed=0.71x
 I/mobile-ffmpeg: frame=  270 fps= 19 q=21.0 size=    2048kB time=00:00:10.56 bitrate=1588.8kbits/s speed=0.744x
 I/mobile-ffmpeg: frame=  296 fps= 20 q=12.0 size=    2304kB time=00:00:11.60 bitrate=1627.1kbits/s speed=0.789x
 I/mobile-ffmpeg: frame=  319 fps= 21 q=12.0 size=    2304kB time=00:00:12.52 bitrate=1507.6kbits/s speed=0.823x
 I/mobile-ffmpeg: frame=  337 fps= 21 q=12.0 size=    2304kB time=00:00:13.24 bitrate=1425.6kbits/s speed=0.839x
 I/mobile-ffmpeg: frame=  347 fps= 21 q=12.0 size=    2304kB time=00:00:13.64 bitrate=1383.8kbits/s speed=0.835x
 I/mobile-ffmpeg: frame=  360 fps= 21 q=12.0 size=    2560kB time=00:00:14.16 bitrate=1481.1kbits/s speed=0.841x
 I/mobile-ffmpeg: frame=  382 fps= 22 q=19.0 size=    2560kB time=00:00:15.04 bitrate=1394.4kbits/s speed=0.866x
 I/mobile-ffmpeg: frame=  395 fps= 22 q=22.0 size=    2816kB time=00:00:15.56 bitrate=1482.6kbits/s speed=0.869x
 I/mobile-ffmpeg: frame=  407 fps= 22 q=15.0 size=    3072kB time=00:00:16.04 bitrate=1569.0kbits/s speed=0.872x
 I/mobile-ffmpeg: frame=  421 fps= 22 q=12.0 size=    3072kB time=00:00:16.60 bitrate=1516.0kbits/s speed=0.875x
 I/mobile-ffmpeg: frame=  432 fps= 22 q=12.0 size=    3072kB time=00:00:17.04 bitrate=1476.9kbits/s speed=0.875x
 I/mobile-ffmpeg: frame=  446 fps= 22 q=12.0 size=    3072kB time=00:00:17.60 bitrate=1429.9kbits/s speed=0.88x
 I/mobile-ffmpeg: frame=  458 fps= 22 q=12.0 size=    3328kB time=00:00:18.08 bitrate=1507.9kbits/s speed=0.879x
 I/mobile-ffmpeg: frame=  472 fps= 22 q=12.0 size=    3328kB time=00:00:18.64 bitrate=1462.6kbits/s speed=0.884x
 I/mobile-ffmpeg: frame=  489 fps= 23 q=12.0 size=    3328kB time=00:00:19.32 bitrate=1411.1kbits/s speed=0.894x
 I/mobile-ffmpeg: frame=  509 fps= 23 q=19.0 size=    3328kB time=00:00:20.12 bitrate=1355.0kbits/s speed=0.909x
 I/mobile-ffmpeg: frame=  531 fps= 23 q=15.0 size=    3584kB time=00:00:21.00 bitrate=1398.1kbits/s speed=0.928x
 I/mobile-ffmpeg: frame=  555 fps= 24 q=12.0 size=    3840kB time=00:00:21.96 bitrate=1432.5kbits/s speed=0.949x
 I/mobile-ffmpeg: frame=  577 fps= 24 q=12.0 size=    3840kB time=00:00:22.84 bitrate=1377.3kbits/s speed=0.966x
 I/mobile-ffmpeg: frame=  599 fps= 25 q=12.0 size=    3840kB time=00:00:23.72 bitrate=1326.2kbits/s speed=0.981x
 I/mobile-ffmpeg: frame=  620 fps= 25 q=12.0 size=    3840kB time=00:00:24.56 bitrate=1280.8kbits/s speed=0.995x
 I/mobile-ffmpeg: frame=  630 fps= 25 q=18.0 size=    3840kB time=00:00:24.96 bitrate=1260.3kbits/s speed=0.99x
 I/mobile-ffmpeg: frame=  640 fps= 25 q=21.0 size=    4096kB time=00:00:25.36 bitrate=1323.1kbits/s speed=0.985x
 I/mobile-ffmpeg: frame=  652 fps= 25 q=22.0 size=    4352kB time=00:00:25.84 bitrate=1379.7kbits/s speed=0.984x
 I/mobile-ffmpeg: frame=  665 fps= 25 q=12.0 size=    4608kB time=00:00:26.36 bitrate=1432.1kbits/s speed=0.984x
 I/mobile-ffmpeg: frame=  678 fps= 25 q=12.0 size=    4608kB time=00:00:26.88 bitrate=1404.4kbits/s speed=0.984x
 I/mobile-ffmpeg: frame=  690 fps= 25 q=12.0 size=    4608kB time=00:00:27.36 bitrate=1379.7kbits/s speed=0.983x
 I/mobile-ffmpeg: frame=  703 fps= 25 q=12.0 size=    4608kB time=00:00:27.88 bitrate=1354.0kbits/s speed=0.983x
 I/mobile-ffmpeg: frame=  716 fps= 25 q=12.0 size=    4608kB time=00:00:28.40 bitrate=1329.2kbits/s speed=0.983x
 I/mobile-ffmpeg: frame=  729 fps= 25 q=12.0 size=    4608kB time=00:00:28.92 bitrate=1305.3kbits/s speed=0.983x
 I/mobile-ffmpeg: frame=  742 fps= 25 q=12.0 size=    4608kB time=00:00:29.44 bitrate=1282.2kbits/s speed=0.983x
 I/mobile-ffmpeg: frame=  749 fps= 25 q=-1.0 Lsize=    4883kB time=00:00:29.95 bitrate=1335.5kbits/s speed=0.988x
 I/mobile-ffmpeg: video:3696kB audio:1171kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead:
 I/mobile-ffmpeg: 0.326516%
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] frame I:3     Avg QP:13.33  size:  2725
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] frame P:746   Avg QP:13.98  size:  5062
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] mb I  I16..4: 100.0%  0.0%  0.0%
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] mb P  I16..4:  7.1%  0.0%  0.0%  P16..4:  8.2%  0.0%  0.0%  0.0%  0.0%    skip:84.7%
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] coded y,uvDC,uvAC intra: 14.5% 19.0% 6.9% inter: 5.1% 5.4% 1.4%
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] i16 v,h,dc,p: 65% 18%  7%  9%
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] i8c dc,h,v,p: 71% 19%  6%  4%
 I/mobile-ffmpeg: [libx264 @ 0xe1ad4400] kb/s:1010.47
 I/mobile-ffmpeg: Async command execution completed successfully.

and here is command is ffmpeg syntax

"-y"
"-framerate"
"1/5"
"-loop"
"1"
"-t"
"5"
"-i"
"/storage/emulated/0/FFMpeg Example/image1.png"
"-loop"
"1"
"-t"
"5"
"-i"
 "/storage/emulated/0/FFMpeg Example/image2.png"
 "-loop"
 "1"
 "-t"
 "5"
 "-i"
 "/storage/emulated/0/FFMpeg Example/one.png"
 "-loop"
 "1"
 "-t"
 "5"
 "-i"
 "/storage/emulated/0/FFMpeg Example/two.png"
 "-loop"
 "1"
 "-t"
 "5"
 "-i"
 "/storage/emulated/0/FFMpeg Example/image3.png"
 "-loop"
 "1"
 "-t"
 "5"
 "-i"
 "/storage/emulated/0/FFMpeg Example/image4.png"
 "-loop"
 "1"
 "-t"
 "5"
 "-i"
 "/storage/emulated/0/FFMpeg Example/image5.png"
 "-i"
 "/storage/emulated/0/FFMpeg Example/shortmusic.mp3"
 "-filter_complex"
 "[0:v]scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=5:d=1[v0];
[1:v]scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=5:d=1[v1];
[2:v]scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=5:d=1[v2];
[3:v]scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=5:d=1[v3];
[4:v]scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=5:d=1[v4];
[5:v]scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=5:d=1[v5];
[6:v]scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=5:d=1[v6];
[v0][v1][v2][v3][v4][v5][v6]concat=n=7:v=1:a=0,fps=25,format=yuv420p[v]"
 "-map"
 "[v]"
 "-map"
 "7:a"
 "-c:a"
 "copy"
 "-preset"
 "ultrafast"
 "-shortest"
 "/storage/emulated/0/FFMpeg Example/video/movie_1615955101725.mp4"

Answer

Remove -framerate 1/5. That’s too low of a value for your given -t and it won’t work well with fade (image a fade at 0.2 fps). You’re only applying that to the first input, while the rest are using the default -framerate 25. Remove it and the image will be visible.

Alternatively, use -framerate 1 for each image input, and add fps=25 after each setsar. It will be significantly faster.

Leave a Reply

Your email address will not be published. Required fields are marked *