How can I batch convert mkv files to mp4?

13,247

Solution 1

for f in *.mkv; do avconv -i "$f" -codec copy "${f%.mkv}.mp4"; done

Solution 2

You can use mencoder. Install with:

sudo apt install mencoder

then:

for f in *.mkv; do mencoder "$f" -o "$f".mp4 -ovc lavc -oac lavc;done

The default output formats without any options are MPEG-4 for video and MP2 for audio.
Refer to man mencoder for more help.

Solution 3

Try winFF which is the gui for FFmgeg to batch convert audit & video files either from software center or;

sudo apt-get install winff

Solution 4

Another one through find command,

find /path -name '*.mkv' -exec bash -c 'avconv -i "$1" -codec copy "${1%.mkv}.mp4"' _ {} \;
Share:
13,247

Related videos on Youtube

The Werewolf of London town
Author by

The Werewolf of London town

Updated on September 18, 2022

Comments

  • The Werewolf of London town
    The Werewolf of London town almost 2 years

    At moment I use the single video command of:

    avconv -i File_name1.mkv -codec copy File_name1.mp4
    

    To change format but I need a method to do this for over 400 videos what would the batch command be?

    • web.learner
      web.learner about 10 years
      You should be able to use something like for i in *.mkv; avconv -i $i -codec copy "$i.mp4"; done but I can't test it right now.
  • The Werewolf of London town
    The Werewolf of London town about 10 years
    I have installed WinFF but it does not like my system for some reason