[HowTo] Convert mkv video to mp4

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
User avatar
cpedretti
Level 3
Level 3
Posts: 199
Joined: Tue Mar 10, 2020 12:06 am

[HowTo] Convert mkv video to mp4

Post by cpedretti »

In this HowTo i show you 2 ways to convert an mkv video file to mp4.


First method in GUI with VLC.

To convert correctly we need two programms, VLC and ffmpeg.


Open a terminal and enter the line:

Code: Select all

sudo apt install vlc ffmpeg -y

Now we can open VLC:

Image


Got to the Media Menu and select "converting/save":

Image


Add your mkv file:

Image


We need to choose the converting and output profile:

Image


Go to the wrench for the advanced options, select the MP4/MOV encapsulation method:

Image


Go to the video codec and select H264:

Image


And the audio codec, select MPEG-4 Audio and 44100Hz sampling frequency:

Image

Save your profile.


Now we can select the destrination for our file and start the converting, we can follow the progress bar:

Image

Image

The conversion will take some time depending on the size of your file, just be patient


When the task are ended VLC are still:


Image


And at least we have a new file in mp4 output:

Image


Second Method in CLI.


We need to open an termical window and add this line:

Code: Select all

ffmpeg -i path_to_my_mkv -strict -2 -r 44100 -codec copy my_file.mp4

Done!
AMD Ryzen 7 3700X - 32GB DDR4 RGB White - RTX4060TI O8GB White- SSD NVME Crucial P5 500GB - Mobo Gigabyte AORUS ELITE B550 V2 - PSU Corsair RM750 White - Case Corsair 5000D Airflow White 7 fans AF120 ARGB - AIO Corsair H100I Cappelix 240 White
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: [HowTo] Convert mkv video to mp4

Post by Flemur »

cpedretti wrote: Sun Aug 16, 2020 8:25 am In this HowTo i show you 2 ways to convert an mkv video file to mp4.
Here's another way which works on .mkv files created by handbrake, but won't play on the (not so) smart Roku TV:

Code: Select all

mv filename.mkv filename.mp4
Just changing the extension from mkv to mp4 lets the TV play them.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
ToutAlu
Level 3
Level 3
Posts: 157
Joined: Tue May 23, 2017 4:14 pm

Re: [HowTo] Convert mkv video to mp4

Post by ToutAlu »

My solution : a script, named "Mkv_to_mp4.sh"

Code: Select all

#!/bin/bash
for a in `ls *.mkv` ; do ffmpeg -i $a -vcodec libx264 -b:v 3000k -acodec libmp3lame -ar 44100 -ab 320k `echo "$a" | cut -d'.' -f1`.mp4 ; done
exit 
Image
Post Reply

Return to “Tutorials”