shuffleframes reorders frames in fixed-size groups following a map. Here each group of 58 output frames alternates between input frame 0 and frames 1–29, so the picture keeps snapping back to the same "anchor" frame while it moves forward: a strobing, looping stutter.
A shorter map (0 1 0 2 … 0 8) gives a faster cycle.
The command
ffmpeg -framerate 29.97 -i frames/f%05d.jpg \
-vf "scale=1280:720:force_original_aspect_ratio=increase,crop=1280:720:(in_w-out_w)/2:(in_h-out_h)/2+200,format=gbrp,shuffleframes=0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29" \
-t 10 \
-an \
-c:v libx264 -preset ultrafast -crf 40 -pix_fmt yuv420p \
output.mp4 What each part does
-framerate 29.97 -i frames/f%05d.jpg
scale=…,crop=1280:720:(in_w-out_w)/2:(in_h-out_h)/2+200
fill 1280×720, crop 200 px below center
format=gbrp planar RGB
shuffleframes=0 1 0 2 0 3 … 0 29
output frame i of each group = input frame map[i]
-t 10 -an -c:v libx264 -preset ultrafast -crf 40 -pix_fmt yuv420p
quick draft encode (use -crf 18 for a final render) When to use it
Use this when you want a hard, rhythmic strobe: the picture keeps snapping back to one anchor frame while the action moves forward underneath it. It works best on footage with clear motion, so the jumps read as a stutter rather than as flicker. It is not the right choice for smooth slow motion or for a gentle loop. The header explains each flag.
Useful variations:
- Shorten the map to
0 1 0 2 … 0 8for a faster, tighter cycle. The header suggests this. - Change
-t 10for a longer or shorter clip, and change-framerate 29.97to match your source. - Switch
-crf 40to-crf 18for a final render.
If the output looks wrong, first check that frames/f%05d.jpg matches your actual file names. If the subject is cut off, adjust the +200 crop offset or the 1280:720 size. If motion seems to skip between cycles, that is the map at work. It has 58 entries but only uses frames 0–29 of each group.
Notes
- Source
- ffmpeg-utilities/faces-ffmpeg.sh (the face-order commands)
- Changed
- -r → -framerate for the image input; -filter_complex → -vf; -vcodec → -c:v