| Suppose you have a directory full of .mkv files that you want to transcode to h264 (eg. they might be xvid, mpeg2, etc.). Let us also assume that the directory contains the executable files ffmpeg.exe and mkvmerge.exe (within the MKVToolnix download).
A batch file in Windows XP that will encode all of them is:
rem -ss 15 -t 10 this means start at second 15 and encode the next 10 seconds
for %%a in (*.mkv) do "ffmpeg" -i "%%a" -sn -vcodec libx264 -crf 22 -acodec libmp3lame -aq 6 "%%a".h264.mkv
The rem statement is a reminder on how to just encode a small part of the video for testing purposes. The for loop encodes all files ending with .mkv into high quality h264 with mp3 audio.
In some cases the resulting .mkv file will not be playable on all media players like VLC due to leftover meta-tag information. In these cases you can clean the video files using mkvtoolnix with the following script:
for %%a in (*.mkv) do "mkvmerge.exe" -o "%%a".clean.mkv -T -S "%%a"
Now the video files should be playable by any popular media player.