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-05-27

Created a temporary Wiki for now...

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


Used settings got bigger file with no sound. - Witchdoctor - 2008-05-27

Im sure this is my Layer 8 problem but when I used your settings I got a bigger file 1.8g vice 1.5g with most of the movie with no sound. The funny thing is that the 1.5g file has original audio where as the 1.8 audo has been compressed with NeroAac. I am sure there is something I did wrong but I added your settings like you stated. Another note is that it took me 10 hours to encode which is crazy. But I know you said megui does take longer. Anyhelp on this problem I would be so greatful.


WitchDoc


- JPSiemer - 2008-05-27

Your filesize is directly related to your bitrate setting. The bitrates I recommend for each resolution are the MAXIMUM allowed bitrates, which means you are safe to go lower, but not-so-safe to go higher. In any case, I am rethinking the bitrate scenarios described above, because I think I can find a common ground value for most resolutions. I will post more optimized settings tonight.

Your sound problem has nothing to do with my guide. Instead of reencoding the audio, just incude the original, untouched AC3 from the DVD and see what happens... To accomplish this without reecoding, just use the program called MKVMerge and remux the file with the AC3 audio track. It is going to make your filesize a lot larger, but if that's what you want, then go for it! Remuxing MKV files only takes a matter of a minute or two.

And not sure about your encoding time, but on my quad-core processor it only takes 2 hours to encode a 2 hour movie. It probably takes so long also, because I recommend enabling the most advanced options of the x264 codecc, which slows down encoding speed, but increases overall quality. One thing you can try is setting subme=5. That should cut down the time a little bit, but, again decreases quality.

Maybe my settings are a little too much... That is why I am posting on here to see if others can "optimize" my reccommended settings...


- JPSiemer - 2008-05-28

Well, after further testing, it looks like you can encode videos with my settings at *ANY* bitrate and still get an Xbox-compatible file.

It's funny because, upon research of playback of H.264 on XBMC, many people were saying the same things... Keep video resoultion under :: 720 x 400. No Deblocking, No CABAC, No HE-AAC Audio, etc. And I have managed to encode a H.264 video @ 720x480 @ 1500 KBps With CABAC and HE-AAC audio, therefore disproving all those myths except for the one about no deblocking. However, with my profile there is no need for deblocking, because aparantly the CQM I am using handles deblocking in it's own way...

This is very exciting for me, as I am now re-ripping every DVD I can get my hands on! Again, I will not give up on testing until I beleive that my custom x264 options are *perfect* for XBMC.

Stay tuned for more updates!


Succesfully Converted with Avi container... - Witchdoctor - 2008-05-28

Well for all you UpNp Streamers out there. I have managed to create the avi container with Jp settings. I think my file size and encoding speed was longer last time because I had the older version of x264. This time it knocked 4 hours of the encoding time. Of course I used the original audio because for some reason when I use nero's aac I tend to get the chinese talking if I try to skip threw scenes Big Grin. My only problem now is I get perfect sync with audio but I can't skip threw scenes anymore. Is there a way to add this into the output?


- JPSiemer - 2008-05-28

Chinese talking when skipping through scenes? Witchdoctor, I think your problem is that you are encoding more than 1 audio track. On the main screen of MeGUI, make sure that there is only a tab titled "Track 1", if you see "Track 2" or "Track 3" or more, then turn those tracks off by pressing the "X" button under the track's tab.

And about not being able to skip scenes... I had the same problem you are experiencing when trying to skip scenes with the .MP4 container. Looks as though my settings do not play well with these older containers, probably due to the fact that we are encoding our files with advanced settings.

Anyways, the good news is you don't have to re-encode, you can just remux the file to MKV with a program called "MKVMerge" and deselect the Audio tracks you don't need (just need one English track). Remuxing only takes a matter of a minute or so, even with 2GB files. The bad news is that it looks like you can't use a MKV with your UpNp, so I'm not sure what to tell you...


Usage with HandBrake - geosmack - 2008-05-29

Great work on finding these settings.

My fastest computer is Linux only so I wanted to use the HandBrakeCLI to encode. I rewrote the command line for HandBrake and was able to create an MKV file with no problems. I prefer to just pass through the AC3 audio instead of transcoding to aac, but either way works fine.

Here is my HandBrakeCLI command

~/HandBrakeCLI -f mkv -e x264 -b xxxx -E ac3 -U -F -N eng -x ref=5:mixed-refs=1:bframes=4:direct=auto:b-pyramid=1:weightb=1:brdo=1:bime=1:me=umh:8x8dct=1:trellis=1:no-fast-pskip=1:vbv-bufsize=1500:vbv-maxrate=5000:nr=0Confusedubme=7:no-psnr=1:no-ssim=1:ratetol=4.0:nf=1Confusedubme=7:partitions=all l -i DVD.ISO -o movie.mkv

