Ade Malsasa Akbar contact
Senior author, Open Source enthusiast.
Tuesday, October 10, 2023 at 23:00

In this tutorial, we want to share with you one method we use to convert OBS Studio's video recording in MKV format into MP4 with very good compression (by almost 50% reduced file size) but by keeping the quality acceptable for students to watch at home. Let's read the tips below.


Subscribe to UbuntuBuzz Telegram Channel to get article updates.

 

Background

In Indonesia we (Ade Malsasa Akbar) established a computer course named Teknoplasma and effectively since this year 2023 we record every session using OBS Studio and they always resulted in MKV format. In general, MKV videos we produce are huge in MegaByte size. If we record everything everyday, our storage will be full in no time and nothing left to store files other than videos. For that reason, we use FFMPEG to convert and compress every video into MP4 but with acceptable quality for uploading to Telegram and watched by the students. We managed to do that. We want to share with you our experience.


Basic

The basic of FFMPEG is as the following:

$ ffmpeg -i input.mkv output.mp4

That command line will convert an MKV video into MP4. 

 

Conversion

We use command line as the following to convert every one of our MKV videos: 

$ ffmpeg -y -i input.mkv -filter:v fps=fps=10 -vcodec libx265 -acodec aac -preset ultrafast -crf 28 output.mp4

 

Where:

ffmpeg means the command. 

-y means assume yes to answer every question.

-i input.mkv means specifying what video file to be converted.

-filter:v means enabling video filters.

fps=fps=10 means adjust frame per second to 10.

-vcodec libx265 means we are using libx265 video codec for this operation.

-acodec aac means we are using AAC audio codec for this operating.

-preset ultrafast means we are using ffmpeg's highest speed.

-crf 28 means a number that affects the video quality and 28 is default.

output.mp4 means the final file in MP4 format we want to produce.


Results

We want to share our real life uses of FFMPEG that is our computer course's video recordings compressed into closer to 50% smaller size.

Below is our LibreOffice Class' videos from  September. Left: MKV files before compression. Right: MP4 files after compression. Notice individual file size to the top-right and total size to the bottom. We compressed them from 2.4 GiB to 1.6 GiB.


Below is our Programming Class' videos from September. Left: MKV files before compression. Right: MP4 files after compression. Notice individual file size to the top-right and total size to the bottom. We compressed them from 2.9 GiB to 1.7 GiB



****

References 

https://trac.ffmpeg.org/wiki/Encode/H.265 

Compress MP4 using FFMPEG (GitHub Gist) 

How can I reduce a video size using FFMPEG? (StackExchange)

FFmpeg h264 preset crf comparison 2020 pt3 (graphs) (Corbpie) 



This article is licensed under CC BY-SA 3.0.