MKV | Just want 1 way to work ;)

I been searching google and many places trying to figure out what is the best way ( if you can even really say that ) to play a mkv file. I understand that playing it just as is will choke ATV.

Last night I took Visualhub and set it on iTunes AppleTV 5.1 w/ h.264 encoding. The set in advanced mode screen size to 1280x720.

When I put that file on my external hooked up to the ATV I noticed that the file played without chop, but there was no sound! The file took a long time to decode, so before I go any further, can people give me advice on what I should do to get mkv files to play with best definition, but actually work on the ATV.

Encoding is not so much an issue if I have to go down that route.

Thanks for any feedback!

EDIT

I just took a 2 min clip, exported once with Quicktime for ATV ( it worked) second time with Visualhub (ATV optimized) no audio.

When I click the files in ATV this is what they say:

Quicktime:
Video: , 640x360
Audio: AAC, Stereo (LR), 44.100kHz

Visualhub
Video: h264, 640x360
Audio: AC3, Stereo, 48.000kHz

This is disheartening. One of the main reasons I payed for this program was the ability to play files like that on my atv. it looks like no one here has the answer.

You will need to enable AC3 pass through in the Settings menus of Media or Files, depending on which plugin you choose to play the files back. Unfortunately the DVD plugin does not have AC3 pass through capability at this time.

I use a couple of programs… mplayer/mencoder mp4creator and normalize-audio. Most of these can be installed using darwin ports. Otherwise you will have to build them from the sources. Not an easy solution but it works great. This will create a mp4 that is QuickTime compatible. No need for NitoTV, XBMC, Boxee, or Perian to play the output of these files. They are totally ATV compatible. I use this script for all video .mkv files as well as pretty much everything else.

here is the code…

#!/bin/bash

if [ -n "$1" -a -n "$2" -a -n "$3" -a -n "$4" ]
then

mencoder $1 -o /dev/null -ss 32 -ovc x264 \
-x264encopts pass=1:turbo:bitrate=${4}:bframes=1:\
me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300:threads=auto \
-vf crop=${3},scale=-10:-1,harddup -alang eng \
-oac faac -faacopts br=192:mpeg=4:object=2 -channels 2 -srate 48000 \
-ofps 24000/1001

mencoder $1 -o tmpfile.avi -ss 32 -ovc x264 \
-x264encopts pass=2:turbo:bitrate=${4}:bframes=1:\
me=umh:partitions=all:trellis=1:qp_step=4:qcomp=0.7:direct_pred=auto:keyint=300:threads=auto \
-vf crop=${3},scale=-10:-1,harddup -alang eng \
-oac faac -faacopts br=192:mpeg=4:object=2 -channels 2 -srate 48000 \
-ofps 24000/1001

mplayer tmpfile.avi -dumpaudio -dumpfile audio.aac
normalize-audio audio.aac
mplayer tmpfile.avi -dumpvideo -dumpfile video.h264

mp4creator -create=audio.aac $2
mp4creator -create=video.h264 -rate=23.976 $2
rm -f tmpfile.avi audio.aac video.h264 divx2pass.log

else
        echo "Usage: $0 inputfile outfile.mp4 cropsize bitrate"
fi

This is pretty much taken directly from mplayer’s website on how to encode a Quicktime compatible video.

I get the cropsize by running mplayer video.mkv -vf cropdetect and waiting about 20 seconds for it to stabalize.

Then I use the script above which I named encoder.sh and placed in my home directory. ~/encoder.sh video.mkv video.mp4 1280:720:0:0 2800 You could use a bigger number then 2800 if you like but 2800 seems to do pretty well.

Not really sure if this will really help but its what I use and it works well. I know it seams complicated but getting the required components installed is really the only hard part. After that its pretty easy.