Figure this might be of interest to the rest of the community. Apple's quicktime site is a great place to find high quality (including 1080p) trailers. But they use AAC audio which doesn't play well with S/PDIF output, and the mov format isn't quite as well supported as mkv.
Being that I've got extenders hooked up to my HT system, I wanted to convert these QT trailers to MKV with AC3 (S/PDIF friendly) audio, with minimal processing/fuss.
I found that SageTVTranscoder/ffmpeg could do it in one step, but it always screwed up the channel order. But another problem was it required a parameter for the number of channels to encode, and since the QT trailers come in both Stereo and 5.1 that posed a problem.
Being that I'm too lazy to do each trailer by hand, I spent way too much time researching and I finally came up with a single batch file that will remux a QT trailer/file into an MKV with AC3 audio, automatically handling the 2/5.1 channel thing.
The requirements:
- SageTVTranscoder - bundled with Sage, or you can use ffmpeg probably)
- Mencoder - grab the version most appropriate for your CPU
- MKVmerge
Then create a batch file with the following contents:
Code:
@echo OFF
set input=%1
set output=%input:.hdmov=.mkv%
if EXIST %output% GOTO EXISTS
d:\sagetv\sagetv\sagetvtranscoder.exe -i %input% > fmt.txt 2>&1
findstr /R "Audio.*5\.1" fmt.txt
echo. %errorlevel%
if %ERRORLEVEL% EQU 0 GOTO DD
findstr /R "Audio.*stereo" fmt.txt
echo. %errorlevel%
if %ERRORLEVEL% EQU 0 GOTO ST
goto ERR
:DD
echo. "It's 5.1!"
REM d:\sagetv\sagetv\sagetvtranscoder.exe -i %input% -vn -acodec ac3 -ab 640k -ar 48000 -ac 6 -y tmp.ac3
O:\apps\MPlayer-athlon-svn-28311\MPlayer-athlon-svn-28311\mencoder -channels 6 -oac lavc -lavcopts acodec=ac3:abitrate=640 -ovc frameno -of rawaudio -o tmp.ac3 %input%
mkvmerge -o %output% -d 1 -A S %input% -a 0 -D -S tmp.ac3 --track-order 0:1,1:0
goto OK
:ST
echo. "It's Stereo!"
REM d:\sagetv\sagetv\sagetvtranscoder.exe -i %input% -vn -acodec ac3 -ab 192k -ar 48000 -ac 2 -y tmp.ac3
O:\apps\MPlayer-athlon-svn-28311\MPlayer-athlon-svn-28311\mencoder -oac lavc -lavcopts acodec=ac3:abitrate=192 -ovc frameno -of rawaudio -o tmp.ac3 %input%
mkvmerge -o %output% -d 1 -A S %input% -a 0 -D -S tmp.ac3 --track-order 0:1,1:0
goto OK
:OK
"c:\Program Files\MKVtoolnix\mkvmerge.exe" -o %output% -d 1 -A -S %input% -a 0 -D -S tmp.ac3 --track-order 0:1,1:0
del tmp.ac3
REM del %input%
goto end
:ERR
echo. "It's Unknown!"
goto end
:EXISTS
echo. "Already exists, skipping."
:end
del fmt.txt
Some caveats:
- You'll have to change the paths to the apps used to whatever they are on your system.
- It won't delete the original file, if you want it to remove REM from the "REM del %input%" line.
- I don't completely trust it so neither should you

Usage:
I called my batch file "transcode_mov_ac3_auto.bat", so you simply type "transcode_mov_ac3_auto.bat file.mov" at the command prompt.
You can also just drag a trailer on top of the batch file in windows and I think that works, or presumably you could use something like Dirmon to automatically kick it off.
Or if you're handy with the command line you could use the for command to do everything in a directory.