Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
3  
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. –  Seth Jun 14 at 20:48

4 Answers 4

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

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

sudo apt-get install winff
share|improve this answer
    
I have installed WinFF but it does not like my system for some reason –  The Werewolf of London town Jun 14 at 21:52

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.

share|improve this answer

Another one through find command,

find /path -name '*.mkv' -exec bash -c 'avconv -i "$1" -codec copy "${1%.mkv}.mp4"' _ {} \;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.