Handbrake Preset for XBMC4XBOX

If you need any help with XBMC4XBOX, such as installing or using the software, please post it in here.
Post Reply
poshea
Posts: 44
Joined: Tue Jul 16, 2013 7:13 am
Has thanked: 3 times
Been thanked: 1 time

Handbrake Preset for XBMC4XBOX

Post by poshea » Tue Aug 06, 2013 4:14 am

I need to batch encode a whole bunch of h.264 files that overload my xbox (CPU overload/dropped frames). Does anyone have a handbrake preset I could download that is setup for the optimal quality encode for xbmc4xbox? Would be greatly appreciated! Thanks :P

poshea
Posts: 44
Joined: Tue Jul 16, 2013 7:13 am
Has thanked: 3 times
Been thanked: 1 time

Re: Handbrake Preset for XBMC4XBOX

Post by poshea » Tue Aug 06, 2013 4:41 am

Found this: http://www.xbmc4xbox.org.uk/wiki/HOW-TO ... 264_videos

Dates back o 2010, and designed more for ripping from DVDs but tweaked a few settings and seems to work ok.

User avatar
bigkidoz
Posts: 638
Joined: Thu Jul 12, 2012 4:33 am
Location: Melbourne, Australia.
Has thanked: 19 times
Been thanked: 35 times

Re: Handbrake Preset for XBMC4XBOX

Post by bigkidoz » Tue Aug 06, 2013 4:54 am

I do have the xbox preset file that a former member out up on the old site, i'll see if i can locate it tonight.
It is for the MKV container but works really well.
Sent from my android coz apple is for pie.

User avatar
Kozz
Posts: 238
Joined: Wed Jul 04, 2012 4:42 am
Has thanked: 22 times
Been thanked: 51 times

Re: Handbrake Preset for XBMC4XBOX

Post by Kozz » Tue Aug 06, 2013 8:28 am

I don't have a handbrake preset, But I was recently ripping and re-encoding some dvd's to MKV for optimal playback with a program called Tipard. I tested different software to find this one had the fastest encoding time when the Nvidia GPU Acceleration was enabled (see image below). I was ripping a 6.2 GB film in about 20 minutes with an old GeForce 9500 GT installed to one of my extra PCI-e slots so it was running at pci-e 8x. I had poor performance with an ATI card, but that I'll share in another post.

Below is a pic of my encoding settings that might help you setup your handbrake, These gave me an MKV of about 1.2 GB from the original 6.2GB film with amazing image quality that plays flawlessly on an xbox, I was seeing between 85% and 95% CPU usage and about 70% - 80% vpu/gpu usage on the xbox with 0 dripped frames ;) So it seems to be the sweet spot for xbox playback.

Buzz has also mentioned some very helpful info for encoding to MKV in another thread that he uses personally, I'll add that link here too once I find it.
EDIT: Ok here is the post I was talking about, http://www.xbmc4xbox.org.uk/forum/viewt ... 6120#p6120
its for re-encoding 1080p videos to 720p MKV for xbox playback, so depending on the size of your source videos you wish to encode and the resolution your running your xbmc4xbox in you can adjust your handbreak settings to fit your screen, Just notice he uses a variable bitrate that starts at 3000k but no more than 5000k with 1280x720 resolution. Experiment until you find the combo that best suits your needs.

Good Luck :)

Image
Image

User avatar
2 Bunny
Posts: 99
Joined: Mon Dec 31, 2012 4:55 pm
Location: United States
Has thanked: 13 times
Been thanked: 3 times
Contact:

SUGGESTION Reply

Post by 2 Bunny » Tue Aug 06, 2013 5:19 pm

If you're looking for higher than standard def resolution, there's a miracle little command line based tool called "FF MPEG" that will do the job quite nicely for you.
Now part of the All New Channel 2012 Network.
Image

poshea
Posts: 44
Joined: Tue Jul 16, 2013 7:13 am
Has thanked: 3 times
Been thanked: 1 time

Re: Handbrake Preset for XBMC4XBOX

Post by poshea » Thu Aug 08, 2013 4:39 am

Ended up starting my batch encode with a slightly modified version of the handbrake preset I posted above.

It encodes a MKV file using h264 yuv420p @ 720x540 but with a bunch of advanced options I don't understand.
Video data rate is around 2.2mb/s
Audio data rate is around 125kb/s
I changed audio to AAC (coreaudio) 44.1 160 bit rate

The output files seem to hover around 85-90% with no dropped frames which seems to be a good sweet spot. These are recently digitized VHS tapes - so I'm not overly concerned about quality.

I'm interested in trying Tippard for the speed of encoding factor! I see they have a mac version. 20mins sounds impressive. My current encodes are taking 2-3 hours each. Although I am on an old MacBook core 2 duo (its about 8 years old :roll: ) ... But then the xbox is 12 years old sooo

Will try try this one next time...
BuZz wrote:
i use (commandline ffmpeg)

