tanersener/ffmpeg-video-slideshow-scripts

More image

gasiunhan1501 opened this issue · 32 comments

Hi bro!

Your codes are awesome. Please show me how to make these codes worked with a folder of image, and the number of images is random.

So thank you!

Hi. You need to modify scripts; but each script is different and it's not easy to define a procedure to implement dynamic number of photos. Is there specific script you want to implement?

Tks for your reply!

Can you modify "push_vertical" script? And maybe replace "push" by "pull" - mean: the images go down

Can you modify "push_vertical" script?

Can you try push_vertical.sh @ v2.x branch. It uses all files found under photos folder.

Additionally you can modify slideshow options defined in # SCRIPT OPTIONS block. Currently WIDTH, HEIGHT, FPS, TRANSITION_DURATION and PHOTO_DURATION variables are implemented.

ps: Thanks for the advice about the name. Let me think about it.

Wow! You're awesome!

These scripts are very usefull for me.

Thanks a lot, bro!

Great 👍

clock.sh: line 12: ffmpeg: command not found

i put sh file on the same folder with ffmpeg but still error ?

ffmpeg command path in clock.sh is not different than other scripts. There shouldn't be a problem since other scripts work. Anyway, you can copy line 12 from another working script and try again.

I just want to let you know that all scripts in master are updated with configurable ones.

Thank you! You are wonderfull!
Im trying modify your push_vertical sh to make the images go from bottom to top but it did not work. Can you help me?

Thanks mate, is this what you are trying to do?

Ok, but something's wrong with push_vertical and horizontal. The video cant play, it is about >1mb

The video cant play, it is about >1mb

Is there an error in output?

Yes. There are an error in output. Just in push_vertical and horizontal

Yes. There are an error in output. Just in push_vertical and horizontal

If you share it I can work on the fix, but it is your choice.

I dont know exactly. I used your images to run test. The outputs of push_vertical and horizontal are about ~1mb, and cant play. The outputs of the other are fine!

I meant command output. What is your command output for push_vertical and horizontal? It should be something like:

./push_vertical.sh 

Video Slideshow Info
------------------------
Photo count: 5
Dimension: 1280x720
FPS: 30
Photo duration: 2 s
Transition duration: 1 s
Total duration: 14 s

ffmpeg version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, image2, from '../photos/1.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 146205 kb/s
    Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2048x1188 [SAR 300:300 DAR 512:297], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #1, image2, from '../photos/2.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 119701 kb/s
    Stream #1:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #2, image2, from '../photos/3.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 203286 kb/s
    Stream #2:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #3, image2, from '../photos/4.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 231145 kb/s
    Stream #3:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #4, image2, from '../photos/5.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 175722 kb/s
    Stream #4:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #5, lavfi, from 'color=black:s=1280x720':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #5:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #6, lavfi, from 'nullsrc=s=1280x720':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #6:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (mjpeg) -> setpts
  Stream #1:0 (mjpeg) -> setpts
  Stream #2:0 (mjpeg) -> setpts
  Stream #3:0 (mjpeg) -> setpts
  Stream #4:0 (mjpeg) -> setpts
  Stream #5:0 (rawvideo) -> overlay:main
  Stream #5:0 (rawvideo) -> overlay:main
  Stream #5:0 (rawvideo) -> overlay:main
  Stream #5:0 (rawvideo) -> overlay:main
  Stream #5:0 (rawvideo) -> overlay:main
  Stream #5:0 (rawvideo) -> overlay:main
  Stream #5:0 (rawvideo) -> overlay:main
  Stream #5:0 (rawvideo) -> overlay:main
  Stream #5:0 (rawvideo) -> overlay:main
  Stream #5:0 (rawvideo) -> overlay:main
  Stream #6:0 (rawvideo) -> overlay:main
  Stream #6:0 (rawvideo) -> overlay:main
  Stream #6:0 (rawvideo) -> overlay:main
  Stream #6:0 (rawvideo) -> overlay:main
  format -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[swscaler @ 0x55bf0e530fe0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x55bf0e5713e0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x55bf0eb6f1a0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x55bf0f73d3e0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x55bf0f86e8c0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x55bf0f8aa140] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x55bf0f9dbc80] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x55bf0fa17500] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x55bf0fb49040] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x55bf0fb848c0] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x55bf0ec29640] using SAR=1/1
