Using Handbrake to Encode Videos for XBox 360 Playback

I installed the Microsoft Spring ’07 Update, allowing the XBox 360 to play videos encoded as MPEG-4 Part 2 (xvid/divx) and H.264/x264. After fumbling around for countless hours, I found handbrake settings that work with the XBox 360.

Since all the terms thrown around become confusing (H.264, x264, xvid, divx, and MPEG-4), here is a simple breakdown:

MPEG-4 Part 2 is commonly referred to as xvid or divx, however, xvid and divx are simply codecs which implement this standard (reference).

MPEG-4 Part 10 is commonly referred to as H.264, and x264, QuickTime, and Nero Digital are some codecs which implement it (reference).

According to the Spring ’07 Update Playback FAQ and the December 2007 Video Playback FAQ, the following configurations are supported:

Extensions Containers Video Audio
H.264 .mp4, .m4v,
.mp4v, .mov
MPEG-4, QuickTime 10 Mbps @
1920×1080
30fps
2ch AAC (LC)
MPEG-4 .mp4, .m4v,
.mp4v, .mov
MPEG-4, QuickTime 5 Mbps @
1280×720
30fps
2ch AAC (LC)
WMV .wmv asf 15 Mbps @
1920×1080
30fps
WMA7/8, WMA 9 Pro (2ch, 5.1),
WMA lossless
AVI .avi, .divx avi 5 Mbps@
280×720
30fps
Dolby® Digital 2ch, 5.1ch, MP3

In other words, the XBox 360 will play:

  • x264 + AAC audio inside mp4
  • xvid + AAC audio inside mp4
  • xvid + AC-3 audio inside avi

But The XBox 360 will not play:

  • x264 + AC-3 audio inside anything

Additionally, the FAQ seems to indicate that the XBox 360 will play files in any of these containers: .mp4, .m4v, .mp4v, .mov, .wmv. However, at least with uShare, I’ve found that the XBox will only even attempt to play files ending in .m4p and .wmv. The XBox does seem to be flexible about the actual content of the file, however, for example, I have renamed some .avi files with the .m4p extension, and it happily plays them. This may be entirely due to the way that the XBox 360 interprets uShare’s MIME types.

The command line I use under Linux to encode videos for x264 with AAC audio is:

/usr/bin/HandBrakeCLI -i DVD_NAME.ISO -o DVD_NAME_x264_aac.mp4 -p --aencoder aac --arate 48 --encoder x264 --markers --format mp4 --two-pass --turbo

(note that the -p switch indicates that Handbrake should use encode the file anamorphically)

To encode using the xvid codec with AC-3 audio, I run:

/usr/bin/HandBrakeCLI -i DVD_NAME.ISO -o DVD_NAME_xvid_ac3.avi -p --aencoder ac3 --encoder xvid --markers --format avi --two-pass

(I append the encoding details to the end of the filename so that I can keep track of what does and does not work!)

So far, my results with AC-3 playback have been disappointing. It appears that this is due to the fact that AVI isn’t intended for streaming playback, and Handbrake’s AVI muxer is rudimentary. MeGUI is suggested for better AVI output.

About Jeff Fitzsimons

Jeff Fitzsimons is a software engineer in the California Bay Area. Technical specialties include C++, Win32, and multithreading. Personal interests include rock climbing, cycling, motorcycles, and photography.
This entry was posted in Technology and tagged , , , , , , , , , , . Bookmark the permalink.

3 Responses to Using Handbrake to Encode Videos for XBox 360 Playback

  1. Paul says:

    This is rather complex stuff. It seems very few people use the x264 format. Handbrake gives an alert when you slide the quality for h.264 encoding all the way to the highest, and it says it becomes x264 and warns that a lot of software won’t play it. I don’t know what software will. You talk about the xbox, but is there any software? How about the ps3, do you know? You’re one of the few people to post about this encoding that I found.

  2. pconwell says:

    I’ve been able to get x264 with 5.1 Dolby Pro II with the following settings for handbrakeCLI. (Not sure how to do the settings exactly in the GUI version.)

    The “$z” part is a variable for the file name from a script I wrote.


    HandBrakeCLI -e x264 -x bframes=2:subme=6:mixed-refs=0:weightb=0:8x8dct=0:trellis=0:ref=2 -q .51 -5 -E faac -B 96 -R 44.1 -6 stereo -D 1.0 -i ./"$z" -o ./"$z".m4v;

    Here is the complete script. It is for converting .avi files, but you should be able to easily adjust the script as necessary:


    #!/bin/bash
    #

    LIST='*.avi'
    for z in $LIST; do
    HandBrakeCLI -e x264 -x bframes=2:subme=6:mixed-refs=0:weightb=0:8x8dct=0:trellis=0:ref=2 -q .51 -5 -E faac -B 96 -R 44.1 -6 stereo -D 1.0 -i ./"$z" -o ./"$z".m4v; #does the conversion
    mv "$z.m4v" "`basename "$z.m4v" .avi.m4v`.m4v"; #cleans up file names
    rm $z; #delete old file
    done;

  3. pconwell says:

    I just want to clarify. Yes, the settings say stereo, but a PRO II receiver should be able to give you 5.1 surround sound.

Leave a Reply

Your email address will not be published. Required fields are marked *