[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
jacobesterque Offline
Junior Member
Posts: 2
Joined: Aug 2006
Reputation: 0
Post: #31
JPSiemer: Very interesting topic. I have yet to test out the playability of this MKV files on my XBMC, but it seems as though it will work out quite well.

Is there any way of doing all this but putting it into a MP4 container? I ask because it seems as though MP4 is becoming a standard, and I would love to format my DVD's into a single format that can be played on my iPhone and XBMC. I don't mind sacrificing the quality (to an extent) of the MP4 as long as it can play on both devices and the quality is acceptable. I just want the convenience of doing it once.
find quote
JPSiemer Offline
Senior Member
Posts: 127
Joined: May 2008
Reputation: 1
Post: #32
Great Geosmack! Well, if you guys think the settings are stable, we should try and convince release groups to sticking with these settings for their H.264 encodes, as they seem more efficient overall in both quality and reliability, at a *slightly* bigger filesize! Can't beat that!

One way we can push the "xBox264" profile to become a standard is by testing playback of these files on other devices, such as Apple TV, PS3, Xbox360, PSP, iPod etc. If it supports one or more of these devices, that gives the scene a bigger reason to make the switch! I would test some of these devices, but I don't have any of them... I'm cheap and I have an Xbox!
find quote
JPSiemer Offline
Senior Member
Posts: 127
Joined: May 2008
Reputation: 1
Post: #33
Jacobesterque, the xBox264 profile and MP4 containers *sometimes* has problems playing ON THE XBOX -- not that it won't work at all, but skipping can occur in the usual problem scenes, fast forwarding through the video can be somewhat slow (and a little glitchy), and there was even a point at which my video completely froze up and the only way to resume playback was to manually skip past the scene (making that scene unwatchable). Not sure what causes this, but my theory is that it has to do with the advanced x264 setting we are using in combination with the way that XBMC handles MP4 containers versus the way it handles MKV containers. Playback on the computer works fine, and playback on other devices (such as your iPhone) might be fine as well...
find quote
geosmack Offline
Junior Member
Posts: 9
Joined: May 2008
Reputation: 0
Post: #34
I've been getting audio sync issues with ac3 sound in the mkv format. I changed -E ac3 to -E faac -b 160 -6 6ch and the sync issues seem to have gone away. FF and RW through the video is also much faster. Also, I still prefer the mkv format to mp4 for playback on XBMC. It seems much more stable than mp4.

Keep up the good work everyone.
find quote
JPSiemer Offline
Senior Member
Posts: 127
Joined: May 2008
Reputation: 1
Post: #35
Been playing around with a couple settings... I have been purposely encoding the same clip that skips *A LOT* over and over and over with different settings each time, and looking at how many frames each file drops. This gives me a really good idea which settings work better than others, and I am adjusting the xBox264 settings appropriately.

I took a key from geosmack's experience with keyint and I did find that it drops less frames with 240, than with 480. however, I also noticed that setting it to half that (keyint=120) results in even fewer dropped frames, and it doesn't even appear to be effecting quality. i think it actually has to do with file seeking, but don't quote me on that. those of you who have file seeking issues, try using 120 and let me know if that changes anything.

anyways, i'm still doing a couple tests. i won't be totally changing all of the settings, maybe a couple here or there that really give us smoother playback without the loss of any quality... i'll report back the new settings probably by tomorrow...
find quote
gzusrawx Offline
Fan
Posts: 382
Joined: Aug 2006
Reputation: 0
Location: Massachusetts
Post: #36
I tried out these settings with a Batman Begins backup 704x288 bitrate ~1762 whatever the guide says. It plays fine in windows, haven't yet tried it on the xbox xbmc, but in xbmc-linux about 7-8 minutes into the movie it starts showing diagonal streaking and does it throughout the rest of the movie. Again this plays fine in windows.
find quote
JPSiemer Offline
Senior Member
Posts: 127
Joined: May 2008
Reputation: 1
Post: #37
these settings should not be used to encode for xbmc linux. the purpose of this thread is to optimise the x264 settings for a widely used platform with a specific hardware configuration (the xbox). there is no way we can support xbmc linux users because there are millions of variations of hardware that we would now have to take into consideration...

please report back your findings on the xbox for us... thanks!
find quote
geosmack Offline
Junior Member
Posts: 9
Joined: May 2008
Reputation: 0
Post: #38
Does anyone know if there is a way to tell which options may have been used to create an mp4? I have an mp4 file I created some time ago and it is very good. Rewind, FF work flawlessly on XBMC, the picture looks great, and the file size is relatively small (1.1gig for a 90 minute movie). All I know about it that it uses faac audio and I used Handbrake to encode it. I have no notes on what x264 options I used.
find quote
JPSiemer Offline
Senior Member
Posts: 127
Joined: May 2008
Reputation: 1
Post: #39
Geosmack, you can use a program on Windows called MediaInfo (Not sure what is out there for other operating systems...), however, I can't get any of the x264 settings directly from a MP4... Only after remuxing the MP4 to MKV, the encoding settings become visible to MediaInfo. I read somewhere that this information is contained in the header, so maybe you just open the file in a hex editor if you don't want to remuxConfused
find quote
JPSiemer Offline
Senior Member
Posts: 127
Joined: May 2008
Reputation: 1
Post: #40
I take that back, I just downloaded the newest version of MediaInfo and it is reading the x264 options from MP4 files now. Whoa! I'm going to have a lot of fun with this... !!!
find quote
JPSiemer Offline
Senior Member
Posts: 127
Joined: May 2008
Reputation: 1
Post: #41
Oh, and by the way, MediaInfo is also avail for linux...

http://sourceforge.net/project/showfiles...e_id=90341
find quote
JPSiemer Offline
Senior Member
Posts: 127
Joined: May 2008
Reputation: 1
Post: #42
Been testing some new settings... Haven't changed a whole lot, but I mianly adjusted the bitrate settings. I'm not 100% sure if these are more efficient than the previous ones, but I ran into a couple of skippy encodes with the previous ones, and I think that it is fixed now. Hopefully I didn't break others in the process! We'll call this the xBox264 v2 profile from now on -- let me know what you guys think...

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

Film (23.97 FPS) : --keyint 240 --min-keyint 24
PAL (25 FPS) : --keyint 250 --min-keyint 25
NTSC (29.97 FPS) : --keyint 300 --min-keyint 30

720x256 - (1781) | 704x256 - (1822) | 688x256 - (1864)
720x272 - (1676) | 704x272 - (1715) | 688x272 - (1754)
720x288 - (1583) | 704x288 - (1619) | 688x288 - (1657)
720x304 - (1500) | 704x304 - (1534) | 688x304 - (1570)
720x320 - (1425) | 704x320 - (1457) | 688x320 - (1491)
720x336 - (1357) | 704x336 - (1388) | 688x336 - (1420)
720x352 - (1295) | 704x352 - (1325) | 688x352 - (1356)
720x368 - (1239) | 704x368 - (1267) | 688x368 - (1297)
720x384 - (1188) | 704x384 - (1214) | 688x384 - (1243)
720x400 - (1140) | 704x400 - (1166) | 688x400 - (1193)
720x416 - /1096/ | 704x416 - /1121/ | 688x416 - (1147)
-------------------------------------------------------
672x256 - (1908) | 656x256 - (1955) | 640x256 - (2004)
672x272 - (1796) | 656x272 - (1840) | 640x272 - (1886)
672x288 - (1696) | 656x288 - (1738) | 640x288 - (1781)
672x304 - (1607) | 656x304 - (1646) | 640x304 - (1688)
672x320 - (1527) | 656x320 - (1564) | 640x320 - (1603)
672x336 - (1454) | 656x336 - (1490) | 640x336 - (1527)
672x352 - (1388) | 656x352 - (1422) | 640x352 - (1457)
672x368 - (1328) | 656x368 - (1360) | 640x368 - (1394)
672x384 - (1272) | 656x384 - (1303) | 640x384 - (1336)
672x400 - (1221) | 656x400 - (1251) | 640x400 - (1283)
672x416 - (1174) | 656x416 - (1203) | 640x416 - (1233)
672x432 - /1131/ | 656x432 - (1159) | 640x432 - (1188)
672x448 - /1091/ | 656x448 - /1117/ | 640x448 - (1145)

This is encoded using MeGUI, with the newest unofficially modified version of x264 (http://www.mediafire.com/?gknvsmldmy0).

My Xbox is running the latest XBMC SVN. I'm running 720P for the skin resolution, and 720P for the video resolution. I have not changed my render method from the default "Pixel Shader" to the suggested "Hardware Overlays" -- in fact, chaning this setting actually drops *more* frames. I have turned off the "Xbox Autodetection" & "Remote Events" (Not sure what this is for, but I'm sure I don't need it.) And finally, I turned off both "Flicker" and "Soften" filters.

Have fun and happy ripping...
find quote
JPSiemer Offline
Senior Member
Posts: 127
Joined: May 2008
Reputation: 1
Post: #43
Damn, I knew I was forgetting something! With the suggested bitrates above, the bitrates surrounded by "/" instead of "(" probably won't work well with CABAC turned on, so turn it off for these particular resolutions.

And remember, these are MAXIMUM bitrates, so I suggest staying under these values!
find quote
JPSiemer Offline
Senior Member
Posts: 127
Joined: May 2008
Reputation: 1
Post: #44
Stay up-to-date with the newest beta x264 releases...

http://forum.doom9.org/showthread.php?t=130364

Always goto the last page in the thread for the latest releases.
find quote
geosmack Offline
Junior Member
Posts: 9
Joined: May 2008
Reputation: 0
Post: #45
MediaInfo worked out great. I was able to read the x264 options for my mp4 that I needed. It looks like I used the default options with the x264b30 codec.

Here is the command line.

/HandBrakeCLI -f mp4 -e x264b30 -q .646 -E faac -6 6ch -B 160 -U -F -N eng

This is not going to give you the highest quality encoding. There was some slight blocking on skin tones, but the overall picture quality is very good. RW/FF work as expected, that is, instantly and without the picture breaking up. The audio stays in sync and dynamic range was excellent. Encoding speed is very fast too. I am getting 50-60fps on my Core2Duo 6600.

For me, the slight drop in quality is worth the trade off of having RW/FF work, no dropped frames, and consistent quality even on the toughest scenes.
find quote
Post Reply