[libx264 @ 0x55bf0ec29640] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x55bf0ec29640] profile Main, level 4.2
[libx264 @ 0x55bf0ec29640] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 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=0 weightp=0 keyint=1 keyint_min=1 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '../transition_push_vertical.mp4':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[out_0_0 @ 0x55bf0e4fb4a0] 100 buffers queued in out_0_0, something may be wrong. speed=0.174x      
frame=  350 fps= 16 q=-1.0 Lsize=   13689kB time=00:00:13.96 bitrate=8029.1kbits/s speed=0.634x    
video:13686kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.025018%
[libx264 @ 0x55bf0ec29640] frame I:350   Avg QP:26.18  size: 40038
[libx264 @ 0x55bf0ec29640] mb I  I16..4: 46.4%  0.0% 53.6%
[libx264 @ 0x55bf0ec29640] coded y,uvDC,uvAC intra: 49.3% 45.8% 12.7%
[libx264 @ 0x55bf0ec29640] i16 v,h,dc,p: 46% 28% 10% 16%
[libx264 @ 0x55bf0ec29640] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 31% 14%  6%  6%  4%  8%  4%  7%
[libx264 @ 0x55bf0ec29640] i8c dc,h,v,p: 58% 24% 14%  4%
[libx264 @ 0x55bf0ec29640] kb/s:8007.63

Slideshow created in 22 seconds

oh sorry! thats it

`ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8.2.1 (GCC) 20181017
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, image2, from '../photos/1.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 146205 kb/s
Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2048x1188 [SAR 300:300 DAR 512:297], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #1, image2, from '../photos/2.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 119701 kb/s
Stream #1:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #2, image2, from '../photos/3.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 203286 kb/s
Stream #2:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #3, image2, from '../photos/4.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 231145 kb/s
Stream #3:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #4, image2, from '../photos/5.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 175722 kb/s
Stream #4:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #5, lavfi, from 'color=black:s=1280x720':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #5:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #6, lavfi, from 'nullsrc=s=1280x720':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #6:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 (mjpeg) -> setpts
Stream #1:0 (mjpeg) -> setpts
Stream #2:0 (mjpeg) -> setpts
Stream #3:0 (mjpeg) -> setpts
Stream #4:0 (mjpeg) -> setpts
Stream #5:0 (rawvideo) -> overlay:main
Stream #5:0 (rawvideo) -> overlay:main
Stream #5:0 (rawvideo) -> overlay:main
Stream #5:0 (rawvideo) -> overlay:main
Stream #5:0 (rawvideo) -> overlay:main
Stream #5:0 (rawvideo) -> overlay:main
Stream #5:0 (rawvideo) -> overlay:main
Stream #5:0 (rawvideo) -> overlay:main
Stream #5:0 (rawvideo) -> overlay:main
Stream #5:0 (rawvideo) -> overlay:main
Stream #6:0 (rawvideo) -> overlay:main
Stream #6:0 (rawvideo) -> overlay:main
Stream #6:0 (rawvideo) -> overlay:main
Stream #6:0 (rawvideo) -> overlay:main
format -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[swscaler @ 0000015b5d7853c0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000015b5e87bf80] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000015b5f549bc0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000015b5dc10340] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000015b60926f40] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000015b60970ec0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000015b60a9a240] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000015b60af6900] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000015b60c62f80] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0000015b60ca4d80] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0000015b5d7da000] using SAR=1/1
[libx264 @ 0000015b5d7da000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000015b5d7da000] profile Main, level 4.2, 4:2:0, 8-bit
[libx264 @ 0000015b5d7da000] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 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=0 weightp=0 keyint=1 keyint_min=1 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '../transition_push_vertical.mp4':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 1 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 3 fps=2.2 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 4 fps=2.1 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 5 fps=2.1 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 6 fps=2.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 7 fps=2.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 7 fps=1.7 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 8 fps=1.7 q=30.0 size= 0kB time=00:00:00.00 bitrate=5907.7kbits/frame= 9 fps=1.7 q=30.0 size= 0kB time=00:00:00.03 bitrate= 11.5kbits/frame= 10 fps=1.8 q=29.0 size= 0kB time=00:00:00.06 bitrate= 5.8kbits/frame= 11 fps=1.8 q=29.0 size= 0kB time=00:00:00.13 bitrate= 2.9kbits/frame= 12 fps=1.8 q=29.0 size= 0kB time=00:00:00.16 bitrate= 2.3kbits/frame= 13 fps=1.8 q=30.0 size= 0kB time=00:00:00.20 bitrate= 1.9kbits/frame= 13 fps=1.6 q=30.0 size= 0kB time=00:00:00.20 bitrate= 1.9kbits/frame= 14 fps=1.7 q=30.0 size= 256kB time=00:00:00.23 bitrate=8986.9kbits/frame= 15 fps=1.7 q=29.0 size= 256kB time=00:00:00.26 bitrate=7863.8kbits/frame= 16 fps=1.7 q=29.0 size= 256kB time=00:00:00.33 bitrate=6291.4kbits/frame= 17 fps=1.7 q=29.0 size= 256kB time=00:00:00.36 bitrate=5719.5kbits/frame= 18 fps=1.7 q=30.0 size= 256kB time=00:00:00.40 bitrate=5243.0kbits/frame= 19 fps=1.7 q=30.0 size= 256kB time=00:00:00.43 bitrate=4839.7kbits/frame= 20 fps=1.7 q=29.0 size= 256kB time=00:00:00.46 bitrate=4494.1kbits/frame= 21 fps=1.7 q=29.0 size= 256kB time=00:00:00.53 bitrate=3932.4kbits/frame= 22 fps=1.7 q=29.0 size= 512kB time=00:00:00.56 bitrate=7401.5kbits/frame= 23 fps=1.7 q=30.0 size= 512kB time=00:00:00.60 bitrate=6990.4kbits/frame= 24 fps=1.7 q=30.0 size= 512kB time=00:00:00.63 bitrate=6622.5kbits/frame= 25 fps=1.7 q=29.0 size= 512kB time=00:00:00.66 bitrate=6291.4kbits/frame= 26 fps=1.7 q=29.0 size= 512kB time=00:00:00.73 bitrate=5719.5kbits/frame= 27 fps=1.7 q=29.0 size= 512kB time=00:00:00.76 bitrate=5470.9kbits/frame= 28 fps=1.8 q=30.0 size= 512kB time=00:00:00.80 bitrate=5242.9kbits/frame= 29 fps=1.8 q=30.0 size= 512kB time=00:00:00.83 bitrate=5033.2kbits/frame= 31 fps=1.8 q=29.0 size= 768kB time=00:00:00.93 bitrate=6740.8kbits/frame= 32 fps=1.8 q=29.0 size= 768kB time=00:00:00.96 bitrate=6508.4kbits/frame= 33 fps=1.8 q=30.0 size= 768kB time=00:00:01.00 bitrate=6291.4kbits/frame= 34 fps=1.8 q=30.0 size= 768kB time=00:00:01.03 bitrate=6088.5kbits/frame= 36 fps=1.9 q=29.0 size= 768kB time=00:00:01.13 bitrate=5551.3kbits/frame= 37 fps=1.9 q=29.0 size= 1024kB time=00:00:01.16 bitrate=7190.2kbits/frame= 38 fps=1.9 q=30.0 size= 1024kB time=00:00:01.20 bitrate=6990.4kbits/frame= 40 fps=1.9 q=29.0 size= 1024kB time=00:00:01.26 bitrate=6622.5kbits/frame= 41 fps=1.9 q=29.0 size= 1024kB time=00:00:01.33 bitrate=6291.4kbits/frame= 42 fps=1.9 q=29.0 size= 1024kB time=00:00:01.36 bitrate=6138.0kbits/frame= 44 fps=2.0 q=30.0 size= 1024kB time=00:00:01.43 bitrate=5852.5kbits/frame= 45 fps=1.9 q=29.0 size= 1280kB time=00:00:01.46 bitrate=7149.3kbits/frame= 46 fps=1.9 q=29.0 size= 1280kB time=00:00:01.53 bitrate=6838.5kbits/frame= 46 fps=1.9 q=29.0 size= 1280kB time=00:00:01.53 bitrate=6838.5kbits/frame= 47 fps=1.9 q=29.0 size= 1280kB time=00:00:01.56 bitrate=6693.0kbits/frame= 49 fps=1.9 q=30.0 size= 1280kB time=00:00:01.63 bitrate=6419.8kbits/frame= 50 fps=1.9 q=29.0 size= 1280kB time=00:00:01.66 bitrate=6291.4kbits/frame= 51 fps=1.9 q=29.0 size= 1280kB time=00:00:01.73 bitrate=6049.5kbits/frame= 61 fps=2.3 q=28.0 size= 1792kB time=00:00:02.13 bitrate=6881.3kbits/push_vertical.sh: line 111: 8684 Segmentation fault ffmpeg -y -loop 1 -i ../photos/1.jpg -loop 1 -i ../photos/2.jpg -loop 1 -i ../photos/3.jpg -loop 1 -i ../photos/4.jpg -loop 1 -i ../photos/5.jpg -f lavfi -i color=black:s=1280x720 -f lavfi -i nullsrc=s=1280x720 -filter_complex "[0:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1280/720),min(iw,1280),-1)':h='if(gte(iw/ih,1280/720),-1,min(ih,720))',scale=trunc(iw/2)*2:trunc(ih/2)*2,setsar=sar=1/1,format=rgba,split=2[stream1out1][stream1out2];[1:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1280/720),min(iw,1280),-1)':h='if(gte(iw/ih,1280/720),-1,min(ih,720))',scale=trunc(iw/2)2:trunc(ih/2)2,setsar=sar=1/1,format=rgba,split=2[stream2out1][stream2out2];[2:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1280/720),min(iw,1280),-1)':h='if(gte(iw/ih,1280/720),-1,min(ih,720))',scale=trunc(iw/2)2:trunc(ih/2)2,setsar=sar=1/1,format=rgba,split=2[stream3out1][stream3out2];[3:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1280/720),min(iw,1280),-1)':h='if(gte(iw/ih,1280/720),-1,min(ih,720))',scale=trunc(iw/2)2:trunc(ih/2)2,setsar=sar=1/1,format=rgba,split=2[stream4out1][stream4out2];[4:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1280/720),min(iw,1280),-1)':h='if(gte(iw/ih,1280/720),-1,min(ih,720))',scale=trunc(iw/2)2:trunc(ih/2)2,setsar=sar=1/1,format=rgba,split=2[stream5out1][stream5out2];[5:v][stream1out1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:threads=1:format=rgb,trim=duration=2,select=lte(n,60)[stream1overlaid];[5:v][stream1out2]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:threads=1:format=rgb,trim=duration=1,select=lte(n,30)[stream1ending];[5:v][stream2out1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:threads=1:format=rgb,trim=duration=2,select=lte(n,60)[stream2overlaid];[5:v][stream2out2]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:threads=1:format=rgb,trim=duration=1,select=lte(n,30),split=2[stream2starting][stream2ending];[5:v][stream3out1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:threads=1:format=rgb,trim=duration=2,select=lte(n,60)[stream3overlaid];[5:v][stream3out2]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:threads=1:format=rgb,trim=duration=1,select=lte(n,30),split=2[stream3starting][stream3ending];[5:v][stream4out1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:threads=1:format=rgb,trim=duration=2,select=lte(n,60)[stream4overlaid];[5:v][stream4out2]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:threads=1:format=rgb,trim=duration=1,select=lte(n,30),split=2[stream4starting][stream4ending];[5:v][stream5out1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:threads=1:format=rgb,trim=duration=2,select=lte(n,60)[stream5overlaid];[5:v][stream5out2]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2:threads=1:format=rgb,trim=duration=1,select=lte(n,30)[stream5starting];[6:v][stream1ending]overlay=y='t/1720':x=0:threads=1,trim=duration=1,select=lte(n,30)[stream1moving];[6:v][stream2ending]overlay=y='t/1720':x=0:threads=1,trim=duration=1,select=lte(n,30)[stream2moving];[6:v][stream3ending]overlay=y='t/1720':x=0:threads=1,trim=duration=1,select=lte(n,30)[stream3moving];[6:v][stream4ending]overlay=y='t/1720':x=0:threads=1,trim=duration=1,select=lte(n,30)[stream4moving];[stream1moving][stream2starting]overlay=y='-h+t/1720':x=0:threads=1:shortest=1,trim=duration=1,select=lte(n,30)[stream2blended];[stream2moving][stream3starting]overlay=y='-h+t/1720':x=0:threads=1:shortest=1,trim=duration=1,select=lte(n,30)[stream3blended];[stream3moving][stream4starting]overlay=y='-h+t/1720':x=0:threads=1:shortest=1,trim=duration=1,select=lte(n,30)[stream4blended];[stream4moving][stream5starting]overlay=y='-h+t/1720':x=0:threads=1:shortest=1,trim=duration=1,select=lte(n,30)[stream5blended];[stream1overlaid][stream2blended][stream2overlaid][stream3blended][stream3overlaid][stream4blended][stream4overlaid][stream5blended][stream5overlaid]concat=n=9:v=1:a=0,format=yuv420p[video]" -map [video] -vsync 2 -async 1 -rc-lookahead 0 -g 0 -profile:v main -level 42 -c:v libx264 -r 30 ../transition_push_vertical.mp4

Slideshow created in 34 seconds
`

