Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to extract frames from a variable framerate video every 5 seconds and get the exact timestamps of each frame extracted. This is what I have so so far:

-i inputfile -vstats_file vstats.log  -vsync 2 -vcodec png -r 0.2 -f image2pipe -

And this is what I get:

frame=     1 q= 0.0 f_size= 136261 s_size=      133kB **time= 5.000** br=   218.0kbits/s avg_br=   218.0kbits/s type= I
frame=     2 q= 0.0 f_size= 139382 s_size=      269kB **time= 10.000** br=   223.0kbits/s avg_br=   220.5kbits/s type= I
frame=     3 q= 0.0 f_size= 141631 s_size=      407kB **time= 15.000** br=   226.6kbits/s avg_br=   222.5kbits/s type= I

I need the exact timestamp of the frame that was used for extraction, so I can later accurately cut the video based on thumbnails generated.

Also, is there a way to print vstats to stdout rather than a file?

share|improve this question
    
non-ffmpeg solutions are fine too, as long as it's a command-line tool. –  Mango Jun 7 '12 at 15:10

1 Answer 1

up vote 1 down vote accepted

i'm not sure what you tried to do, but if it works for you then it's ok...

Anyway, for skipping frames I would have use SELECT video filter (make sure you have libavfilter enable). For frames infoI would have used SHOWINFO video filter.

Your command should be something like the following:

ffmpeg -i inputfile -vf '[in]select=not(mod(n\,150))[s1];[s1]showinfo[out]' -vcodec mpeg2video outputfile

(where 150 frames are 5sec * 30fps)

share|improve this answer
1  
showinfo is exactly what I needed, thanks. By the way, for a variable framerate video I used select='isnan(prev_selected_t)+gte(t-prev_selected_t,5)' to get a frame every 5 seconds. –  Mango Jun 12 '12 at 17:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.