Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FFMPEG - How to Extract Frames As Images While Removing Sequentially Duplicate Frames

Is there any way (via script or preferably some parameter in calling ffmpeg that I missed) to extract frames from an avi file and ignore sequentially duplicate frames, thus being able to go through the pictures looking only at the deltas/changes?

I frequently have to record meetings at work and a lot of the time, the client screen that I am looking at is not changing while we are talking over the phone. After the meeting is over, I need to use these images as part of our documentation and specifications gathering.

I know that I could just output every frame and run them through any given duplicate file remover utility, but this would remove ALL duplicate frames. So, if the frames extracted went like this:

A, A, A, B, B, B, B, C, C, A, A, C, C, C, B, B, B ...

Running them through a typical duplicate file remover, I would get: A, B, C

What I would want is: A, B, C, A, C, B

The command that I am currently using to extract the images is:

ffmpeg.exe -i file.avi -ss 0 -sameq -f image2 -r 1 images%5d.png

I was getting every frame beforehand (removing the -r 1 from above), but that was generating way too many frames to deal with since these online meetings can go for hours, so for now, I get one frame per second from the file.

A Windows based solution would be preferable, however, I'm sure other people would be interested in solutions on other platforms if available.

Any solution or point in the right direction is much appreciated.

like image 937
Michael Nelson Avatar asked Aug 10 '12 15:08

Michael Nelson


People also ask

How do I extract one frame of a video every second seconds into a photo?

Just use "Decimate By" option located at Video -> Frame Rate menu. For example if you set "Decimate By 100" then use File -> Export -> Image sequence, it will save only every 100th frame. Highly active question.


2 Answers

Did you try with the -vsync 0 option?

like image 59
npinto Avatar answered Nov 15 '22 09:11

npinto


After running ffmpeg, run a duplicate file finder.

Linux: fdupes -N -d *.png (http://code.google.com/p/fdupes/).

For dozens of similar tools, for Windows etc., see http://en.wikipedia.org/wiki/List_of_duplicate_file_finders .

like image 27
Camille Goudeseune Avatar answered Nov 15 '22 09:11

Camille Goudeseune