0

I have frames extracted from video with 24 fps (I used ffmpeg), now I need to glue them back with the same frame rate.

2
  • What ffmpeg version are you using?
    – dma_k
    Oct 4, 2018 at 22:16
  • @dma_k 4.2.4 currently.
    – R S
    Nov 9, 2020 at 3:12

1 Answer 1

1

Input and output using same frame rate

Use the -framerate input option:

ffmpeg -framerate 24 -i input_%03d.png output.foo
  • Default is -framerate 25. The output will use the same frame rate as the input.

  • This example assumes each input is sequentially named input_001.png, input_002.png, etc.

  • See the FFmpeg image file demuxer documentation for more details.

Input and output using different frame rate

If you want to show each image for a certain amount of time, but have a standard output frame rate for compatibility you can add the -r output option and frames will be dropped or duplicated to compensate. In the following example each image will be shown for 1 second, but the output will have a frame rate of 24. Without -r many players would not be able to play a video with a frame rate of 1.

ffmpeg -framerate 1 -i input_%03d.png -r 24 output.foo
3
  • With the command you provided, mediainfo output.foo should show 24 fps? In my case it shows 1 fps. I've tried ffmpeg -framerate 1 -i image_%d.png -r 25 -vcodec libx264 out.mkv and ffmpeg -r 1 -i image_%d.png -r 25 -vcodec libx264 out.mkv and those both produce the same MKV with 1 fps (no image duplication). What should be on output if images are duplicated? Sample of output video generated by ffmpeg v3.2.10.
    – dma_k
    Oct 3, 2018 at 23:58
  • 1
    @dma_k For MKV add -vsync cfr output option, or replace -r 25 with -vf fps=25, or leave file as is if it works fine.
    – llogan
    Oct 4, 2018 at 23:34
  • Many thanks, -vf fps=25 has solved the problem.
    – dma_k
    Oct 6, 2018 at 6:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .