meta data for this page

Process for compression and stablilization of a mp4

Sometimes videos made from a smartphone needs to be stabilized and compressed to be ready to archive.

There are three steps needed, first install ffmpeg, then bring mp4 video in a proper format and generate stabilized video.

Install needed packages

~# apt-get install ffmpeg

Change format

guest:~$ ffmpeg -i input.mp4 -vcodec libx264 -crf 20 intermediate.mp4

This creates an output video which is larger (!) than the input but it is suitable for removing camera shake by ffmpeg.

Generate stabilized video

After that the intermediate output must be transformed in a stabilized video by ffmpeg:

guest:~$ ffmpeg -i intermediate.mp4 -vf deshake STABLEVIDEO.mp4

The resulting video is stored in STABLEVIDEO.mp4.