CODE: SELECT ALL
ffmpeg -i some_1080p_infile.mkv -scodec copy -acodec copy -vcodec mpeg4 -b:v 3000k -maxrate 5000k -bufsize 4096k -s 1280x720 -f matroska -y outfile.mkv


single pass (as I transcode in realtime using mediatomb), but results look decent.

poshea
Posts: 44
Joined: Tue Jul 16, 2013 7:13 am
Has thanked: 3 times
Been thanked: 1 time

Re: Handbrake Preset for XBMC4XBOX

Post by poshea » Sat Aug 10, 2013 3:27 am

Hmmmm.... Back to the drawing board for me. I've had a closer look at the video files encoded using the handbrake preset above. They actually only play without dropped frames provided I have :

SETTINGS | VIDEO | PLAYBACK | H.264 Skip Loop Filter set to "Skip Everything" or "Skip Non Key Frames"

If I try anything else I only get about 12 frames per second (lots of dropped frames)

I notice with this H264 skip loop filter setting (SKIP EVERYTHING or Skip Non Key Frames) the picture starts relatively clear, and then progressively gets more blocky over about 8 seconds, then the image suddenly goes clear again before progressively getting more blocky over the next 8 seconds and so on.

If I use any other preset for the h264 skip loop filter setting, (default or skip bidirectional frames or skip non referenced frames) this does not happen, the image stays relatively clear - but the CPU maxes out and it drops to about 12 frames a second.

Is anybody else playing h264 files with the h264 skip loop filter setting set to anything other than "Skip Everything??

I'm going to try encoding a file using the ffmpeg command line buzz posted and see how that goes...

Edit: ok, worked out the command line... Ffmpeg is processing. Considerably faster processing then handbrake, 50fps compared with about 12fps.... I'll update when it's done encoding....

poshea
Posts: 44
Joined: Tue Jul 16, 2013 7:13 am
Has thanked: 3 times
Been thanked: 1 time

Re: Handbrake Preset for XBMC4XBOX

Post by poshea » Sat Aug 10, 2013 4:02 am

Ok, this ffmpeg command line is spot on. Quality is excellent, no blockiness, doesn't matter what I have the H264 skip loop filter set to, it still plays smooth without dropped frames. It encodes 4 times faster than handbrake did AND the end file was almost identical in size to the original mp4 file that would not play without maxing out CPU. I'm impressed, should have tried this first.

Now... I have about 100 files to convert. Anyway know how to edit the command line to process all files within a folder, or folders and sub folders would be even better!! HELP!

This is the command i used: ffmpeg -i /folder/testfile.mp4 -scodec copy -acodec copy -vcodec mpeg4 -b:v 3000k -maxrate 5000k -bufsize 4096k -s 1280x720 -f matroska -y /folder/outfile.mkv

I use terminal on Mac 10.6.8

poshea
Posts: 44
Joined: Tue Jul 16, 2013 7:13 am
Has thanked: 3 times
Been thanked: 1 time

Re: Handbrake Preset for XBMC4XBOX

Post by poshea » Sat Aug 10, 2013 7:33 am

OK, have been playing with some code that can do a batch code of all files in a folder with FFMPEG. Here is where I'm up to:

Code: Select all