This will encode the main movie to MKV format. I ran some test encodings with a couple of chapters from a movie and it played fine on XBMC.

So far it looks great, seeking is much improved over my previous set of options, and I get to use the original AC3 for sound.

Please let me know if I missed anything. Thanks.


- JPSiemer - 2008-05-29

Geosmack, you are missing: keyint=480:min-keyint=24. Not sure how much of an effect it has, but if it's not neccessary then let me know... Also, you didn't use the custom CQM, and opted for Trellis=1 ... I wonder how much of a difference there is? I heard the EQM_AVC_HR.cfg CQM is really efficient...

I like how you pass-through the original AC3, is there a way to do this in MeGUI? The only option I have seen is to actually re-encode the AC3 to AC3, which to me seems like an unneccessary step...

Also, amazing how you were able to get my settings to work on Handbrake. I never used the CLI version, but I used the GUI for Windows and my videos were coming out all skippy... That is why I switched over to MeGUI.

Anyways, thanks for the report... Good to see its working well for others... Now, only if we could get the scene to make it a standard! I am thinking of coining the name "xBox264" for Xbox-compatible H.264 videos encoded with the x264 encoder. What do ya guys think? Lets get the ball rolling on this...


Handbrake - geosmack - 2008-05-29

I added these options in and ran a test encode. There was heavy stuttering and jerkiness to the picture. After a couple of tests I found keyint=480:min-keyint=24 to be the culprits. I removed them and everything seems to work just fine. I am not sure if these are needed or just need to be adjusted.

Here is my final command line:

~/HandBrakeCLI -f mkv -e x264 -E ac3 -U -F -N eng -x ref=5:mixed-refs=1:bframes=4:direct=auto:b-pyramid=1:weightb=1:brdo=1:bime=1:me=umh:8x8dct=1:no-fast-pskip=1:vbv-bufsize=1500:vbv-maxrate=5000:nr=0Confusedubme=7:no-psnr=1:no-ssim=1:ratetol=4.0:nf=1Confusedubme=7:partitions=all:cqmfile=/path/eqm_avc_hr.cfg
-i DVD.ISO -o movie.mkv -b xxxx

Also, I think your suggested naming standard is great.


- JPSiemer - 2008-05-29

Well, I believe that most encoding programs default to keyint=240:min-keyint=24 & keyint=250:min-keyint=25, depending on your framerate -- usually 23.976 (24) or 25 FPS... Handbrake automatically sets it to one of these two based on your framerate.

I set mine to keyint=480:min-keyint=24 & keyint=500:min-keyint=25 because it sets double the keyframes... Again, i'm no expert on what it does, but I think it adds a lot more information to the file, and that might be why you are experiencing the jerkiness.

Again, thanks for your input Geosmack... i might do a couple tests with and without this set and see if it changes anything for me... Also, did you find that using the CQM was any better than setting Trellis?

What do other people think about setting the keyint value? does it work better or worse for you guys?


Info about the Upnp... - Witchdoctor - 2008-05-29

JP I still don't know why I get sync issues with the Neroaac. But any video I encode using the original sound I get perfect sync. Now for the Upnp issue I figured that one out. There seems to be an issue with XBMC when using the skipping options using Upnp sources. However if you connect via SMB everything works fine. So with that said the container can be MKV, AVI, or MP4 (MKV) being the favorite here Big Grin as long as you use SMB.

I want to try those settings for Handbreak... Megui is not newb friendly lol.


- JPSiemer - 2008-05-29

Witchdoctor, ya if the original AC3's work for you, then great! I only prefer AAC because it is supposedly better and compresses smaller... well, at least I read that it was better! I don't mind compressing something if I don't notice the difference...

Let me know what kind of progress you get with Handbrake... they aren't using the latest x264 version, but my xBox264 settings should still get you good results according to Geosmack's report!


- JPSiemer - 2008-05-29

Oh, I wanted to ask you guys... how are my suggested bitrates holding up? Obviously, I didn't test each and every one, so I would like to know if they are working out or if they need adjusting...


- geosmack - 2008-05-29

I did a couple of encodings with my settings from above and I think they looked great. I have an older 50" HDTV and I would say the mkv looked 99% as good as the DVD (played both through XBMC).

Also, has anyone else noticed a slight shift to the green in the picture of the encoded file? I'm not sure if it's just my imagination or a real issue.


- geosmack - 2008-05-29

Regarding the bitrate question, I used bitrates between 1100 and 1200 and it seemed fine to me. I did some tests at higher bitrates and any noticeable difference wasn't enough to warrant the extra space. A 90 minute movie with AC3 sound and a 1200 bitrate comes out to just under a gig. I like this since this will fit onto a cheap 1 gig flash drive and gives a great picture. For longer movies, I would probably go to 1.4 gigs.


This forum uses Lukasz Tkacz MyBB addons.