Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


Tip: Create a video slideshow from images

A collection of useful tutorials for some common tasks.

Re: Tip: Create a video slideshow from images

Postby burek » Sat Mar 01, 2014 5:56 pm

abbs, you might be better off using a decent video editor instead of ffmpeg (a fast encoder/decoder).
burek
 
Posts: 864
Joined: Mon May 09, 2011 10:16 pm
Location: Serbia

Re: Tip: Create a video slideshow from images

Postby shaneharter » Sun Apr 27, 2014 5:50 pm

@abbs

Curious to know what you ended up with here?
shaneharter
 
Posts: 1
Joined: Sun Apr 27, 2014 5:48 pm

Re: Tip: Create a video slideshow from images

Postby jonathanj » Wed Dec 23, 2015 7:34 pm

abbs: I'm working on achieving exactly the same as you and I am curious to know if you figured out a way to do it properly.

Note: I have borrowed commands and tricks from various forums and these people deserve the credit, however, I can't link yet as I recently activated my account here. Just FYI.

I got the following cmdline currently "working", except the resulting outputfile is 2 seconds longer than it should be!

Expected output:
[image][transition][image][transition][image][transition][image][transition][image] with each of the 5 images being shown 1 sec and each of the 4 transitions being 0,5 sec = (5x1)+(4x0,5) = 7 seconds (420 frames)

Actual output:
[image1(60sec)][transition1(30sec)][image2(90sec)][transition2(30sec)][image3(90sec)][transition3(30sec)][image4(90sec)][transition4(30sec)][image5(90sec)] = 9 seconds (540 frames)

What I can't seem to crack is why the first image is correctly showed for 1 second, but the rest is showed 1½sec each!?
I have set the same transition length (0.5 sec) for all the 4 transitions...

Anyone got a logic explanation for this? :)

cmdline:
Code: Select all
ffmpeg -framerate 60 -loop 1 -t 1 -i img01.tif -framerate 60 -loop 1 -t 1 -i img02.tif -framerate 60 -loop 1 -t 1 -i img03.tif -framerate 60 -loop 1 -t 1 -i img04.tif -framerate 60 -loop 1 -t 1 -i img05.tif -filter_complex "[1:v][0:v]blend=all_expr='A*(if(gte(T,0.5),1,T/0.5))+B*(1-(if(gte(T,0.5),1,T/0.5)))'[b1v]; [2:v][1:v]blend=all_expr='A*(if(gte(T,0.5),1,T/0.5))+B*(1-(if(gte(T,0.5),1,T/0.5)))'[b2v]; [3:v][2:v]blend=all_expr='A*(if(gte(T,0.5),1,T/0.5))+B*(1-(if(gte(T,0.5),1,T/0.5)))'[b3v]; [4:v][3:v]blend=all_expr='A*(if(gte(T,0.5),1,T/0.5))+B*(1-(if(gte(T,0.5),1,T/0.5)))'[b4v]; [0:v][b1v][1:v][b2v][2:v][b3v][3:v][b4v][4:v]concat=n=9:v=1:a=0,format=yuv420p,scale=480:270[vx]" -map "[vx]" -vsync 0 -c:v libx264 -crf 35 preview_270p.mp4


console output:
Code: Select all
ffmpeg version N-76539-g480bad7 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libblu
ray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --ena
ble-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --
enable-lzma --enable-decklink --enable-zlib
  libavutil      55.  5.100 / 55.  5.100
  libavcodec     57. 15.100 / 57. 15.100
  libavformat    57. 14.100 / 57. 14.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 15.100 /  6. 15.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
