Kodi Community Forum
[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 (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Tips, tricks, and step by step guides (https://forum.kodi.tv/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)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25


- JPSiemer - 2008-07-10

Well, my comp is back up and running...

And I am back with good news... I have stumbled upon some settings that yield great results and allow resolutions as high as 832x352 (maybe even higher!) at good bitrates.

I know 832x352 is a non-standard res. In fact, it's squished vertically, so it looks all weird unless you play with the DAR (Display Aspect Ratio). This allows you to store the video at a wierd resolution, but stretch it to the correct aspect upon playback. There are a couple programs that allow you to do this (MeGUI, StaxRip), but I do not think Handbrake is one of them... (Note: You do not have to do this with your encodes to use my settings, this is just a tip on achieving maximum resolutions.)

Anyways, these new settings will be primarily for users that are re-encoding HDDVD/BluRay material (either from original sources or from rips -- both will look great!) However, I think there might even be a benefit in using this for standard definition stuff as well... I'll leave that to you guys to test...

The settings have been completely rethought and I am not using most of the CPU-heavy settings (except for CABAC). This allows for higher bitrates and higher quality encodes.

Don't get me wrong, we've always been able to achieve 832x352, but only at very low bitrates. Since the new settings give us more room to work with bitrates, we can now achieve almost lossless quality at these resolutions. In fact, many of the BluRay rips I have done come out to be less than 1.2 GB and are better than DVD quality!!!

I am in the last stages of perfecting the settings and doing final testing, so I will post back with my results very soon.


- JPSiemer - 2008-07-15

I am back with new settings and a new Wiki page....

http://wiki.xbmc.org/?title=HOW-TO_Encode_H.264_Videos_Compatible_With_XBMC_For_Xbox

It is not quite finished, so give me your feedback and I will make the appropriate changes...

The main thing is the new settings and the new resolutions we can achieve with both Deblocking and CABAC turned on!!!


- lingenfr_xbmc - 2008-07-16

JPS,

That is a great piece of work and you are to be commended for your effort. Has anyone done similar encoding in a linux environment? I tried meGUI via virtualbox under linux and the results were not impressive.


- Rand Al Thor - 2008-07-16

lingenfr_xbmc Wrote:JPS,

That is a great piece of work and you are to be commended for your effort. Has anyone done similar encoding in a linux environment? I tried meGUI via virtualbox under linux and the results were not impressive.

I have been working on finding the perfect settings for my XBMC Linux machine. However, I think JPSiemer would like to keep this thread specifically about XBMC for the Xbox. Perhaps we could start another thread for encoding for other platforms where the resulting video is not limited by the capabilities of the xbox hardware. Cheers.


- idahoxj - 2008-07-16

JPSiemer Wrote:The main thing is the new settings and the new resolutions we can achieve with both Deblocking and CABAC turned on!!!

In the new settings you have --nf as an option. What resolutions and bitrates have you used deblocking on successfully?


- PKOneTwo - 2008-07-17

JPSiemer Wrote:I am back with new settings and a new Wiki page....

http://wiki.xbmc.org/?title=HOW-TO_Encode_H.264_Videos_Compatible_With_XBMC_For_Xbox

It is not quite finished, so give me your feedback and I will make the appropriate changes...

The main thing is the new settings and the new resolutions we can achieve with both Deblocking and CABAC turned on!!!

Hey JP. I've done some researching in audio codecs (since i had my av receiver) and now I've got something here:

------------------------
As you may know AC3 Track gives alsmost the best quality, if you have a dvd source, becuase DVD is AC3 !!!
Why do you use still use AAC (when you have and DVD source).

Advantages of ac3:

- BETTER QUALITY (compared to AAC or Mp3 or OGG)
- NO CPU USAGE (almost every user has an AV receiver where you can pass through => 0% CPU Usage and letting x-box decode for people without av receiver =Y about 2-5% Usage)
- SMALL (it isn't as small as aac BUT it is not much bigger than usal MP3

If you have a DVD source its the BEST choice and your file will get about 50-70 megs bigger than usual AAC (depending on AAC Bitrate)!!!
---------------------

If you have a video where the audio source isn't AC3 (like MPG1 or some other codecs), I would use MP3 instead of AAC:

- if your video is not a dvd source, than (by a very extreme high percentage) it is already ripped and rencoded OR a bad quality =>
no need to use aac, ust use MP3, there won't be a less in the audio at all
- ALMOST every source is a DVD => AC3 or would you re-rip / re-encode an old rip
----------------------

I like AAC, but what i donÄt like about it is: it uses A LOT CPU RESOURCES, A LOOOOOOOT! It's about 20-30%.
I really like to see people using the CPU resources of about 20 - 30% for decoding the video, for instance in very complex scenes !!! Or for higher bitrates n the video !!!


- rcrh - 2008-07-21

JPSiemer Wrote:Please read the thread. Every single one of your questions has been answered. There is also a Wiki in which we have created on this subject...

http://www.wikihow.com/Properly-Encode-H.264-Video-Using-Megui-for-an-Xbox-Running-Xbmc

JP, I realize you've done a tonne of work getting this to work using MeGUI but is there any chance of getting your final results translated back into an advanced setting for Handbrake?

I just can't get past how easy Handbrake is compared to MeGUI. Particularly the amount of steps you have to go through BEFORE you start encoding.

thanks for all of this great work. I really hope the


- JPSiemer - 2008-07-23

rcrh Wrote:JP, I realize you've done a tonne of work getting this to work using MeGUI but is there any chance of getting your final results translated back into an advanced setting for Handbrake?

I just can't get past how easy Handbrake is compared to MeGUI. Particularly the amount of steps you have to go through BEFORE you start encoding.

thanks for all of this great work. I really hope the

Ya, Handbrake is easy to use but it just doesn't give me the freedom I need... Nonetheless, its great for the masses so give it a go...

Just input my settings into the GUI in the dialogue box and you're good to go... pretty simple task...


- JPSiemer - 2008-07-23

PKOneTwo Wrote:Hey JP. I've done some researching in audio codecs (since i had my av receiver) and now I've got something here:

------------------------
As you may know AC3 Track gives alsmost the best quality, if you have a dvd source, becuase DVD is AC3 !!!
Why do you use still use AAC (when you have and DVD source).

Advantages of ac3:

- BETTER QUALITY (compared to AAC or Mp3 or OGG)
- NO CPU USAGE (almost every user has an AV receiver where you can pass through => 0% CPU Usage and letting x-box decode for people without av receiver =Y about 2-5% Usage)
- SMALL (it isn't as small as aac BUT it is not much bigger than usal MP3

If you have a DVD source its the BEST choice and your file will get about 50-70 megs bigger than usual AAC (depending on AAC Bitrate)!!!
---------------------

If you have a video where the audio source isn't AC3 (like MPG1 or some other codecs), I would use MP3 instead of AAC:

- if your video is not a dvd source, than (by a very extreme high percentage) it is already ripped and rencoded OR a bad quality =>
no need to use aac, ust use MP3, there won't be a less in the audio at all
- ALMOST every source is a DVD => AC3 or would you re-rip / re-encode an old rip
----------------------

I like AAC, but what i donÄt like about it is: it uses A LOT CPU RESOURCES, A LOOOOOOOT! It's about 20-30%.
I really like to see people using the CPU resources of about 20 - 30% for decoding the video, for instance in very complex scenes !!! Or for higher bitrates n the video !!!

I really like this post. You make a lot of good, valid points.

However, keep in mind that I always re-encode AC3 6 Channel audio to AAC 6 channel audio so the difference is size is a couple hundred MB. On 2 Channel audio the difference is minimal, like you said. I would like to go to MP3, but you cannot encode 6 channel MP3's.

On that other hand, you are actually onto something.... And it might be worth the extra couple hundred MB to use AC3 -- or the loss of fidelity and 5.1 in MP3. You see, in my tests with these new encodes I have been doing, videos encoded with deblocking had no problem playing back IF no audio track was muxed. But the addition of the audio track to the same exact video brought back the skipping. At first, I didn't equate this to the AAC codec using so much power, but now it makes a lot more sense...

So, in theory, you should be able to use the current settings posted in the wiki along with deblocking (remove the "-nf" option) as long as your audio is AC3 or MP3.

It would be interesting to know how much CPU 6-Channel AC3 uses and how much CPU 2-Channel MP3 uses. I'm assuming your "2-5%" figure is for 2-Channel AC3...

Can you guys give this a test and post your results? I would but I'm still having slight computer problems... I think my mobo is slowly dieing!!!


- PKOneTwo - 2008-07-23

I'm happy being to help ;-)

i was referring to this: if you use Ac3 and have an Av receiver connected with toslink (digital connection) to X-box, so the Ac3 stream (doesn't matter 2 or 6 channel) is pass throughed to the receiver. There is no intervention of the xbox, no CPU usage, nothing! You can use 100% CPU for video.

If you don't have an AC receiver, then the x-box have to decode the ac3 stream to analoge output => for 2 channels about 2-3%. (i dind't test the 6 channels AC3 to 2 channel analoge conversion, but may be about 7%).

Anyway: since we are all using DVD as a source: you can take the AC3 stream and there will be NO LOSS (nothing) of sound quality, and CPU can be used 100% for decoding.
Yes AC3 is little bigger than than AAC, but the difference is 100 -150 MB /at most). And don't firget one thing: you still can reencode the 6 Channel AC3 to a lower bitrate (say 224 Kbit). Is will become a difference of about 75MB then and the sound ist still almost perfect.

--------------------
PS: I think if you use Mp3 the x-box CPU is used again (doesn't matter if you have Av receiver or not) because the decoding is done by the cpu. But the CPU usage is low (about 5%).
--------------------

So finally: keeping AC3 stream ist the best thing you can do:
you can reencode it to a lower bitrate AND uses very LOW cpou usage for analoge output und NO CPU for pass through.

hope could answer ur questions. Laugh

JPSiemer Wrote:I really like this post. You make a lot of good, valid points.

However, keep in mind that I always re-encode AC3 6 Channel audio to AAC 6 channel audio so the difference is size is a couple hundred MB. On 2 Channel audio the difference is minimal, like you said. I would like to go to MP3, but you cannot encode 6 channel MP3's.

On that other hand, you are actually onto something.... And it might be worth the extra couple hundred MB to use AC3 -- or the loss of fidelity and 5.1 in MP3. You see, in my tests with these new encodes I have been doing, videos encoded with deblocking had no problem playing back IF no audio track was muxed. But the addition of the audio track to the same exact video brought back the skipping. At first, I didn't equate this to the AAC codec using so much power, but now it makes a lot more sense...

So, in theory, you should be able to use the current settings posted in the wiki along with deblocking (remove the "-nf" option) as long as your audio is AC3 or MP3.

It would be interesting to know how much CPU 6-Channel AC3 uses and how much CPU 2-Channel MP3 uses. I'm assuming your "2-5%" figure is for 2-Channel AC3...

Can you guys give this a test and post your results? I would but I'm still having slight computer problems... I think my mobo is slowly dieing!!!



- rcrh - 2008-07-23

JPSiemer Wrote:Ya, Handbrake is easy to use but it just doesn't give me the freedom I need... Nonetheless, its great for the masses so give it a go...

Just input my settings into the GUI in the dialogue box and you're good to go... pretty simple task...

HEY, are you calling me massive? I might eat the occasional pizza entirely by myself, but come on!!!!

OK, kidding aside, way back on the first page of this thread you had handbrake settings as follows:

ref=5:mixed-refs=1:bframes=3:direct=auto:b-pyramid=1:weightb=1:brdo=1:bime=1:me=umh:merange=32Confusedubq=7:analyse=all:trellis=1:no-fast-pskip=1:vbv-bufsize=1000:vbv-maxrate=10000:cabac=0:nr=0:deblock=-1,-1

Are these still your final & best recommendations?

I ask because I see you've done a lot of further testing in megui. If any of these improvements can be translated back to HB I would be appreciative.

thanks again
Richard.


- JPSiemer - 2008-07-24

rcrh Wrote:HEY, are you calling me massive? I might eat the occasional pizza entirely by myself, but come on!!!!

OK, kidding aside, way back on the first page of this thread you had handbrake settings as follows:

ref=5:mixed-refs=1:bframes=3:direct=auto:b-pyramid=1:weightb=1:brdo=1:bime=1:me=umh:merange=32Confusedubq=7:analyse=all:trellis=1:no-fast-pskip=1:vbv-bufsize=1000:vbv-maxrate=10000:cabac=0:nr=0:deblock=-1,-1

Are these still your final & best recommendations?

I ask because I see you've done a lot of further testing in megui. If any of these improvements can be translated back to HB I would be appreciative.

thanks again
Richard.

No... these settings are outdated. It is not hard to translate the settings from MeGUI to Handbrake as they use the same language.

Anyways, I'm using the latest snapshot of HB @ http://handbrake.fr/?article=snapshot -- though, it probably doesn't matter if you are using the previous version.

Video Tab:
Framerate: Whatever
2 Pass Encoding: CHECK
Average Bitrate: Use The Wiki Chart

Audio & Subtitle Tab:
Audio Codec: MP3, Vorbis, or AC3 (No AAC!)
Bitrate: Anything

Advanced Tab:

Quote:ref=6:bframes=6:weightb=1:brdo=1:me=umh:merange=32Confusedubq=7:trellis=2:no-fast-pskip=1:analyse=p8x8,b8x8,i4x4:nf=1:level=4.1:ratetol=20.0

The Advanced tab must match these values (or lower). All other settings in all the other tabs can be set to whatever you want (except for the couple of settings listed above).

NOTE: I have not tested these settings on Handbrake but they should work fine.


- JPSiemer - 2008-07-24

Well, after some initial tests with audio codecs, it seems that AC3 is going to the best option for people encoding H.264 for the Xbox.

My first test was encoding a video with 6-Channel Vorbis OGG and encoding the same video with 6-Channel AAC. I purposely maxed out the video settings on both to force skipped frames. That resulted in two videos that skipped a TON of frames, however the AAC file skipped a lot more than the OGG.

So then I encoded that same video with the same settings with 6-Channel AC3 audio, and that resulted in a video that dropped 40% less frames than the OGG and AAC.

So that proves that if you are looking to preserve your 6 channels, go with AC3 no matter what. The Xbox has less trouble decoding this format than any of the others.

I did not test MP3 yet, but seeing as you can't make a MP3 truly 6-channel, it would be safe to assume that the Xbox requires very little processing power to decode a 2-channel MP3, and probably even less for a 2-channel OGG (because OGG requires less CPU power than MP3). So if you are going for 2-channel audio, then I suggest either MP3 or OGG or AC3, but NEVER AAC.

So, to break it down...

6 Channels
--- AC3 (best option)
--- OGG (for vids with NO complex scenes)
--- MP3 (not possible)
--- AAC (never use)

2 Channels
--- AC3 (best option)
--- OGG (2nd best)
--- MP3 (3rd best)
--- AAC (for vids with NO complex scenes)

Hope this helps everyone out... Thanks goes to PKOneTwo for the valuable tip.


- PKOneTwo - 2008-07-24

Glad to see this (like i mentioned before) Laugh

But don't forget THE BEST PART: IF YOU passthrough THE AC3 (channles doesn't matter), the CPU won't be used in anyway. Because the decoding is done by the AV receiver. Nod

JPSiemer Wrote:Well, after some initial tests with audio codecs, it seems that AC3 is going to the best option for people encoding H.264 for the Xbox.

My first test was encoding a video with 6-Channel Vorbis OGG and encoding the same video with 6-Channel AAC. I purposely maxed out the video settings on both to force skipped frames. That resulted in two videos that skipped a TON of frames, however the AAC file skipped a lot more than the OGG.

So then I encoded that same video with the same settings with 6-Channel AC3 audio, and that resulted in a video that dropped 40% less frames than the OGG and AAC.

So that proves that if you are looking to preserve your 6 channels, go with AC3 no matter what. The Xbox has less trouble decoding this format than any of the others.

I did not test MP3 yet, but seeing as you can't make a MP3 truly 6-channel, it would be safe to assume that the Xbox requires very little processing power to decode a 2-channel MP3, and probably even less for a 2-channel OGG (because OGG requires less CPU power than MP3). So if you are going for 2-channel audio, then I suggest either MP3 or OGG or AC3, but NEVER AAC.

So, to break it down...

6 Channels
--- AC3 (best option)
--- OGG (for vids with NO complex scenes)
--- MP3 (not possible)
--- AAC (never use)

2 Channels
--- AC3 (best option)
--- OGG (2nd best)
--- MP3 (3rd best)
--- AAC (for vids with NO complex scenes)

Hope this helps everyone out... Thanks goes to PKOneTwo for the valuable tip.



- seph100 - 2008-07-26

Forgive me if this is noobish question as I am new to the encoding process. I followed your wiki article to the T but I am getting an error. MeGUI will encode the audio but when it moves onto what should be the first pass through the video it comes up with this error:

An error occurred: x246 [error]: ratecontrol_init: can't open stats file
An error occurred: x264 [error]: x264_encoder_open failed

This lead me to believe that the problem was with the --stats file part of the command. I created the file manually and I still get the error. I have searched on google to no avail. Any help would be greatly appreciated.


This forum uses Lukasz Tkacz MyBB addons.