How to stabilize video with Kdenlive?
Solution 1:
To stabilize a specific video file I import the file into kdenlive, right-click on it, select "clip jobs" and then "stabilize".
This will start a "job" which produces a file with .mpi appended to the end of the original video file name.
Then remove the original video from the project file list, add the .mpi video file, put that in the timeline and render it.
The problem is that this .mpi file will only work in the project environment in which it was created. It also takes a lot more time than the length of the original video because the processing is single-threaded. Then there are possible memory issues with large files. So creating a large video and then stabilizing it is a very time and memory-intensive process, requiring at least as much memory and swap-space and multiples of the time required to create that large video in kdenlive without stabilizing it. It's a good argument for an IS video camera or at least breaking the unstabilized final product into chunks and stabilizing the chunks in groups which will not require use of the swap file, then combining all the stabilized chunks into one final project and rendering it.
Then there is the effectiveness of the stabilization pass...kdenlive gives you a lot of options to play with, all affect speed, memory requirements, IQ and stabilization. Or you can try using the ffmpeg tools directly which requires a new level of understanding and effort...but at least it's possible.
Deshaking videos using script
in any case it will help immensely to do this at low-res and figure it all out before trying to do it on unstabilized files straight from the camera shot at high resolutions especially at high frame-rates. My 4Gig laptop just spent 5 days stabilizing a 30min 5GB 4k-30fps h265 mp4 video. Now I'm trying to figure out how best to render the .mpi file. I'm considering just rendering the final product at 720p or at least at 1080p. It took 8 hrs or so to render the original unstabilized 5GB 4k product at moderate IQ and encoding settings that was a mixture of 12MP stills and 1080p video...and that was for 30 minutes of 4k video. My fear is that trying to render a final product at 4k is going to ask too much of the 4GB ram + 1GB swap that I have currently and it simply has to be done at 1080p to match the original video components. So I'll try that first and update this later.