[FFmpeg-user] Force first frame to be full, non blurred I frame

Sergey Kurdakov sergey.forum at gmail.com
Thu May 5 00:50:50 CEST 2011


I develop silverlight application which can play h264 files which I produce
with ffmpeg from recorded avi s,
still, due to used underlying MediaElement ( which I would prefer not to
force to move to some better pos for still image ) the first (still) frame
shows blurry,

I found that it is possible to set force_key_frames and I do following

ffmpeg -i input.avi   -an  -vcodec libx264 -vpre veryslow -r 30 -b 400k
-force_key_frames 0  -threads 0  OUTPUT.mp4

(actually two passes
ffmpeg -i input.avi -an -pass 1  -vcodec libx264 -vpre veryslow_firstpass -r
30 -b 400k  -force_key_frames 0 -threads 0 OUTPUT.mp4
ffmpeg -i input.avi  -an -pass 2 -vcodec libx264 -vpre veryslow -r 30 -b
400k -force_key_frames 0  -threads 0    OUTPUT.mp4 )

but still I get blurry first frame (-force_key_frames -1 also does not give
needed result )   ,

so the question is - which number (time) to set to -force_key_frames ( or
set some other param )  so that first frame ( or first frames ) was non
blurry I-frame   ( otherwise video quality is excellent - but exactly the
first frame is really  blurry.

Some hints - opening resulting video in avidemux shows that the first frame
in sequence is B frame then followed by P frame and then 3rd frame is my
first blurry I frame - though avidemux might be wrong, still it could
indicate a problem that B frame affects what I get as resulting I frame).


More information about the ffmpeg-user mailing list