Reputation: 13
Say I have 5 images that are quite similar. I'd like to compress images 2, 3, 4 and 5 based on the first image, somewhat similar to the way P frames are generated from an I frame.
Edit: Although similar, I am not looking for simply generating a diff between the two images. My goal is to somehow use the information in the first image to make the consecutive images much smaller. If I simply do a diff, the diff itself is about the same size (about 10% reduced) which is not as much as I expect. If I generate a mp4 video including these 5 frames, the video size is much less than putting 5 frames in a file, which probably has to with frame predications based on the I frames. Is there a way to generate those predicted frames one by one and store them individually?
Upvotes: 0
Views: 1449
Reputation: 92928
Here's the basic syntax:
Let's say I.png
is your base frame and P1.png
is the frame which you wish to reduce to its difference from I.png
Then
ffmpeg -i P1.png -i I.png -lavfi blend=all_expr='A-B' D1.png
produces the difference frame D1.png
.
To reconstruct P1 from I and D1, run
ffmpeg -i D1.png -i I.png -lavfi blend=all_expr='A+B' P1-r.png
PI-r.png
will be identical to P1.png
.
Upvotes: 1