Answer the question
In order to leave comments, you need to log in
How to make motion blur effect in ffmpeg?
There are pictures-frames of some animation with a frequency of 60 fps. The output needs a gif with 20 fps.
ffmpeg ... -r 20 or ffmpeg ... -vf fps=20 or the new minterpolate filter all just throw away extra frames.
Is there a way specifically for ffmpeg to generate frames by overlaying one previous and one next with 33% or 25% transparency?
Answer the question
In order to leave comments, you need to log in
The updated ffmpeg, starting from version 4.1, has a new video filter tmix - it mixes N neighboring frames.
To create a motion blur effect, you can render the animation at a frame rate N times higher, blend N adjacent frames, and reduce the frame rate back N times by simply throwing out extra frames.
let WIDTH=640
let HEIGHT=480
let MID=$WIDTH/2
let BUFFER=16
let FRAMERATE=30
let XRATE=$BUFFER\*$FRAMERATE
let DURATION=8
let FPERIOD=$XRATE\*$DURATION
ffmpeg \
-filter_complex \
" \
color=white:${WIDTH}x${HEIGHT}:d=$DURATION:r=$XRATE,format=rgb24[bg]; \
color=black:8x${HEIGHT}:d=$DURATION:r=$XRATE,format=rgb24[bar]; \
[bg][bar]overlay=x='$MID + $MID * sin(8 * PI * n / $FPERIOD)':y=0:format=yuv444,format=yuv420p[motion]; \
[motion]tmix=frames=$BUFFER \
" \
-c:v libx264 \
-r $FRAMERATE \
-an \
-hide_banner \
-y \
output.mp4
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question