ffmpeg version 4.1
.....
/push_vertical.sh: line 111: 8684 Segmentation fault
.....

Script fails with segmentation fault in your case.

Unfortunately you are using ffmpeg v4.1 which has some problems with push transitions. Can you try with v3.4.x, v4.0.x or git-master.

ffmpeg version 4.1
.....
/push_vertical.sh: line 111: 8684 Segmentation fault
.....

Script fails with segmentation fault in your case.

Unfortunately you are using ffmpeg v4.1 which has some problems with push transitions. Can you try with v3.4.x, v4.0.x or git-master.

yes, thank you, its fine with v4.0. And if you dont mind, i have one issue need you help.

im trying make some videos with some effects by proshow producer but now i want to make videos by ffmpeg. I uploaded two videos to compare.
1: https://www.youtube.com/watch?v=kfq4L0yVJ9g by proshow
2: https://www.youtube.com/watch?v=moCjmgT2rD4 by your code

the biggest diffirent is the width of images - on the video made by proshow, its fullscreen.
can you modify your codes to make the video that? thank you again!

Scripts in v2.x branch has a new parameter called PHOTO_MODE, which defines how photos will be fitted to screen. You can try applying different values and see if it is close to what you need.

Besides, there exists a Push Film script under Advanced Scripts page. It is very similar to what this application is doing. I recommend using it as a base and modify it according to your needs.

