Convert between framerates (24 fps, 25 fps, 30 fps, …)
Published on March 17, 2010 in Workflow. 5 Comments Tags: ffmpeg, opensource.
The 5D originally only shot in 30 fps (NTSC-inspired, undoubtedly, since it was meant for USA news agencies anyway). So when the footage was to be used for TV (PAL in Europe = 25 fps) or for cinema (24 fps), it had to be converted. Also, when you shoot in 720p60 (at 60 fps) so that you can make a nice slow motion effect, you have to ‘convert’ your material. We already referred to an article about how to ‘conform with Cinema Tools/FinalCutPro‘. But let’s talk some more about this conversion and how to do it with a free open-source tool like ffmpeg.
1. Conversion with fixed # of frames.
This is what is referred to as ‘conforming‘. You keep the same number of frames, so a 20 second long 30 fps clip (20 x 30 = 600 frames) becomes 25 seconds at 24 fps. The same number of frames are played at a slower speed. The only thing you have to do for the video is to change the metadata of your clip. The audio will have to be played slower too, so will sound lower. If you want to fix this, you have to pitch this up (with audacity or sox).
How to do this with ffmpeg? Well, in two steps:
#extract the frames as rawvideo ffmpeg -i input.mov -f rawvideo -b 50000000 -pix_fmt yuv420p -vcodec rawvideo -s 1920x1080 -y temp.raw #recreate the video with new framerate ffmpeg -f rawvideo -b 50000000 -pix_fmt yuv420p -r 24 -s 1920x1080 -i temp.raw -y output.mov #To save on needed intermediate disk space, you could send the output of the first to stdout and pipe it to the input of the second
2. Conversion with fixed running length.
This method keeps the total length, but in order to do so, it has to interpolate (estimate frames that are between 2 original frames) . In other words, for each second you get 30 input frames and you need to create e.g. 24 output frames. Output frame 3 of that second will be created out of input frames 3 and 4, combined in some way. If this interpolation is done with a low quality/fast algorithm, any steady smooth movement in the input movie, might become jerky and unnatural. Therefor this procedure will be slow (might be slower than real time – you’ll need more than 1 hour of conversion time for each hour of footage) The audio will remain untouched, since the total length does not change.
How to do this with ffmpeg? Easy:
#convert framerate in one step: ffmpeg -i input.mov -sameq -r 24 -y output.mov
Unfortunately, this is quite slow AND low quality. So you might want to look at tools like FinalCutPro to do this kind of conversion. Also, MVtools (AVIsynth) seems to be able to do this better, I still have to check that out.