AAC vs AC-3
In my experience, about half the time mkv files are encoded with AAC audio, and half the time with AC-3, and yes this matters. Quicktime will play the AAC and AC-3 formats, but iTunes and iOS media player will not. If the audio in the mkv file was AC-3 and you merely rewrapped it in an mp4 container, it will still have AC-3 encoding on the audio. What you need to do is transcode the audio to AAC when you run that ffmpeg command like this:
ffmpeg -loglevel panic -i "original.mkv" -vcodec copy -c:a aac -strict -2 -ab 160k -ac 2 -ar 48k new.file.with.transcoded.audio.in.acc.mp4
mp4 atom
ffmpeg is a wonderful and fast utility, but it does not care that you are an iTunes user. iTunes and iOS media player are very finicky about decoding video if the mp4 atom is in a place it doesn't like, namely, anywhere except near the beginning of the file. Quicktime also complains sometimes...
...but is definitely better about playing unoptimized video. There's no telling where ffmpeg placed it, but likely its in the same place whomever encoded the original mkv left it.
Subler
Subler is a utility designed specifically for encoding subtitles, but it also will do exactly what you need it to do in this case. It will not only rewrap, and not transcode, the video to a friendly format, it will transcode the audio from AC-3 to AAC if necessary, and it will optimize the location of the mpeg-4 atom in the resulting file for iTunes friendly use. It uses a friendly drag and drop paradigm. Download Subler, unzip into your Applications folder and launch Subler. Type command-n to begin, and drag your mkv file into the window, and choose from the simple available options to result in a video mp4 or m4v file with identical video but transcoded audio. Make sure to mark the check box under Subler menu/Preferences to transcode the audio.
z264
z264 is a cool bash script designed to specifically solve the video issues that Mac and iTunes and iOS users face. Here's exactly what it does and how to make it work for you, if you're not too turned off by the command line.
check file for AVC encoding and flv, wmv, or mkv wrapper and rewrap in mp4 container otherwise, if not already am mp4, transcode to AVC mp4
z264 has several dependencies (mediainfo, rmtrash, ffmpeg, SublerCLI, and HandBrakeCLI)
- copy and paste script text into a text file, uncomment binary install section (remove #), save anywhere
open Terminal.app
chmod +x z264
run once
./z264
recomment binary section (replace #) after dependencies install into /usr/local/bin/
create ramdisk called 'Two' using command in ramdisk section
diskutil quiet erasevolume HFS+ 'Two' `hdiutil attach -nomount ram://4194304`
double-check command definitions (locations of dependencies), and correct locations (to "/usr/local/bin/")
change line 231 to read: mediainfo="/usr/local/bin/mediainfo"
change line 236 to read: rmtrash="/usr/local/bin/rmtrash"
change line 238 to read: ffmpeg="/usr/local/bin/ffmpeg"
change line 239 to read: SublerCLI="/usr/local/bin/SublerCLI"
change line 262 to read: mediainfo="/usr/local/bin/mediainfo"
change line 263 to read: rmtrash="/usr/local/bin/rmtrash"
change line 265 to read: HandBrakeCLI="/usr/local/bin/HandBrakeCLI"
save as z264 in /usr/local/bin/
use Terminal to call z264 on single file, directory of files, or your entire drive
z264 directory.full.of.mixed.video.filetypes/*
z264 will examine everything, but will only touch avi, flv, mpg, mpeg, wmv, vob, mkv and mp4 video files, copying video and audio streams and rewrapping if possible, transcoding just the audio if necessary, and transcoding only what video is necessary, and leave you with iTunes friendly, atom optimized mp4 files, leaving the originals in your Trash. It makes reasonably intelligent decisions for you about how to transcode files based on how you set its HandBrake variables (set at lines 312-333).
minor issues: does not yet count how many background processes it spawns, meaning if there are a lot of transcodes, it will take awhile for them to complete, but they will complete. You also need a lot of memory (8GB is ok). Snow Leopard users will need to install purge command from xcode developer tools.
ffmpeg
to gain iTunes support: apple.stackexchange.com/questions/123657/… Might this help?