@gasiunhan1501 if existing transitions don't work for you, there is a new Stack transition implemented in mainline, you may try it out.

Woaaaaaaa! PERFECT! Thats exactly what i need, thank you so much!

The last, i still have one issue need your help.
Your codes now call all photos in photos folder and the output name is fixed. so if i have some child folders (images inside) in photos folder and i want to make videos by your codes with output's names are the name of child folders. Can you modify your code to do this?

Example: I have some folders with images inside: family, vacation 2018, wedding photos in PHOTOS folder. And i want to make output's name: family.mp4, vacation_2018.mp4, wedding_photos.mp4 by one-time run your SH code

Unfortunately I can't do that. Scripts need to be simple and easy to understand; and putting a logic about subfolders will break its simplicity.

If I were you, I would create another script to control this process. I would recommend going that way.

Below you find an example script. Just update SOURCE and PROJECT_PAGE and run it.

#!/bin/bash

SOURCE=/tmp/source              # DIRECTORY WITH SUB FOLDERS
PROJECT_PAGE=/Users/taner/Projects/ffmpeg-video-slideshow-scripts

mkdir -p ${SOURCE}/script
cp ${PROJECT_PAGE}/transition_scripts/push_vertical.sh ${SOURCE}/script
cd ${SOURCE}/script

SUBFOLDERS=$(ls -d ${SOURCE}/*)

for subfolder in ${SUBFOLDERS}; 
do 
        folder_name=$(basename ${subfolder})
        mv ${subfolder} ${SOURCE}/photos
        ./push_vertical.sh      
        mv ${SOURCE}/photos ${subfolder}
        mv ${SOURCE}/transition_push_vertical.mp4 ${SOURCE}/${folder_name}.mp4
done

rm -rf ${SOURCE}/script

Unfortunately I can't do that. Scripts need to be simple and easy to understand; and putting a logic about subfolders will break its simplicity.

If I were you, I would create another script to control this process. I would recommend going that way.

Below you find an example script. Just update SOURCE and PROJECT_PAGE and run it.

#!/bin/bash

SOURCE=/tmp/source              # DIRECTORY WITH SUB FOLDERS
PROJECT_PAGE=/Users/taner/Projects/ffmpeg-video-slideshow-scripts

mkdir -p ${SOURCE}/script
cp ${PROJECT_PAGE}/transition_scripts/push_vertical.sh ${SOURCE}/script
cd ${SOURCE}/script

SUBFOLDERS=$(ls -d ${SOURCE}/*)

for subfolder in ${SUBFOLDERS}; 
do 
        folder_name=$(basename ${subfolder})
        mv ${subfolder} ${SOURCE}/photos
        ./push_vertical.sh      
        mv ${SOURCE}/photos ${subfolder}
        mv ${SOURCE}/transition_push_vertical.mp4 ${SOURCE}/${folder_name}.mp4
done

rm -rf ${SOURCE}/script

AWESOME! Thank you for example, i made it. Tks a lot, again.

My sister lives in England so hope have chance to meet you to say "Thank you". Great, bro!

AWESOME! Thank you for example, i made it. Tks a lot, again.

My sister lives in England so hope have chance to meet you to say "Thank you". Great, bro!

You're very kind my friend. Unfortunately I don't live in England. I'm glad I was able to help.

Can you show me how to increase renderring speed? Mine is:
frame= 720 fps=2.4 q=29.0 size= 61440kB time=00:00:28.56 bitrate=17623.1kbits/s speed=0.0969x, too slow. The CPU is about 20%.

I tried -preset ultrafast, but it doesnot increase.

My computer:
`Processor: Intel(R) Xeon(R) CPU W3550 @ 3.07GHz (8 CPUs), ~3.1GHz
Memory: 8192MB RAM
Available OS Memory: 8176MB RAM

Card name: NVIDIA Quadro 2000
Manufacturer: NVIDIA
Chip type: Quadro 2000
DAC type: Integrated RAMDAC
Device Key: Enum\PCI\VEN_10DE&DEV_0DD8&SUBSYS_084A103C&REV_A1
Display Memory: 715 MB
Dedicated Memory: 979 MB
Shared Memory: 3831 MB
Current Mode: 1360 x 768 (32 bit) (60Hz)`

Well, I don't have an exact solution for that. I try to apply some of the tips from H.264 Video Encoding Guide when it is too slow.

In your case, speed is 0.0969x which is really slow but bitrate is high. What is the resolution here?

#!/bin/bash
#
# ffmpeg video slideshow script with vertical stack transition v1 (11.12.2018)
#
# Copyright (c) 2017-2018, Taner Sener (https://github.com/tanersener)
#
# This work is licensed under the terms of the MIT license. For a copy, see <https://opensource.org/licenses/MIT>.
#

# SCRIPT OPTIONS - CAN BE MODIFIED
WIDTH=1280
HEIGHT=720
FPS=30
TOTAL_DURATION_1=18           # TIME FOR ONE IMAGE
BACKGROUND_COLOR="black"
DIRECTION=2                 # 1=TOP TO BOTTOM, 2=BOTTOM TO TOP
INCLUDE_INTRO=1             # START WITH EMPTY SCREEN
INCLUDE_OUTRO=0             # END WITH EMPTY SCREEN

# PHOTO OPTIONS - ALL FILES UNDER photos FOLDER ARE USED - USE sort TO SPECIFY A SORTING MECHANISM
# PHOTOS=`find ../photos/* | sort -r`
PHOTOS=`find ../photos/*`

############################
# DO NO MODIFY LINES BELOW
############################

# CALCULATE LENGTH MANUALLY
let PHOTOS_COUNT=0
for photo in ${PHOTOS}; do (( PHOTOS_COUNT+=1 )); done

TOTAL_DURATION=$((${PHOTOS_COUNT}*${TOTAL_DURATION_1}))		# VIDEO LENGTH

if [[ ${PHOTOS_COUNT} -lt 2 ]]; then
    echo "Error: photos folder should contain at least two photos"
    exit 1;
fi

echo -e "\nVideo Slideshow Info\n------------------------\nPhoto count: ${PHOTOS_COUNT}\nDimension: ${WIDTH}x${HEIGHT}\nFPS: 30\nTotal duration: ${TOTAL_DURATION} s\n"

START_TIME=$SECONDS

# 1. START COMMAND
FULL_SCRIPT="ffmpeg -y "

# 2. ADD INPUTS
for photo in ${PHOTOS}; do
    FULL_SCRIPT+="-loop 1 -i ${photo} "
done

# 3. ADD BACKGROUND COLOR SCREEN INPUT
FULL_SCRIPT+="-f lavfi -i color=${BACKGROUND_COLOR}:s=${WIDTH}x${HEIGHT} "

# 4. START FILTER COMPLEX
FULL_SCRIPT+="-filter_complex \""

# 5. PREPARING SCALED INPUTS
for (( c=0; c<${PHOTOS_COUNT}; c++ ))
do
    FULL_SCRIPT+="[${c}:v]setpts=PTS-STARTPTS,scale=trunc(iw/2)*2:trunc(ih/2)*2,scale=${WIDTH}:-1,setsar=sar=1/1[stream$((c+1))];"
done

STACKED_INPUTS=""
declare -i INTRO_OUTRO_COUNT=0

# 6. BEGIN STACK INPUTS
if [[ ${INCLUDE_INTRO} -eq 1 ]]; then
    STACKED_INPUTS+="[${PHOTOS_COUNT}:v]"
    INTRO_OUTRO_COUNT+=1;
fi

for (( c=1; c<=${PHOTOS_COUNT}; c++ ))
do
    STACKED_INPUTS+="[stream${c}]"
done

if [[ ${INCLUDE_OUTRO} -eq 1 ]]; then
    STACKED_INPUTS+="[${PHOTOS_COUNT}:v]"
    INTRO_OUTRO_COUNT+=1;
fi

# 7. END STACK INPUTS
FULL_SCRIPT+="${STACKED_INPUTS}vstack=inputs=$((${PHOTOS_COUNT}+${INTRO_OUTRO_COUNT}))[stack];"

# 8. SLIDE STACK
case ${DIRECTION} in
    1)
        FULL_SCRIPT+="[${PHOTOS_COUNT}:v][stack]overlay=x=0:y='-(overlay_h-${HEIGHT})+(overlay_h-${HEIGHT})*t/${TOTAL_DURATION}',trim=duration=${TOTAL_DURATION},format=yuv420p[video]\""
    ;;
    *)
        FULL_SCRIPT+="[${PHOTOS_COUNT}:v][stack]overlay=x=0:y='-(overlay_h-${HEIGHT})*t/${TOTAL_DURATION}',trim=duration=${TOTAL_DURATION},format=yuv420p[video]\""
    ;;
esac

# 9. END
FULL_SCRIPT+=" -map [video] -vsync 2 -async 1 -rc-lookahead 0 -g 0 -profile:v main -level 42 -c:v libx264 -r ${FPS} ../transition_stack_vertical.mp4"

eval ${FULL_SCRIPT}

ELAPSED_TIME=$(($SECONDS - $START_TIME))

echo -e '\nSlideshow created in '$ELAPSED_TIME' seconds\n'

I Modified your code, line 14 and 32. But when numer of images is 45, the sh said:

stack_vertical.sh: line 98: 5096 Segmentation fault ffmpeg -y -loop 1 -i ../photos/001a.jpg -loop 1 -i ../photos/002.jpg -loop 1 -i ../photos/003.png ...............

i dont know whats wrong.

And about the encoding speed, when sh run, the fps is still ~ 1.6 ~ 1.9. i think thats the reason, how can i increase that ?

I Modified your code, line 14 and 32. But when numer of images is 45, the sh said:

stack_vertical.sh: line 98: 5096 Segmentation fault ffmpeg -y -loop 1 -i ../photos/001a.jpg -loop 1 -i ../photos/002.jpg -loop 1 -i ../photos/003.png ...............

i dont know whats wrong.

It is hard to know the actual reason of a Segmentation fault. Most of the time it is a bug in ffmpeg itself. But a detailed analysis is needed to understand the reason. You can try to run the same script with another ffmpeg version. In your case I'd try v3.4.x which works better for me than the latest v4.x versions. Also keep in my mind that if script is working fine with 44 images and failing with 45, then maybe there is something in image 45 that ffmpeg can not handle. If I were you I'd change the order of image 45 to see if Segmentation fault happens at the same time/place.

And about the encoding speed, when sh run, the fps is still ~ 1.6 ~ 1.9. i think thats the reason, how can i increase that ?

You asked that before and I recommended H.264 Video Encoding Guide for you. Now you have the same question. Wouldn't be better to say at least Thanks, I tried a few things from there but they didn't work out?

You know you can also ask this question on ffmpeg-user mailing list, they are very helpful indeed.

Oh sorry, i dont understand many things in using ffmpeg, so i dont really know they are the same questions. Sorry for my english, too!
Im reading some docs, and maybe find the way to fix this. I will tell you when i made it.

Tks again, kind man!

I want to add that I created a Tips section in README. It includes my recommendations about increasing the speed and decreasing the memory usage.