ffmpeg for slideshow generation

December 6, 2021

I wanted to use ffmpeg to create a slideshow of the awards in a camera club competition.

Given the jpgs in a folder, the following command can do this:

ffmpeg \
-loop 1 -t 5 -i Common_dolphin.jpg \
-loop 1 -t 5 -i Juvenile_long_eared_owl_defending_its_prey.jpg \
-loop 1 -t 5 -i bee_collecting_nectar.jpg \
-loop 1 -t 5 -i Orang_Utan.jpg \
-loop 1 -t 5 -i Mating_damselflies.jpg \
-loop 1 -t 5 -i Great_Crested_Grebe_with_fish.jpg \
-loop 1 -t 5 -i necked_Grebes_feeding_young.jpg \
-loop 1 -t 5 -i eared_Owl_hunting_on_Uist.jpg \
-loop 1 -t 5 -i Kestrels_with_youngster_calling_for_food.jpg \
-loop 1 -t 5 -i Sparrowhawk_nest_female_and_chicks.jpg \
-loop 1 -t 5 -i Barn_Owl_Hunting.jpg \
-loop 1 -t 5 -i Hedgehog_in_Leaves.jpg \
-filter_complex \
"[0:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=out:st=4:d=1[v0]; \
   [v0]drawtext=text='Common Dolphin':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v0]; \
   [v0]drawtext=text='Commended':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v0]; \
 [1:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v1];
   [v1]drawtext=text='Juvenile Long Eared Owl Defending it´s Prey':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v1]; \
   [v1]drawtext=text='Commended':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v1]; \
 [2:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v2]; \
   [v2]drawtext=text='Bee Collecting Nectar':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v2]; \
   [v2]drawtext=text='Commended':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v2]; \
 [3:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v3]; \
   [v3]drawtext=text=' Orang Utan':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v3]; \
   [v3]drawtext=text='Highly Commended':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v3]; \
 [4:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v4]; \
   [v4]drawtext=text='Mating Damselflies':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v4]; \
   [v4]drawtext=text='Second Place':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v4]; \
 [5:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v5]; \
   [v5]drawtext=text=Great Crested Grebe with fish':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v5]; \
   [v5]drawtext=text='Commended':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v5]; \
 [6:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v6]; \
   [v6]drawtext=text='Black Necked Grebes Feeding Young':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v6]; \
   [v6]drawtext=text='Third Place':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v6]; \
 [7:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v7]; \
   [v7]drawtext=text='Short-Eared Owl Hunting On Uist':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v7]; \
   [v7]drawtext=text='Highly Commended':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v7]; \
 [8:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v8]; \
   [v8]drawtext=text='Kestrels with Youngster Calling For Food':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v8]; \
   [v8]drawtext=text='First Place':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v8]; \
 [9:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v9]; \
   [v9]drawtext=text='Sparrowhawk Nest Female and Chicks':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v9]; \
   [v9]drawtext=text='Highly Commended':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v9]; \
 [10:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v10]; \
   [v10]drawtext=text='Barn Owls Hunting':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v10]; \
   [v10]drawtext=text='Highly Commended':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v10]; \
 [11:v]scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v11]; \
   [v11]drawtext=text='Hedgehog in Leaves':x=((w-text_w)/2):y=(h-text_h-30):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v11]; \
   [v11]drawtext=text='Commended':x=((w-text_w)/2):y=(h-text_h-80):fontfile=LiberationSans-Regular.ttf:fontsize=40:fontcolor=white:borderw=4:bordercolor=black[v11]; \
 [v0][v1][v2][v3][v4][v5][v6][v7][v8][v9][v10][v11]concat=n=12:v=1:a=0,format=yuv420p[v]" \
-map "[v]" output.mp4

Tags: ffmpeg