[FFmpeg-user] Average a "rolling" N frames?

Steven Kan steven at kan.org
Fri Apr 22 07:28:21 EEST 2022


> On Apr 21, 2022, at 12:03 AM, Paul B Mahol <onemda at gmail.com> wrote:
> 
> On Thu, Apr 21, 2022 at 7:03 AM Steven Kan <steven at kan.org> wrote:
> 
>> I’m putting together a time-lapse video of bees building comb in the hive.
>> I have 5,000+ jpgs (and growing!) in a directory that I process with:
>> 
>> ffmpeg -hwaccel videotoolbox -framerate 60 -pattern_type glob -i '*.jpg'
>> -c:v h264_videotoolbox -b:v 100M CombLapse.mp4
>> 
>> which results in:
>> 
>> https://www.youtube.com/watch?v=CvGAHWVcbwY
>> 
>> Someone suggested that I try to “remove the bees” and get video of just
>> the comb. Which got me thinking, what if I could do a rolling average of,
>> say, 100 frames? So frame 1 of my output would be the average of frames 1 -
>> 100, and frame 2 of my output would be the average of frames 2 - 101, etc.
>> 
>> I’ve used -vf tmix=frames=10:weights=“1” to take 10 frames of input and
>> output 1 frame, but what syntax could I use to do a rolling average?
> 
> 
> tmix by default does rolling average if you use no other filters.

LOL; thanks! I should have RTFM before posting. Anyway, the results are amazing. For your esteemed review, here is the result of tmix:

1) The original with 1 frame per frame:

https://www.youtube.com/watch?v=CvGAHWVcbwY

2) The result of a 10-frame rolling average, tmix=frames=10:weights="1":

https://www.youtube.com/watch?v=2dUGbGcGE2c

2) The result of a 50-frame rolling average, tmix=frames=50:weights="1":

https://www.youtube.com/watch?v=aiBw7rAVC7k

Besides the surreal visuals, the other benefit is that it’s not really affected by YT's “compression crush,” since the bees are reduced to ghosts anway, and the comb is pretty much static.

Which is the most visually compelling?


More information about the ffmpeg-user mailing list