[XBOX] HOW-TO encode videos in H.264 to be able to achieve playback on the Xbox

  Thread Rating:
  • 10 Votes - 4.6 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
sion28 Offline
Senior Member
Posts: 247
Joined: Jul 2008
Reputation: 0
Location: Northern California, USA
Post: #361
JPS, the posts you are reading asking for a template were moved here from another thread. Gavo posted an original thread with his post above. It went on for a few posts then some admin moved it here in its entirety. Thus my post which LINKED to this thread. Hopefully now that those concerned know about this thread and the 720p thread, their questions are answered.

BTW, AC3 and DTS both would offer the LEAST load on the xbox hardware, since they are passed via SPDIF to the external processor.
find quote
JPSiemer Offline
Senior Member
Posts: 127
Joined: May 2008
Reputation: 1
Post: #362
sion28 Wrote:JPS, the posts you are reading asking for a template were moved here from another thread. Gavo posted an original thread with his post above. It went on for a few posts then some admin moved it here in its entirety. Thus my post which LINKED to this thread. Hopefully now that those concerned know about this thread and the 720p thread, their questions are answered.

BTW, AC3 and DTS both would offer the LEAST load on the xbox hardware, since they are passed via SPDIF to the external processor.

Oh, ok... I was confused for a sec Confused Thanks for clearing that up...
find quote
SleepyP Offline
Posting Freak
Posts: 2,274
Joined: Nov 2005
Reputation: 4
Location: Portland, Oregon
Post: #363
OK guys, here's the deal: I recently went on a "check to make sure all your stuff is up to date" kick. Found that about 10 days a new SVN build of Handbrake was released on Windows. "Looks nice" I thought. Then I discovered the developers have straight up REMOVED support for Xvid entirely. They're basically saying "Xvid is old and H.264 is the new thing, its better!" Cue "research mode" and here I am. My goal is to figure out how to encode from DVD to H.264 using the latest Handbrake. It looks like they have much improved the control over the H.264 encoder, check out this screen cap:
[Image: LatestHandbrake.JPG]

Since I have a pretty decent quad core system and a pile of already-ripped DVDs here, I'm gonna try to build an equivalent preset for this new-fangled Handbrake.

Catchy Signature Here
find quote
SleepyP Offline
Posting Freak
Posts: 2,274
Joined: Nov 2005
Reputation: 4
Location: Portland, Oregon
Post: #364
This is kinda strange, but I adapted the settings from the wiki into the format Handbrake uses, which looks like this:
Code:
keyint=240:min-keyint=24:ref=8:mixed-refs:no-fast-pskip:bframes=6:b-adapt=2:b-pyramid:
weightb:no-cabac:subme=7:partitions=p8x8,b8x8,i4x4,i8x8:8x8dct:ratetol=4.0:qcomp=0.5:merang​e=32:me=umh:
Encoding that into an MKV container causes the encoder to crash almost immediately, but encoding to MP4 is working right now. Its extremely slow even on my quad core, so I won't know any results until later today, but at least its working Smile

Catchy Signature Here
find quote
SleepyP Offline
Posting Freak
Posts: 2,274
Joined: Nov 2005
Reputation: 4
Location: Portland, Oregon
Post: #365
So far I have hit some bumps in the road, but have successfully turned out some encodes that play with zero dropped frames.
The trickiest bit is that there are some settings available within the Handbrake GUI that it lets you set up but that cause the encoder to completely crash as soon as you start the encoding job. I am still figuring out which settings cause crashes, as I believe its just dumb stuff like having the audio bitrate setting too high.

I have a bunch of stuff to encode today and I'll report back results, but so far its looking good.
Here is my preset XML:
Code:
<?xml version="1.0"?>
<ArrayOfPreset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Preset>
    <Level>0</Level>
    <Name>Xbox H264-From DVD 704x400-Ogg 160</Name>
    <Query> -f mp4 -w 704 -l 400 -e x264 -b 1362 -2  -a 1 -E vorbis -6 stereo -R Auto -B 160 -D 4 -x keyint=240:min-keyint=24:ref=8:mixed-refs=1:no-fast-pskip=1:bframes=6:b-adapt=2:b-pyramid=1:weightb=1:no-cabac=1:subq=7:analyse=p8x8,b8x8,i4x4,i8x8:8x8dct=1:ratetol=4.0:qcomp=0.5:me=umh​:merange=32 -C 4  -v 1</Query>
    <PictureSettings>true</PictureSettings>
    <Version>svn2592</Version>
  </Preset>
