[FFmpeg-user] Extract Images from video and rebuild video with these image
barsnick at gmx.net
Sat Mar 7 21:04:05 CET 2015
On Thu, Mar 05, 2015 at 15:02:05 -0800, dreamer92 wrote:
> first step : i extract images from a little video (duration : 1 minute and 4
> seconds ) :
> ffmpeg -i C:\test\video.mp4 -r 30 -s 640x360 -f image2 C:\test\foo-%05d.jpeg
> second step : i want to rebuild the initial video with these extracted
> images with same parameters:
> ffmpeg -f image2 -i C:\test\foo-%05d.jpeg -r 30-s 640x360 C:\test\final.mp4
On this list, you're supposed to show us the complete, uncut console
output from your commands in addition to the command lines. In this
case, it would have helped to point out the obvious (because the output
would show your issue and help you solve it).
> Special result : Initial video (video.mp4) duration was 1 minute and 4
> seconds and new video generated (final.mp4) duration is 1 minute and 17
> secondes : the new video is longer and the new film seems slightly slower
> than the initial video.
You extract the frames at a rate of 30 fps. You don't tell ffmpeg so
when re-muxing, so it assumes 25 fps:
> Set the frame rate for the video stream. It defaults to 25.
Then, you let ffmpeg convert the video to 30 fps.
So what happens is that you extract 64 seconds worth of images at 30
fps, but interpret them at 25 fps, stretching the video to 30/25*64 =
77 seconds, which is 1 minute 17 seconds (interpolated back to 30 fps
To solve this, provide the correct frame rate in the second command,
i.e. "-framerate 30" before the "-i".
> My question : Is it possible to get exactly the same film like initial (same
> duration , same speed) rebuilding the video from its exctrated images ?
BTW, IMHO, you're lost if your input video is VFR, as you lose all
information about frame timing. An average frame rate may be okay for
you, but YMMV.
More information about the ffmpeg-user