for f in /Volumes/TimeMachine/MP4/Shannon/School/*.mp4
do 
/ffmpeg/ffmpeg -i "$f" -scodec copy -acodec copy -vcodec mpeg4 -b:v 2200k -maxrate 5000k -bufsize 4096k -s 1280x720 -f matroska -y "/Xbox${f%.mp4}.mkv"
done
This code is sourcing the mp4 content from an external HDD, I've lowered the data rate to 2200 - only because I dont quite have enough room left on my xbox internal drive to fit everything I want at the higher data rate. The processed MKVs end up in an XBOX folder on my laptop system HDD - this code doesn't seem to create the subfolders for me - so I have to create them manually before processing. Then I'll FTP them across to xbox latter. Im reading about playing with this code a little to enable the processing of files within subfolders also... making progress...

I'm new to working with this kind of code - so any tips or advise is welcome! Thanks.

mrdally204
Posts: 37
Joined: Tue Jul 31, 2012 5:37 am
Has thanked: 6 times

Re: Handbrake Preset for XBMC4XBOX

Post by mrdally204 » Mon Aug 12, 2013 5:27 pm

If I am reading that cmd line correctly, it is using the original audio file. What is the encoded audio type you are having success with? Is it encoded Dolby Digital, AAC, MP3? Will it work for all, or only certain types of encoded audio?I have a mixed bag of mkv files containing any and all the above audio types.

poshea
Posts: 44
Joined: Tue Jul 16, 2013 7:13 am
Has thanked: 3 times
Been thanked: 1 time

Re: Handbrake Preset for XBMC4XBOX

Post by poshea » Tue Aug 13, 2013 2:32 am

Its a good point. In my case, the original files used AAC audio, stereo, 48000 128kb. So using this command keeps the original audio and just re encodes the video stream.

The thread I was directed to for this ffmpeg command http://www.xbmc4xbox.org.uk/forum/viewt ... 6120#p6120 indicates it was written to specifically keep the original audio and subs and only re-encode the video into an optimum format for xbmc.

I'm assuming you could add to the command if you wished to change the audio stream - (you'll have to google for the code) - but there may be no need to. Try encoding a few files with different audio formats... My guess is they will all work regardless of the audio format(surround/stereo). Let us know.

User avatar
BuZz
Site Admin
Posts: 1889
Joined: Wed Jul 04, 2012 12:50 am
Location: UK
Has thanked: 62 times
Been thanked: 422 times
Contact:

Re: Handbrake Preset for XBMC4XBOX

Post by BuZz » Tue Aug 13, 2013 2:48 am

I have an AV receiver, so always want to keep the original audio. decoding high bitrate 5.1 AC3/DTS can use some cpu power if you dont have digital out and an av receiver, so you could re-encode it to stereo mp3. however you will probably find the xbox handles it fine without re-encoding.

mrdally204
Posts: 37
Joined: Tue Jul 31, 2012 5:37 am
Has thanked: 6 times

Re: Handbrake Preset for XBMC4XBOX

Post by mrdally204 » Tue Aug 13, 2013 5:20 am

Thanks for the info. My main concern was having a video with aac audio. I feared aac with high resolution x264 would result in an Xbox freeze.

poshea
Posts: 44
Joined: Tue Jul 16, 2013 7:13 am
Has thanked: 3 times
Been thanked: 1 time

Re: Handbrake Preset for XBMC4XBOX

Post by poshea » Tue Aug 13, 2013 6:37 am

Just a note on something I've just noticed.

I noticed the xbox was showing the video codec as "MPEG4" for the files encoded with FFMPEG using the command line. Other files in my library were showing as AVC1/0x31637661. I've read up that AVC1 is essentially the h264 codec. My original encodes that had CPU overloads used handbrakes h.264 codec.

So, I had another look at the handbrake options - you can choose your format/container : .MP4 or .MKV
Then you can choose your codec H.264 (x264) or MPEG-4 (FFmpeg)

So, by choosing the MKV container, the MPEG-4 (FFmpeg) codec, and setting the other variables as per the command line (average bit rate 3000, output resolution 1280x720 etc ... You could set the maximum bit rate, buffer size and other settings in the advanced option string) - in theory you'll get identical results. For those happy to use the command line, it doesn't really matter- but for those preferring to use a GUI - than handbrake could be used to process a file in the exact same way that the ffmpeg command line does (I think). You also then have easy access to changing preferences for audio format, subtitles, chapters etc without having to work out the code.

shady7
Posts: 85
Joined: Fri Aug 03, 2012 6:45 am
Has thanked: 1 time
Been thanked: 4 times

Re: Handbrake Preset for XBMC4XBOX

Post by shady7 » Tue Aug 13, 2013 7:35 am

Yeah that's how I have been using handbrake. Container MKV video codec ffmpeg-4, bitrate 3000kbps, AAc audio, 2 pass encoding. I have tried output resolution at 1280x720 but it just chokes the xbox I normally just select 720x304 and it looks quite good. I am interested in the advance options string handbrake has but have no idea how to use them, would that command line you are using work with this.

poshea
Posts: 44
Joined: Tue Jul 16, 2013 7:13 am
Has thanked: 3 times
Been thanked: 1 time

Re: Handbrake Preset for XBMC4XBOX

Post by poshea » Tue Aug 13, 2013 9:41 am

I'll break the code down...

Code: Select all

ffmpeg -i some_1080p_infile.mkv -scodec copy -acodec copy -vcodec mpeg4 -b:v 3000k -maxrate 5000k -bufsize 4096k -s 1280x720 -f matroska -y outfile.mkv
ffmpeg | run ffmpeg
-i some_1080p_infile.mkv | sets input file. (does not need to be .mkv or 1080p)
-scodec copy | copies subtitles if any
-acodec copy | copies audio stream from original to new file (no change in audio format between input and output)
-vcodec mpeg4 | sets video codec to mpeg4
-b:v 3000k |Sets video bit rate to 3000k
-max rate 5000k | sets max data rate to 5000k
-bufsize 4096k | sets buffer size
-s 1280x720 | sets resolution
-f matroska | output file type/forces MKV container for output file
-y | overwrite output files without asking
Outfile.mkv | output file name.

So, in handbrake - choose MKV format

Video settings | MPEG- 4 (Ffmpeg) / Average bitrate 3000kbps / Framerate (same as source) / (optional 2 pass encoding)
Audio settings | Codec - auto passthru
Subtitles | as you wish
Chapters | as you wish
Advanced | -max rate 5000k -bufsize4096k

Problem.
Picture settings | Want to set 1280x720 but cannot config if source file is lower res.
Not sure if advanced strings are actually being used.. Are they correctly formatted ?? Ugh I'll stick with ffmpeg for now....

Post Reply