</ArrayOfPreset>

Also here's a link to the latest Handbrake SVN, the "new one" which I am using:
http://forum.handbrake.fr/viewtopic.php?f=11&t=11201

Catchy Signature Here
find quote
badbob001 Offline
Junior Member
Posts: 9
Joined: Mar 2009
Reputation: 0
Post: #366
If h.264 videos are stuttering, one thing to try is playback with the dvdplayer instead of the default mplayer. This is done via xbmc's 'Playing using...' menu option. I have some 480p x264 videos that would slideshow at some scenes using mplayer but play much more smoothly with dvdplayer. Not sure why dvdplayer is smoother, but perhaps it's due to it being custom made for the xbox. This may be useful for those with videos that are just borderline, which saves you a re-encode.

I'm assuming the encoding test here are using the default mplayer. May be interesting (or a nightmare) to see how the dvdplayer performs.

There does seem to be compatibility issues with the dvdplayer. It just would freeze the whole system when trying to play some files. I suspect it may be an issue with files larger than 1GB.

Update: dvdplayer is fine and works great. It just needs a lot more ram than mplayer and when you don't have enough, the system will just freeze. With mplayer, I could run everything at 1080i on the xtv skin and 384x384 dvd covers. With dvdplayer, I had to reduce my covers to the default 192x192 and run at 720p. Now I have dvdplayer set to be the default player.
(This post was last modified: 2009-07-17 23:12 by badbob001.)
find quote
gavo Offline
Senior Member
Posts: 140
Joined: Apr 2009
Reputation: 0
Post: #367
that template isnt working with ripbot264.exe does anyone have a megui for xbmc h264 or another progrm that does work ripbot264 update most of stopped it from working.
find quote
zimdba Offline
Junior Member
Posts: 19
Joined: Jun 2006
Reputation: 0
Post: #368
SleepyP Wrote:So far I have hit some bumps in the road, but have successfully turned out some encodes that play with zero dropped frames.
The trickiest bit is that there are some settings available within the Handbrake GUI that it lets you set up but that cause the encoder to completely crash as soon as you start the encoding job. I am still figuring out which settings cause crashes, as I believe its just dumb stuff like having the audio bitrate setting too high.

I have a bunch of stuff to encode today and I'll report back results, but so far its looking good.

So how are your results? I'm only using AC3 Pass-through so I'm not really worried about the audio bitrate or CPU on the xbox required to process it.

Also, is the 1362 average bitrate, or constant bitrate? I encoded a test dvd clip and MediaInfo reported this:
Bit rate : 1 069 Kbps
Nominal bit rate : 1 362 Kbps

Thanks.
find quote
Gamzarme Offline
Junior Member
Posts: 3
Joined: Aug 2008
Reputation: 0
Post: #369
What sort of video file sizes are you guys getting with your encodes using the settings posted here in the first post? The reason I am curious is because I am attempting to adapt the settings to another h.264 encoder front-end. On a two hour movie (2:02:43, to be exact) with a bit rate around the 1300kbps (as measured in VLC) the resulting video is 1.1 GB total.

The reason I am excluding the entire *.mkv file in my question is because the audio codecs we choose to encode in vary, thus affecting file size. For instance I am using AC3/DTS to keep the processing down on the Xbox CPU. This audio format, along with two audio tracks and two subtitle tracks total, yields a total size of 1.7 GB for the entire file.

One more thing, I am using a quantizer of 2, as opposed to the less quality quantizer of 3. This allows for nearly flawelss playback and only drops frames maybe once or twice per movie. Of course this is only in areas of the film where there is much movement. What quantizers are you guys out there using?
find quote
zimdba Offline
Junior Member
Posts: 19
Joined: Jun 2006
Reputation: 0
Post: #370
I'm using my Monsters Inc DVD for testing encodings with Handbrake - as I find it's GUI the easiest to use thus far. However, I've had to manually play with the aspect ratio to get drop-free encodings. Additionally, it takes about 4 hours on my E8500 as opposed to about 2 hours using Divx or Xvid.

