I have been looking a simple way to convert my *.mkv
TV series collections to *.mp4
so I can watch it on my TV. Luckily, I stumbled upon a post in stackoverflow about it. So I took the code and modified it a bit so it can automatically find all *.mkv
files in a directory (recursively), convert them to *.mp4
and place it the same directory. The only dependency you need is avconv
which can be installed easily on Debian/Ubuntu by sudo apt-get install libav-tools
and you are ready to run the script:
#!/bin/sh findpath=$1 : ${findpath:="."} find "$findpath" -name '*.mkv' | while read f ; do dir=$(dirname "$f"); file=$(basename "$f"); # ext="${filename##*.}"; name="${file%.*}"; # echo "avconv -i \"$f\" -codec copy \"$dir/$name.mp4\""; avconv -i "$f" -codec copy "$dir/$name.mp4" </dev/null; # rm -f "$f"; done