FORUMS: list search recent posts

extracting key frames with ffmpeg

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Tatiana Solano
extracting key frames with ffmpeg
on Jun 25, 2012 at 2:50:37 pm

Hi to everyone, I'm trying to work with ffmpeg to extract the key frames from a video, and in the documentation it is suggest to use:

ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png

or in case that you want to get just the I-frame, the next line:

select='eq(pict_type\,I)'

I have tried with both and others, but it doesn't work a lot, I want to ask if there is someone that knows how to extract the key frames of a video with ffmpeg, or someone who can explain me how to use it.

Thanks


Return to posts index

Reuben Martin
Re: extracting key frames with ffmpeg
on Jun 26, 2012 at 2:24:04 am

Be aware that the filter functionality has been undergoing a lot of development, so the features and syntax are changing quite a bit between versions. Hence the syntax used is very sensitive to the version being used. The online documentation you grabbed that example from very well may not be for the version you are using.


This will extract I frames for me (ffmpeg version 0.10.3)

ffmpeg -i MyFile.foo -vf select="eq(pict_type,I)" -vsync 0 -an keyframes%03d.png

Also, if you are trying to do this in windows it will suck due to it crappy handling of quotes and escaping.


Return to posts index

Tatiana Solano
Re: extracting key frames with ffmpeg
on Jun 26, 2012 at 1:53:43 pm

Thanks for your answer, I have been checking in some other places and you're right, the good thing is that I finally found the way to do it on my version that I'm working on windows. My version is: ffmpeg version N-37208-g01fcbdf built on Jan 27 2012 18:34:52 with gcc 4.6.2 and the comand line:

ffmpeg -vf select="eq(pict_type\,PICT_TYPE_I)" -i flujo.avi -vsync 2 -s 320x240 -f image2 -vframes 20 thumb-%02d.png

That works perfectly for me, and I'm also getting just a number of the frames cause I don't want it all of them, but now I want to modify one or two of them (this isn't the problem) and return them to the video, something like overwrite the key frames, but I haven't found anything. Do you have any idea?

Best Regards


Return to posts index


Reuben Martin
Re: extracting key frames with ffmpeg
on Jun 26, 2012 at 2:49:08 pm

This would not be a good idea (and isn't possible using ffmpeg that I am aware of). P and B frames all reference the I frames, so modifying the I frames and swapping them out will screw up all the other frames referencing them.


Return to posts index

Tomás Hernández
Re: extracting key frames with ffmpeg
on Aug 26, 2012 at 1:39:02 am

Hi. I actually read your post, and I suggest trying this:
ffmpeg.exe -i "INPUT_VIDEO_FILE.flv or any" -y -f image2 -ss 191 -sameq -t 0.001 -s 126*95 "OUTPUT_FILE_NAME.jpg"


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]