Since the source video is 2.35:1, I had to manually override the aspect ratio (it showed 1.78:1) to 720x304 and a bitrate of 1682 as suggested in the matrix. The Anamorphic setting didn't help one bit. So manually figuring out the bitrate & aspect ratio was a bit of a pain, but a drop-free encoding of 1.4GB as opposed to the source 4.17GB made it worth it. There is zero loss of detail that I can see on my 61" DLP. So hopefully I've found my solution. Now on to reencode the library . . .
find quote
sethjvm Offline
Junior Member
Posts: 22
Joined: Mar 2009
Reputation: 0
Post: #371
gavo Wrote:that template isnt working with ripbot264.exe does anyone have a megui for xbmc h264 or another progrm that does work ripbot264 update most of stopped it from working.

I am using ripbot v 1.14.5 and I had to adjust the code in this posthttp://forum.xbmc.org/showpost.php?p=315...tcount=344.

From:
Code:
--level 2.0 --no-cabac --filter 0,0 --ref 8 --mixed-refs --bframes 6 --b-adapt 2 --weightb --b-pyramid --direct auto --subme 7 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --me umh --threads auto --thread-input --progress --no-psnr --no-ssim

To:
Code:
--level 2.0 --no-cabac --filter 0,0 --ref 8 --mixed-refs --bframes 6 --b-adapt 2 --weightb --b-pyramid --direct auto --subme 7 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --me umh --threads auto --thread-input

