[HowTo] Convert mkv video to mp4

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Post Reply
User avatar
cpedretti
Level 2
Level 2
Posts: 88
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 - Sapphire RX570 8GB - SSD SAMSUNG EVO 860/HDD Toshiba - Mobo Gygabyte AORUS ELITE B450 - PSU Gigabyte 750W Gold - Case Zalman X3 White

LMDE4 Kernel 5.9
User avatar
Flemur
Level 19
Level 19
Posts: 9060
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: 134
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”