Hacker News new | ask | show | jobs
by mrdonbrown 1474 days ago
Shotcut has this one cool feature [1] - drop a bunch of pictures into it and it'll create an animated slide show automatically. I've looked for ways to automate that via something like ffmpeg, but haven't found any better options.

[1] https://forum.shotcut.org/t/slideshow-generator/19162

3 comments

So basically this[0] with a crossfade[1] between frames? Which would be (by stitching examples together)

  ffmpeg -framerate 1/5 -pattern_type glob -i '\*.jpg' -pix_fmt yuv420p -filter_complex xfade=transition=fade:duration=2:offset=2 out.mp4
(1 jpg image per 5 seconds with a 2 seconds crossfade in between)

[0] https://trac.ffmpeg.org/wiki/Slideshow

[1] https://ffmpeg.org/ffmpeg-filters.html#xfade (only available in >4.3)

I was just about to write that exact same command from my flawless recollection of stitching examples together from that wiki! But you beat me to it.

Honestly, I'd love a podcast called "Quinecast" where each episode consists of hosts talking in detail about the ffmpeg flags that were used to create the podcast.

Yeah, although I'd be surprised if this isn't what Shotcut does (it uses ffmpeg).
ffmpeg has an entire page in their wiki devoted to slideshows: https://trac.ffmpeg.org/wiki/Slideshow
There is so much value in doing this in a normal application with a UI that lets you see what you're doing. ffmpeg is a fantastic utility if you already know what you need, but it's absolutely terrible for jobs where you need to be able to see and do things between the two states of "having input" and "having final output".
I agree, although it has to be noted that that you can preview most ffmpeg commands using ffplay. The syntax is the same as the ffmpeg command, without the final output filename obviously.
Right, but now we're going "replace this single app with a normal graphical interface for working with visual media with multiple command line utilities including the terminal that you're always going to have to look up the commands flags for" and that's not really selling it =P
Ffmpeg is a great tool for programmatically editing videos. For one-off jobs a gui editor is probably better.

If you want to create a slideshow for 300 folders of images, ffmpeg is really your best friend. For one, maybe use a gui editor.

Where I found that fell down was wanting to do things like slow zooms and interesting transitions. I'd love something like a Python or bash script to tweak that addressed those.
Like this?

Zoom in up to 1.5x and pan always at center of picture (not tested):

  import ffmpeg
  (
    ffmpeg
    .input(
        '\*.jpg', 
        pattern_type='glob', 
        framerate='1/5'
    )
    .zoompan(
        z='min(zoom+0.0015,1.5)', 
        d=700,
        x='in_w/2-(in_w/zoom/2)',
        y='in_h/2-(in_h/zoom/2)'
    )
    .output('output.mp4', pix_fmt='yuv420p')
    .run()
  )
stitching [0], [1], and [2]

[0]https://github.com/kkroening/ffmpeg-python#quickstart

[1]https://kkroening.github.io/ffmpeg-python/#ffmpeg.zoompan

[2]https://ffmpeg.org/ffmpeg-filters.html#Examples-133

EDIT: added options for slideshow style

Nice! I think iMovie does this, but I usually use https://www.photofilmstrip.org/en
Apple Photos does it as well.