0
votes

I would like ffmpeg to do the following:

  • read an input mp4 (-i movie.mp4)
  • skip the first 5 seconds (-ss 5)
  • find scene changes and display the frame numbers (-vf "select=gt(scene\, 0.4, showinfo))
  • output #1 - a gif file (output.gif)
  • output #2 - a contact sheet with all the thumbnails (-vf "select scale=320:-1, tile=12x200" thumbnails.png)

This will generate the thumbnails:

ffmpeg -hide_banner -i d:/Test/movie01.mp4 -ss 5 -vf "select=gt(scene\,0.4), showinfo, scale=320:-1, tile=12x200" -vsync 0 thumbnails%03d.png

this will generate the gif:

ffmpeg -hide_banner -i d:/Test/movie01.mp4 -ss 5 -vf "select='not(mod(n,60))',setpts='N/(30*TB)', scale=320:-1" -vsync 0 output.gif

I would like to do both at once with 2 more features:

  • set fps and resolution for the gif; I would like the gif to represent the whole movie in X seconds, at Y fps (I know the duration of the input movie so I can calculate how often a frame needs to be captured)

  • set the width only for the thumbnail picture (tile=12 for example) and let ffmpeg determine the appropriate height

I have tried to compose a command line from what I read on this page: https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs, using the split / map commands but I couldn't get it to work

1

1 Answers

2
votes

Use

ffmpeg -ss 5 -i input.mp4
-vf "select='not(mod(n,60))',setpts=N/Y/TB',scale=320:-1" -r Y output.gif
-vf "select='gt(scene\,0.4)',showinfo,scale=320:-1,tile=12x200" -vsync 0 thumbnails%03d.png

tile requires both W and H to be set.