[tiff_pipe @ 0000000000165e40] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, tiff_pipe, from 'img01.tif':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: tiff, rgb24, 3840x2160 [SAR 1:1 DAR 16:9], 60 tbr, 60 tbn, 60 tbc
[tiff_pipe @ 00000000001781a0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #1, tiff_pipe, from 'img02.tif':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: tiff, rgb24, 3840x2160 [SAR 1:1 DAR 16:9], 60 tbr, 60 tbn, 60 tbc
[tiff_pipe @ 000000000018a440] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #2, tiff_pipe, from 'img03.tif':
  Duration: N/A, bitrate: N/A
    Stream #2:0: Video: tiff, rgb24, 3840x2160 [SAR 1:1 DAR 16:9], 60 tbr, 60 tbn, 60 tbc
[tiff_pipe @ 0000000000168ea0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #3, tiff_pipe, from 'img04.tif':
  Duration: N/A, bitrate: N/A
    Stream #3:0: Video: tiff, rgb24, 3840x2160 [SAR 1:1 DAR 16:9], 60 tbr, 60 tbn, 60 tbc
[tiff_pipe @ 0000000000169ee0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #4, tiff_pipe, from 'img05.tif':
  Duration: N/A, bitrate: N/A
    Stream #4:0: Video: tiff, rgb24, 3840x2160 [SAR 1:1 DAR 16:9], 60 tbr, 60 tbn, 60 tbc
[libx264 @ 0000000000179200] using SAR=1/1
[libx264 @ 0000000000179200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000000179200] profile High, level 3.0
[libx264 @ 0000000000179200] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=8 lookahead_threads=1 sliced_threads=0 nr=0 deci
mate=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_lookahe
ad=40 rc=crf mbtree=1 crf=35.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'preview.mp4':
  Metadata:
    encoder         : Lavf57.14.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 480x270 [SAR 1:1 DAR 16:9], q=-1--1, 60 fps, 15360 tbn, 60 tbc (default)
    Metadata:
      encoder         : Lavc57.15.100 libx264
Stream mapping:
  Stream #0:0 (tiff) -> blend:bottom
  Stream #0:0 (tiff) -> concat:in0:v0
  Stream #1:0 (tiff) -> blend:top
  Stream #1:0 (tiff) -> blend:bottom
  Stream #1:0 (tiff) -> concat:in2:v0
  Stream #2:0 (tiff) -> blend:top
  Stream #2:0 (tiff) -> blend:bottom
  Stream #2:0 (tiff) -> concat:in4:v0
  Stream #3:0 (tiff) -> blend:top
  Stream #3:0 (tiff) -> blend:bottom
  Stream #3:0 (tiff) -> concat:in6:v0
  Stream #4:0 (tiff) -> blend:top
  Stream #4:0 (tiff) -> concat:in8:v0
  scale -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame=  540 fps=3.0 q=-1.0 Lsize=      93kB time=00:00:08.96 bitrate=  85.0kbits/s
video:86kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.793149%
[libx264 @ 0000000000179200] frame I:3     Avg QP:29.88  size:  4453
[libx264 @ 0000000000179200] frame P:193   Avg QP:32.47  size:   342
[libx264 @ 0000000000179200] frame B:344   Avg QP:34.71  size:    24
[libx264 @ 0000000000179200] consecutive B-frames: 11.9%  8.9%  2.2% 77.0%
[libx264 @ 0000000000179200] mb I  I16..4: 20.7% 60.5% 18.9%
[libx264 @ 0000000000179200] mb P  I16..4:  2.0%  3.2%  0.1%  P16..4: 12.5%  0.8%  1.1%  0.0%  0.0%    skip:80.3%
[libx264 @ 0000000000179200] mb B  I16..4:  0.1%  0.0%  0.0%  B16..8:  2.3%  0.0%  0.0%  direct: 0.0%  skip:97.6%  L0:19.9% L1:78.7% BI: 1.3%
[libx264 @ 0000000000179200] 8x8 transform intra:59.5% inter:76.5%
[libx264 @ 0000000000179200] coded y,uvDC,uvAC intra: 13.9% 17.1% 4.4% inter: 1.9% 2.0% 0.1%
[libx264 @ 0000000000179200] i16 v,h,dc,p: 38% 36% 13% 13%
[libx264 @ 0000000000179200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 10% 61%  2%  2%  2%  3%  1%  2%
[libx264 @ 0000000000179200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 26% 18%  4%  5%  5%  6%  5%  6%
[libx264 @ 0000000000179200] i8c dc,h,v,p: 84%  9%  6%  1%
[libx264 @ 0000000000179200] Weighted P-Frames: Y:46.1% UV:34.7%
[libx264 @ 0000000000179200] ref P L0: 52.9% 12.9% 24.2%  6.0%  4.0%
[libx264 @ 0000000000179200] ref B L0: 69.2% 29.9%  0.9%
[libx264 @ 0000000000179200] ref B L1: 98.0%  2.0%
[libx264 @ 0000000000179200] kb/s:77.91



Bonus info: If I change the loop length of the input files from -t 1 to -t 0.5 I get an output file that is 270 frames. Each image is shown 30frames and each transition is 30sec, so that is actually working as expected!

However, if I change the loop length of the input files from -t 1 to -t 2 I get an output file that is 1080 frames. First image is shown correctly for 120 frames, but the next 4 images is shown 210 frames (should be 120). Each transition is 30sec (as expected).
jonathanj
 
Posts: 1
Joined: Fri Jan 23, 2015 1:18 pm

Re: Tip: Create a video slideshow from images

Postby llogan » Wed Jan 25, 2017 7:38 pm

I find it easier to use melt for transitions and for other NLE tasks. See http://superuser.com/a/834035/110524

I should do something about that crappy blend example in that link.
Get an answer more quickly by providing your actual ffmpeg command and the complete console output. Use the code button to format your command and output or your question will be ignored.
llogan
 
Posts: 2312
Joined: Fri Jan 25, 2013 9:47 pm
Location: Alaska

Previous

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest