Removing exact frames 🔗
Video is composed of too many images, images come and go. We call each of those images a frame. So, if the video plays 30 images in time of a second, we call it is 30 frame-per-second video. We recording videos, there are some scenes with less motion which makes two or more adjacent frames (images) exactly the same. So we can compress those two identical images as one image, and reduce the total size of the video.
We can accomplish removing exact frames from a video via too many tools/programs available online. In this blog post, we’ll use ffmpeg command line tool to remove exact frames from videos.
Force 24 FPS Video 🔗
We know that any video consists of some number of frames/images shown each second. So, we can remove redundant frames which human eye barely sees. 24 frames per second is pretty good as it is used in cinema movies.
We’ll use ffmpeg command line tool to force 24 fps and get rid of extra redundant images in the video.
Test Cases 🔗
We have too cases to apply the compression on.
1st case: online distributed movie 🔗
I have an online distributed movie downloaded as MP4 video file. So it is compressed and optimized by the film industry and/or online distribution company.
2nd case: screencast video 🔗
I recorded the screen of my laptop using Screenshot.app Apple native application on Mac OS. The video file is saved as MOV file. So, this video file is not compressed.
what I did 🔗
I used this ffmpeg command to force the video to be 24 fps:
ffmpeg -i input.mov -filter:v fps=fps=24 output.mp4
And I used this ffmpeg command to remove exact frames from the video:
ffmpeg -i input.mov -vf mpdecimate,setpts=N/FRAME_RATE/TB output.mp4
And I used this ffmpeg command to compress the video:
ffmpeg -i input.mov -vcodec h264 -acodec aac output.mp4
And I used this ffmpeg command to heavily compress the video:
ffmpeg -i input.mov -c:v libx265 -preset veryfast -tag:v hvc1 -vf format=yuv420p -c:a copy output.mp4
And these are the results.
Compression Results 🔗
|removed exact frames
|online distributed movie
|screen recorded video
From the statistics in the above table, we know that trying to compress pre-compressed video files is a horrible task. Online distributed movies are well-optimized and compressed, so do not try to re-compress it as you will not succeed in the task.
From statistics too, you should use any method of lossless or lossy compression for recorded videos because you’ll accomplish a very good results and consume very little space in your storage media . I suggest forcing a 24fps video as a compression method. The 24fps video is really good for eyes and storage space at the same time.
Read More: Free up Space on Mac OS