[XBOX] HOW-TO encode videos in H.264 to be able to achieve playback on the Xbox - Printable Version
+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (/forumdisplay.php?fid=33)
+--- Forum: Tips, tricks, and step by step guides (/forumdisplay.php?fid=110)
+--- Thread: [XBOX] HOW-TO encode videos in H.264 to be able to achieve playback on the Xbox (/showthread.php?tid=33429)
[XBOX] HOW-TO Encode H.264 Videos Compatible With XBMC For Xbox - JPSiemer - 2008-05-21 09:48
You wouldn't believe how little information is on the Internet about encoding high quality H.264 with little-to-no skipping for XBMC! The trick is in the settings. These settings work 99% of the time, however there is still *minimal* frame-skipping in very complex scenes because of the limited nature of the Xbox's hardware.
After hundreds of successful encodes, I believe I have hit the final xBox264 settings. The Wiki has been updated with two different, Xbox-optimized profiles... one for those who prefer quality over filesize and the other for those who prefer filesize over quality. I also removed all mention of AAC, as it uses a LOT of CPU power to decode, and that was causing a lot of skipping. So use 2-6 channel AC3 or 2 channel OGG audio for best results.
The most recent settings are located @ the updated Wiki guide: http://wiki.xbmc.org/index.php?title=HOW-TO_Encode_H.264_Videos_Compatible_With_XBMC_For_Xbox. Alternatively, you can just download the two presets @ http://www.mediafire.com/file/jtzn02tehmj/Xbox_Profile.zip. To import presets, in MeGUI, go to "File", click "Import Presets", and select the .ZIP file you downloaded. Don't be lazy and use these presets without first familiarizing yourself with the Wiki guide... it contains useful tips and information that you will still need to know in order to achieve desired results.
One thing the Wiki does not mention is how to mux audio with re-encoding it (this is especially useful when you want to keep the original AC3/DTS audio track). To do this, click on the "X" Button in the Audio tab to disable re-encoding audio, then click the "AutoEncode" button to bring-up the Muxer dialog, and select the "Add Additional Content" check box. Now when you click Queue it will bring up an Advanced Muxer dialog box where you can add the original audio track (or multiple tracks... e.g. director comments, other languages, etc.) without re-encoding. (Thanks to DJENYC for this.)
Use the following MPlayer hack for optimal playback of H.264 on the Xbox: http://forum.xbmc.org/showpost.php?p=190542&postcount=51.
If MeGUI is crashing when you load your source into the AviSynth Script Creator, then its most likely a codec problem or a software conflict. To fix this, delete/uninstall all codecs and codec packs from your computer (including Vista Codec Pack, Combined Community Codec Pack, etc). Then install only Haali Media Splitter (http://haali.cs.msu.ru/mkv/), and FFDShow (http://sourceforge.net/project/showfiles.php?group_id=173941). Also make sure you do not have Groove installed (comes with Microsoft Office 2007) -- uninstall it immediately because it can cause strange conflicts with MeGUI.
And remember: ripping from a 4-10GB, 720P/1080P, Blu-Ray/HDDVD scene rip (http://scenereleases.info/category/movies/movies-bluray-rip) is always going to yield MUCH better quality than ripping from a 9GB retail DVD. The lowest quality HD video is usually on par with the highest quality DVD. For more information about BD/BR-Rips, check out this post: http://www.xbmc.org/forum/showpost.php?p=246587&postcount=143 or this article http://filesharefreak.com/2008/11/19/blu-ray-brrip-bdrip-two-new-xvid-hd-formats/.
P.S. - Use the Wiki settings only! Do not use any other settings stated in this thread, as everything else is most likely outdated. AND DO NOT ASK FOR HANDBRAKE EQUIVALENT SETTINGS!
- JPSiemer - 2008-05-21 09:52
Original Post Deleted Due To Outdated Information
- JPSiemer - 2008-05-21 09:55
Original Post Deleted Due To Outdated Information
- snomis79 - 2008-05-21 17:05
thanks for posting your findings! I'll have to try that later.
- aart - 2008-05-21 19:27
lol I just ran into the stuttering in playback today, will try the max cache setting. thanks
- JPSiemer - 2008-05-22 07:17
Well, after a couple more rips I have to say that my settings are NOT perfect, and will not hold up in high motion scenes *yet*, but I am hard at work fixing this issue. There are some magical numbers out there, and I intend to get them. I know this because I have downloaded many H.264 rips from torrent sites and I have had many of them play back fine -- I just need to figure out the settings they were encoded with. Download NewArtRiot's rip of Juno, for instance, and you will see what I am talking about. Amazing quality, small file size, and perfect playback on XBMC.
What stills boggles my mind is how the quality of his rips are so awesome and play back flawlessly, and he still uses CABAC in his encodes. Which, if you all know, CABAC uses most of the processing power to decode on XBMC, therefore causing stutter.
Anyways, I will do a couple more tests and report back my findings...
- waldo22 - 2008-05-23 01:57
Thanks for this. I had basically given up on h.264 on the Xbox, and started using handbrake to make xVid MKVs.
Keep us posted.
- JPSiemer - 2008-05-23 07:28
DO NOT use the settings referenced in my previous posts. Those settings are obsolete, as I have really found out a lof of information in the last couple of days. Will post back in a day or two with as much information as possible.
- JPSiemer - 2008-05-26 05:42
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?action=download&ufid=78A92CAB5000F19E. 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.
- JPSiemer - 2008-05-26 05:46
P.S. - All of this is a lot easier than it sounds and is well worth it! If only we can get the scene to release XBMC-compatible files! The quality is actually better than scene releases! Anyways, If you need a little guide on how to use MeGUI, check out this excellent article: http://www.digital-digest.com/articles/MeGUI_H.264_Conversion_Guide_page1.html. Do not use the settings in this guide, because it has nothing to do with ripping for XBMC, just use this as a reference! Oh, and I welcome as much feedback as possible....
- JPSiemer - 2008-05-26 05:58
Oh, and one more thing... I would advise to try and keep your resolution under 720 x 400... I have not tested over this resolution yet, but others have reported that the Xbox cannot handle H.264 encoded video at resolutions higher than this...
- Witchdoctor - 2008-05-26 19:29
Hey awsome job for taking the time to do this expecially for a newb like my self. I have always tried to find that some what perfect way of encoding my movies. One big question I notice you said *Must* for the container to be MKV is there a problem with using MP4. I am only asking because I use my homemedia Server to stream things to my xbox and it doesn't pick up the MKV container. Once again Thxs man for the setigns.
XBMC Wiki - QuickJolt - 2008-05-26 22:31
Have you thought about creating your own wiki article? I'm sure tons of people would love this info and then people could edit it as they find better ways!
- JPSiemer - 2008-05-27 10:40
I experienced wierd problems skipping back in forth with some MP4's inside of a MP4 container, however the same MP4's inside of a MKV container gave me zero playback problems. This might be because MKV is an overall more versatile container.
Might just do that.
- JPSiemer - 2008-05-27 11:02
Any way a mod can help me out in getting access to making my own Wiki page on this subject? I am constantly doing testing and making revisions so I would like to be able to make edits here and there when neccessary. Apparently it has been locked down to only moderators...