Here is the Log:
Last login: Wed Aug 31 13:26:34 on ttys000
Alexander-Server:~ Robert$ /Applications/HandBrakeCLI -i /users/Robert/Desktop/Red.mkv -o /users/Rmafive/desktop/Red -e x264 -x ref=2:bframes=2:subq=6:mixed-refs=0:weightb=0:8x8dct=0:trellis=0 -s 12000 -T -a 1,2 -E AC3,AAC -B 640,160 -6 6ch,dpl2 -R Auto,Auto -D 0.0,0.0 -f mp4 -4 --loose-anamorphic -m
[13:27:49] hb_init: checking cpu count
[13:27:49] hb_init: starting libhb thread
HandBrake 0.9.5 (2011010300) - Darwin x86_64 -
http://handbrake.fr
12 CPUs detected
Opening /users/Robert/Desktop/Red.mkv...
[13:27:49] hb_scan: path=/users/Robert/Desktop/Red.mkv, title_index=1
libbluray/bdnav/index_parse.c:157: indx_parse(): error opening /users/Robert/Desktop/Red.mkv/BDMV/index.bdmv
libbluray/bluray.c:960: nav_get_title_list(/users/Robert/Desktop/Red.mkv) failed (0x104000000)
[13:27:49] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Using libdvdcss version 1.2.10 for DVD access
libdvdnav

VDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav

VDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[13:27:49] dvd: not a dvd - trying as a stream/file instead
Input #0, matroska,webm, from '/users/Robert/Desktop/Red.mkv':
Duration: 01:51:09.66, start: 0.000000, bitrate: 640 kb/s
Chapter #0.0: start 0.000000, end 431.264156
Metadata:
title : Chapter 00
Chapter #0.1: start 431.264156, end 843.425911
Metadata:
title : Chapter 01
Chapter #0.2: start 843.425911, end 1253.460533
Metadata:
title : Chapter 02
Chapter #0.3: start 1253.460533, end 1446.570111
Metadata:
title : Chapter 03
Chapter #0.4: start 1446.570111, end 1750.457022
Metadata:
title : Chapter 04
Chapter #0.5: start 1750.457022, end 2156.571067
Metadata:
title : Chapter 05
Chapter #0.6: start 2156.571067, end 2606.687400
Metadata:
title : Chapter 06
Chapter #0.7: start 2606.687400, end 2952.532911
Metadata:
title : Chapter 07
Chapter #0.8: start 2952.532911, end 3356.936911
Metadata:
title : Chapter 08
Chapter #0.9: start 3356.936911, end 3792.121667
Metadata:
title : Chapter 09
Chapter #0.10: start 3792.121667, end 4182.011156
Metadata:
title : Chapter 10
Chapter #0.11: start 4182.011156, end 4524.269733
Metadata:
title : Chapter 11
Chapter #0.12: start 4524.269733, end 4852.180667
Metadata:
title : Chapter 12
Chapter #0.13: start 4852.180667, end 5234.103867
Metadata:
title : Chapter 13
Chapter #0.14: start 5234.103867, end 5584.787533
Metadata:
title : Chapter 14
Chapter #0.15: start 5584.787533, end 5911.906000
Metadata:
title : Chapter 15
Chapter #0.16: start 5911.906000, end 6196.648778
Metadata:
title : Chapter 16
Chapter #0.17: start 6196.648778, end 6669.663000
Metadata:
title : Chapter 17
Stream #0.0(eng): Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 23.98 fps, 24 tbr, 1k tbn, 47.95 tbc
Stream #0.1(eng): Audio: ac3, 48000 Hz, 5.1, s16, 640 kb/s
Metadata:
title : 3/2+1
[13:27:49] scan: decoding previews for title 1
[13:27:49] scan: audio 0x1: AC-3, rate=48000Hz, bitrate=640000 English (AC3) (5.1 ch)
Scanning title 1...
Scanning title 1...
[13:27:50] scan: 10 previews, 1920x1080, 23.976 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1
[13:27:50] scan: title (0) job->width:1920, job->height:1072
[13:27:50] libhb: scan thread found 1 valid title(s)
+ title 1:
+ stream: /users/Robert/Desktop/Red.mkv
+ duration: 01:51:09
+ size: 1920x1080, pixel aspect: 1/1, display aspect: 1.78, 23.976 fps
+ autocrop: 0/0/0/0
+ chapters:
+ 1: cells 0->0, 0 blocks, duration 00:07:11
+ 2: cells 0->0, 0 blocks, duration 00:06:52
+ 3: cells 0->0, 0 blocks, duration 00:06:50
+ 4: cells 0->0, 0 blocks, duration 00:03:13
+ 5: cells 0->0, 0 blocks, duration 00:05:03
+ 6: cells 0->0, 0 blocks, duration 00:06:46
+ 7: cells 0->0, 0 blocks, duration 00:07:30
+ 8: cells 0->0, 0 blocks, duration 00:05:45
+ 9: cells 0->0, 0 blocks, duration 00:06:44
+ 10: cells 0->0, 0 blocks, duration 00:07:15
+ 11: cells 0->0, 0 blocks, duration 00:06:29
+ 12: cells 0->0, 0 blocks, duration 00:05:42
+ 13: cells 0->0, 0 blocks, duration 00:05:27
+ 14: cells 0->0, 0 blocks, duration 00:06:21
+ 15: cells 0->0, 0 blocks, duration 00:05:50
+ 16: cells 0->0, 0 blocks, duration 00:05:27
+ 17: cells 0->0, 0 blocks, duration 00:04:44
+ 18: cells 0->0, 0 blocks, duration 00:07:53
+ audio tracks:
+ 1, English (AC3) (5.1 ch) (iso639-2: eng), 48000Hz, 640000bps
+ subtitle tracks:
ERROR: Invalid audio input track '2', exiting.
Alexander-Server:~ Robert$
I think I might have messed up the audio settings in the original code. I want the 6 channel audio as the first track and the dolby as the second track, but I think I messed up the order and the code.