I’m in the middle of trying to write a small app that will halfway intelligently inspect a MKV file, pick the subtitle based on a configuration file, and then convert the file to a manageable size so that I can load it on my iPhone. Took me three or four days of playing with different parameters before I finally figured it out. Here’s the .bat file I’m using to convert a couple of sample MKV files for my iPhone. It does use MP4 instead of H264, but I’m happy with this for now since it takes a lot less time to convert.
Note that alang is the Audio Language, slang is the subtitle language and they are usually “eng” or “jap” (I don’t have any other files available to see what the abbreviated language title should be)
Keep an eye out for my video conversion app for Windows sometime soon. Its hosted on Google Code right now, but its not really polished. Also, nicmp4box.exe (google for it) is a little app that adds the flag to the file so that iTunes will accept it as iPhone compatible.
rem usage example: iphone_mkv.bat inputfile.mkv outputfile.mp4 eng jap
set input=%1
set output=%2
set slang=%3
set alang=%4
set temp=temp.mp4
ECHO Stage: 1/2 Running MEncoder
mencoder\mencoder "%input%" -of lavf -lavfopts format=mp4 -vf-add scale=480:320 -vf-add harddup -ofps 25 -af lavcresample=44100 -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:acodec=libfaac:abitrate=128:vcodec=mpeg4:vbitrate=768:keyint=25 -alang %alang% -slang %slang% -o %temp%
ECHO Stage: 2/2 Running MP4 Box
MP4Box\nicmp4box -add %temp% "%output%"
ECHO Cleaning Up
del %temp%
Echo Done.
Filed under: Uncategorized