(I deleted the "--progress --no-psnr --no-ssim" from the code based on the information I found here:http://www.style-productions.net/index.p...d=3254&p=1

I don't know if that will work for you but I am loving RipBot right about now.
find quote
maverick Offline
Junior Member
Posts: 2
Joined: Aug 2009
Reputation: 0
Post: #372
JPSiemer Wrote:Well, I figured it out!

I have been working non-stop on this the past week and I got the settings 99% accurate. There is still *minimal* frameskipping in very complex scenes, but it is nowhere nearly as noticeable as it was. Basically, 9 out of 10 scenes that were previously unwatchable now play sooooo smooooooooth!

So anyways, I realized quickly that I was getting nowhere with Handbrake. Though it's easy to use, I found that the program MeGUI rendered more desirable and more stable results every time. So, the trick was getting a skipless video, at a high resolution, at decent bitrates, with some of the more advanced settings and options of the x264 codec. MeGUI actually comes with a basic Xbox profile for encoding decent quality video, but it still suffered from skipping when at higher resolutions. After hours of cross-analyzing "scene" releases in the H.264 format, and seeing what worked and what didn't, I was able to put together a basic outline of what options and what values I needed to solve the problem. I learned a lot from my experience and I think many many people are going to benefit from my hard work, so I am here to report my results...

So, anyways, I started out by gathering up the software I needed to get the job done. I got RipIt4Me for ripping DVD's, MeGUI as a GUI for x264, x264 for encoding video, NeroAacEnc.exe for encoding audio, and AviSynth v2.5.7 for video preview. I installed everything then started ripping my DVD movie with RipIt4Me. (You can use a different program to do this.) Next, I used MeGUI's built-in D2V Creator and selected the DVD's first VOB video track that contained the movie information. I selected the audio track I wanted (usually the 6 channel AC3 or something comparable) and then queued the job and started it to produce a .d2v file. Next, I loaded my newly created .d2v into MeGUI's built-in AviSynth Script Creator. In here I autocropped the video (to remove black bars) and then applied a Resize of either 720 or 704 for the width and checked the suggested resolution box to autofill the height value. In the filters tab I analyzed my video to see if it needed de-interlacing or not. I clicked the box "On Save Close And Load To Be Encoded" and clicked the Save button, which saves my script and auto-loads it into MeGUI for me. Next it was a matter of making sure Codec is x264 and file format is MP4. Select whatever audio tracks you want and use whatever codecs you want for audio, though I recommend AAC or AC3.

That was all the easy stuff. Next came the Video Profile settings. I configured my own video profile with the following settings:

--pass 2 --bitrate XXXX --stats ".stats" --keyint 480 --min-keyint 24 --ref 5 --mixed-refs --no-fast-pskip --bframes 4 --b-pyramid --b-rdo --bime --weightb --direct auto --nf --subme 7 --partitions all --8x8dct --vbv-bufsize 1 --vbv-maxrate 5000 --ratetol 4.0 --me umh --threads auto --thread-input --cqmfile "C:\CQM\EQM_AVC_HR.cfg" --progress --no-psnr --no-ssim --nr 150 --output "output" "input"

Match those settings EXACTLY! The box in the video configuration dialog must match this exactly, so get it right and make sure CABAC is on! If you don't want to input those settings manually, just download my profile @ http://www.yousendit.com/transfer.php?ac...AB5000F19E. A couple variables can be changed if you want...

For Clear DVD Sources :: nr=0
For Noisy DVD Sources :: nr=150
For 23.976 FPS :: --keyint 480 --min-keyint 24
For 25 FPS :: --keyint 500 --min-keyint 25

For the EQM_AVC_HR.cfg CQM file goto: http://www.webalice.it/f.corriga/x264/eqm_avc_hr.cfg
You can alternately use Trellis=2 and not use the CQM at all, but the CQM yeilds better results.

And finally, the bitrate you set is dependant on your video resolution. This is the best way to get Xbox-compatible video at the highest resolution and bitrate possible.

Suggested Bit Rate settings based on Output Resolutions are:

720x256 - 1800 KBps 704x256 - 1909 KBps
720x272 - 1730 KBps 704x272 - 1836 KBps
720x288 - 1660 KBps 704x288 - 1763 KBps
720x304 - 1590 KBps 704x304 - 1690 KBps
720x320 - 1520 KBps 704x320 - 1617 KBps
720x336 - 1450 KBps 704x336 - 1544 KBps
720x352 - 1380 KBps 704x352 - 1471 KBps
720x368 - 1310 KBps 704x368 - 1398 KBps
720x384 - 1240 KBps 704x384 - 1325 KBps
720x400 - 1170 KBps 704x400 - 1252 KBps
720x416 - 1100 KBps 704x416 - 1179 KBps
720x432 - 1030 KBps 704x432 - 1106 KBps
720x448 - 960 KBps 704x448 - 1033 KBps
720x464 - 890 KBps 704x464 - 960 KBps
720x480 - 820 KBps 704x480 - 887 KBps

These settings are probably not perfect, but I haven't had any problems yet...

Anyways, so I saved my profile and pressed the AutoEncode button in the bottom right corner of the MeGUI main window. This brings up the Automatic Encoding window where you *MUST* set the Container to be "MKV" and you *MUST* set Size And Bitrate to "No Target Size (Use Profile Settings)". Press the Queue button and manually start the first job in the Queue tab.

That's it. It will encode audio, then two pass encode video, and then mux them together for a nice and pretty XBMC-compatible H.264 video file.

can you please repost the template for meGUI, the link at "yousendit" is dead. THANKS Big Grin
find quote
Piranha64 Offline
Junior Member
Posts: 4
Joined: Nov 2009
Reputation: -10
Post: #373
sethjvm Wrote:I am using ripbot v 1.14.5 and I had to adjust the code in this posthttp://forum.xbmc.org/showpost.php?p=315...tcount=344.

From:
Code:
--level 2.0 --no-cabac --filter 0,0 --ref 8 --mixed-refs --bframes 6 --b-adapt 2 --weightb --b-pyramid --direct auto --subme 7 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --me umh --threads auto --thread-input --progress --no-psnr --no-ssim

To:
Code:
--level 2.0 --no-cabac --filter 0,0 --ref 8 --mixed-refs --bframes 6 --b-adapt 2 --weightb --b-pyramid --direct auto --subme 7 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --me umh --threads auto --thread-input

(I deleted the "--progress --no-psnr --no-ssim" from the code based on the information I found here:http://www.style-productions.net/index.p...d=3254&p=1

I don't know if that will work for you but I am loving RipBot right about now.

These x264 parameters doesn't seem to work with the newest RipBot264 1.16.5.

Anyone have the updated values?
find quote
Post Reply