How to force ffmpeg to insert keyframe at first frame when downsampling a framerate of a video with x264 vcodec I have a mpeg4 video at 25fps. This video contains just one static frame. I'm trying to downsample the frame rate to 1fps and convert the video to x246 (mp4).

I ran the following ffmpeg command:

ffmpeg -i vid.avi -acodec aac -ar 32000 -ab 64k -ac 2 \
-vcodec libx264 -strict -2 -y -r 1 -force_key_frames 0 vid.mp4


FFmpeg then drops a lot of frames until it inserts the first keyframe. Sometimes image appears only after 16 or 20 seconds.

I gather ffmpeg doesn't insert a keyframe at very beginning.

Does anyone know how could I take the first frame of vid.avi and use it as the key frame for vid.mp4?
To force a keyframe at the 00:00:00.000 time code, you should try using the following flag:

-force_key_frames 00:00:00.000