Tag Archives: x264

Compiling X264 on Ubuntu

I noticed that HandBrakeCLI displayed this message:

x264 [info]: using cpu capabilities: none!

I thought that, perhaps, I could gain some performance by recompiling x264 directly for my AMD dual-core, 64-bit CPU. It turned out to be quite a task.

gpac

Get gpac (check the project’s download page for the latest version):

wget http://downloads.sourceforge.net/gpac/gpac-0.4.4.tar.gz

Unpack gpac:

tar xvzf gpac-0.4.4.tar.gz
cd gpac

make configuration script executable:

chmod u+x configure

Configure:

./configure

Compile:

make

X264

Install subversion:

sudo apt-get install subversion

Install yasm:

sudo apt-get install yasm

Retrieve x264:

cd ..
svn co svn://svn.videolan.org/x264/trunk x264
cd x264

Copy in gpac headers:

cp -R ../gpac/include/gpac .

Configure x264 and build:

./configure --enable-mp4-output --enable-shared --extra-ldflags=-L../gpac/bin/gcc
make
Posted in Technology | Tagged , , , , , , , , , | Leave a comment

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.

Posted in Technology | Tagged , , , , , , , , , , | 3 Comments