Take the 2-minute tour ×
Video Production Stack Exchange is a question and answer site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation. It's 100% free, no registration required.

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?

share|improve this question
    
have you tried it without -force_key_frames 0? Also might want to try changing the 0 to a 1 to have it start on the first frame instead -force_key_frames 1 –  Travis Dtfsu Crum Oct 3 '12 at 14:36
    
yes, i tried without -force_key_frames 0 and with -force_key_frames 1, but that didn't help. I'm pretty stuck. –  bodacydo Oct 3 '12 at 18:19
    
is doing it exactly this way required? I'm going to take a wild guess and assume the following: the audio is the focus of the video. The image isn't a huge concern. Sooo couldn't you extract an mp3 from the video (lossless quality of course) and then, acquire the image, maybe even a screenshot if you're that desperate, then create a new video in ffmpeg using the extracted mp3 and image with the fps set to 1? –  Travis Dtfsu Crum Oct 3 '12 at 20:06
    
The force_key_frames syntax for using the frame number is -force_key_frames "expr:eq(n,0)" –  robd Jul 28 '13 at 21:08
add comment

1 Answer

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

share|improve this answer
    
What does this do exactly? –  Warrior Bob Nov 14 '12 at 22:32
    
it will force position the keyframe at 00:00:00.000 time code, which was asked with the original request. –  Maxim Nov 14 '12 at 23:58
add comment

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.