Encoding XBox 360 compatible WMV-HD Movies from Blu-ray and MKV

Posted on October 19th, 2008 by Donace in How to, Ripping and Converting

Part 1 Creating a WMV w/ 5.1 audio

Tools you will need:

Ripping Tools
AnyDVD HD
tsMuxeR*
BDInfo* (http://www.cinemasquid.com/Tools.aspx)
MkvToolnix* (need mkvextract for ripping subtitle files from mkv)

Encoding Basic’s

Codecs and such
FFDShow*
Core AVC Codec (optional)
Haali’s Spliter*
WMP11 or Windows Media Format SDK 11 x86 Runtime**
**(http://www.citizeninsomniac.com/WMV/wmfdist11.exe)(10MB) needed only for XP

Software

Expression Encoder 2
Windows Media Encoder 9*
TMPGEnc 4.0 XPress

Encoding Advanced

SupRip*
VobSub*

* its all free software, google it :D

Step 1

First things first, download/install required software. Configure FFDShow to decode MPEG2 (libmpeg2) and h264/AVC (libavcodec), unless you have Core AVC installed.

You will also need AnyDVD HD installed for ripping From Bluray with

First step, getting the movie off of the Blu-ray disc and onto your Hard Drive.

Before we start, it might be a good idea to create a folder to place all the various files you will be creating/extracting. I will refer to this as the ‘Movie’ folder

A little background – When I first started ripping Blu-ray’s I was having all sorts of problems. To decrypt the files on Blu-ray discs, I use AnyDVD HD. I was having a hell of a time ripping the files and losing connection to my Blu-ray drive. It all boiled down to me not setting the Region setting on my Blu-ray drive. So, if you haven’t done this already, I would suggest doing so.

There are two ways movies are written to Blu-ray discs. You have the basic way, storing the entire movie inside a single .m2ts file with the different audio tracks and subtitle streams, or a more advanced branching stream title, in which the movie is stored inside different, and possibly optional, .m2ts files depending on which version of the movie you wish to watch.

To determine what you actually want to rip, you must look at the size of the files in the
BLURAY>BDMV>STREAM folder. If you have one very large .m2ts file and many small ones, it is probably safe to assume the largest contains the entire movie. If there are numerous medium sized files, you may have a title with branching streams.

If your entire movie in one file, open tsMuxeR and add that file. You can then select the video stream and the desired audio stream (along with subtitle streams if needed) and mux those into a new .m2ts file. Make sure you click the box to ‘Downconvert HD audio’ for your audio track if applicable (makes conversion easier). Save this in your Movie folder.

If your movie has branching streams, you will need to determine which stream you want. Open BDInfo and direct it to your Blu-ray drive. It will list all the titles on the disc and tell you which playlist file they are associated with. You can then open tsMuxer and add that playlist file (.mpls) from the BLURAY>BDMV>PLAYLIST folder. You can then select the video stream and desired audio stream (along with subtitle streams if needed) and mux them into a new .m2ts file on your Hard Drive. Make sure you click the box to ‘Downconvert HD audio’ for your audio track if applicable. Save this in your Movie folder.

Demux Audio (and subtitles)

Unless you only want stereo audio, you will first need to demux the audio from your new .m2ts or .mkv using tsMuxeR. If there is a subtitle track you want to ‘burn’ into the wmv, you will need to demux this also or download a pre ripped one. If the subtitle is in an mkv file, you will need to use mkvextract or similar. Save these in your Movie folder.

Subtitles

Unless you can find a pre ripped subtitle, you will need to OCR the subtitles that came with the Blu-ray.

Open SupRip and then open your sup subtitle file. For the OCR options, I have found that Space Width – 9, Character Split Tolerance – 2, and Character Similarity Tolerance – 8 yield the best results for me, your mileage may vary. Click the OCR button and then enter the characters that it asks for, making sure you do each image/line. When finished, change to the SRT tab and save as a .srt file with the same name as your m2ts file. To double check everything, open your m2ts file in WMP and skip to a part with subtitles to make sure they play along with the video. If they don’t play, VobSub isn’t set up properly. If you want to change font, size, or placement, now is the time to do it. Open VobSub and change what you need to.

Encoding Video

If your encoding from a mkv file, you may first need to mux this into a m2ts container with tsMuxer. Open tsMuxerGUI and click the add button. Select your video and audio tracks. Choose M2TS muxing as your output, browse to your Movie folder, and hit the Start muxing button.

Ok, open EE2 and go to ‘Tools->Options->Compatibility’, and near the bottom of that window uncheck ‘Allow hardware accelerated decode’. You’re not trying to encode and stream live video, so there is really no need for this. I have also had EE2 crash with this enabled with no warning.

Next, click the Import button and navigate to your Movie folder. Just above the ‘Open’ and ‘Cancel’ buttons there is a dropdown list, change this to read All Files (*.*) Select your m2ts or mkv file and click ‘Open’. EE2 will load all codecs it can find installed on your computer, and this may cause problems, so go back to ‘Tools->Options->Compatibility’ and uncheck everything except for the following items:

AC3Filter
CoreAVC Video Decoder (if installed
ffdshow Video Decoder
Haali Media Splitter (AR)
DirectVobSub (if your using subtitles)

*While preferable, this isn’t absolutely necessary. This is only to remove any possible conflicting codecs before we start, as those are the only required codecs/splitters. If you can preview your video inside EE2, you should be fine.

Now on to settings. I use the following (I am only listing changes from default):

Profile:

Video
Profile – VC1 Advanced Profile
Mode – VBR peak constrained
Bitrate (average) – whatever bitrate you want/need (bitrate calculators at end of guide)
Peak bitrate – 14000
Width – 1920 or 1280
Height – 1080 or 720

Audio – uncheck this box, as EE2 doesn’t encode 5.1 audio, unless you only want stereo audio

Video Profile:

Size
Mode – Profile (not Profile Adaptive) (*This is only really necessary if you will be converting into a BD format for the PS3. The XBox 360 and PC don’t care if your video is letterboxed or not.)

Crop – you will want to uncheck the ‘Maintain Aspect Ratio’ box and then adjust the ‘Top’ and ‘Height’ boxes to crop out any black bars you have, if you have any.

Pre-Processing: Unless you are resizing or dealing with interlaced video, there is no need to change anything here

Advanced Codec Settings:

Presets
Video Complexity – Fastest (0) (I don’t see a noticeable difference when changing this, only with encoding
time)

Perceptual Optimizations
DQuant – I Frames (this will add to encoding time and may throw off your bitrate calculations, but I use it. It prevents blocking in dark areas and in gradients.)

Filters

In-Loop on, the rest off

Motion Estimation (will add to encoding time, you can leave these default if you need to, at the cost to quality)

Chroma – Adaptive True Chroma
Match – Adaptive
Search – Adaptive

After everything is set, hit the ‘Encode’ button… and wait. A 1080p movie, with the settings above, usually takes around 12 hours on my C2D Q9550 2.83GHz quad core w/ 4GB of ram. It will take my HTPC with an AMD X2 4000+ 2.1 GHz w/ 2GB of ram about 24-36 hours or so  depending on the movie.

By default, the wmv file will be saved in your Documents > Expression > Expression Encoder > Output folder inside another folder that is date and time stamped. Copy your wmv from this folder into your ‘Movie’ folder.

Encoding / Muxing 5.1 Audio

Ok, there are many ways to encode wma files, but I will be outlining how to do it with TMPGEnc for two reasons. First, I can use just about any type of source file, and second, every now and then, the audio delay will be set wrong, and I can correct this before encoding.

Open TMPGEnc 4.0 XPress and click the Options button and choose Preferences. Choose to ‘Start a new project’, click ‘Add file’ and select your newly encoded wmv file. A new window will pop up displaying the clip settings for your video. In the Audio box, click Browse… and open your ac3/dts/mp3 file you demuxed from your m2ts or mkv file, then click yes on the following box.

Click the ‘Cut-edit’ button and hit the play button to preview your video and audio together to make sure everything is in sync. Skip to a part with dialouge to make sure speech matches the lip movements. You can adjust the sync in the ‘Audio gap correction:’ box in the bottom left. If the audio is early, you need to put a positive number in the box. If the audio is trailing, you need to put a negative number in the box. When everything is ok, hit the ‘OK’ button.

Next, click the Format button on top. You will want to choose ‘Windows Media Video file output, then hit the ‘Select’ button. On the right, under ‘Output stream type’, choose ‘Audio only’. Change the ‘Audio codec’ to read ‘Windows Media Audio 10 Professional’ and the ‘Audio encoding type’ to read ‘1 pass VBR (constant quality)’. Most times you will want to choose ‘VBR Quality 98, 48 kHz, 5.1 channel 24 bit VBR’ depending on the frequency (48kHz) and bit depth (24 bit).

Finally, click the Encode button, select a file name and location for your wma file, and hit the button that looks like a film strip with an arrow (far left) and wait for it to finish. Now your encoding is done.

If you wish to create a wmv that is playable on the PS3 also, you will need to encode another wma file with ‘Windows Media Audio 9.2′ as the ‘Audio Codec’ and ‘VBR Quality 98, 48kHz, stereo VBR’ as your format.

Now on to the Muxing. When you installed Windows Media Encoder 9 Series, there are a few extra programs that got installed with it. We will want to use Windows Stream Editor. Open WSE and click the ‘Add Source…’ button. You will want to add your wmv file the wma file you just finished encoding. Expand the box next to each of these until you see ‘Audio’ and ‘Video’. Put a check in each of these boxes and click the ‘Add ->’ button. You will now have a single “audience” on the right containing your audio and video. Click the ‘Create File…’ button and choose a name and place to save your new WMV w/ audio file.

If you wish to incorporate stereo audio for the PS3, you will need to create a second audience before  creating your file. Make sure the first audience has the 5.1 audio, and the second audience has the stereo audio. Then create the file as above.

That is it, you now have a WMV file with 5.1 audio that is XBox 360 compatible (and PS3 with stereo).

Bitrate calculation formulas:

Basic bitrate calculation – this includes the audio also

bitrate (kbps) = [size (in bytes)] / [time (in seconds)] * 8 / 1000

Advanced calculation for BD5/9 creation – if you are going to use your wmv to create a BD disc with ac3 audio.

x = length in seconds              dvd9 = 8,547,991,552 (bytes)
y = either 94125 (for 640kbs ac3)  dvd5 = 4,700,372,992 (bytes)
or 64000 (for 448kbs ac3)

calculate items in parenthesis first

maximum video bitrate for BD9/5 = (dvd – (x * y)) / x * 8 / 1050

so, first take x * y,
then take the dvd size you want and subtract the product of x * y, and so on

x * y is used to discover the size of the ac3 track inside an m2ts container in bytes.
Alternately, you can premux your ac3 or dts track into an m2ts container to get this size (x * y) in bytes and
substitute this number.

PART 2 Creating a BD disc

Ok, so now you have a WMV file and you want to create a Blu-ray disk for your PS3. Here’s what you need to
do.

First, prepare an empty folder for your Blu-ray files.

To create a BD disc, we will be using tsMuxer, but tsMuxer won’t accept a WMV file as input. So, we will be converting to an mkv container using a program that comes with Haali’s Matroska Splitter called gdsmux. Note, if Haali’s was installed with a codec pack, you may need to download and install it again seperately if you dont see gdsmux in the Haali’s folder (I also include the executable and dll’s necessary in the ‘Additional Tools.zip’ file with each of my wmv uploads).

Ok, so open gdsmux, and with the input tab selected, right click in the empty area. You will want to ‘Add source…’ and add your wmv file and the ac3 or dts track you ripped from your original m2ts or mkv. You will need to change the file type box to read ‘All files’ to add the wmv file. It should show two streams in your wmv file, one labled WMA9 audio and one labled WVC1. You will want to clear the box next to the WMA9 audio stream. Click the ‘…’ box near the bottom and choose a place and name for your mkv file, then hit start. You now have a file that tsMuxer can read.

*If you wish to keep this mkv file, you will need to remux with mkvmerge for it to play in sync. Gdsmux doesn’t set the framerate properly, so you will need to create a timecode file. To create a time code file, all you need to do is create a txt file and insert:

# timecode format v1
assume 23.976

*or whatever framerate your using and save it, it doesnt have to be named anything specific. Then, open your mkv in mkvmerge, highlight your video track, and in the general options below, in the timecode field, select the txt file you created. Then save the new mkv file.

Open tsMuxer and add your new mkv file. This is also the time to add any srt subtitles, which can be switched on and off through your players menu, that you haven’t already burned into the wmv file. You should have 2 tracks (3 or more if your adding subtitles or additional audio languages). You can set the language for the audio and subtitle tracks by selecting the track and choosing what language it is in the ‘General track options’ just below that window. If your using more than one audio track, I believe the highest on the list is played by default.

You can set your subtitle display options in the ‘Subtitles’ tab on top. For 1080p video,

I would set the Size to 60 by clicking the ‘Font’ button, and the bottom offset to 40 plus the width of the bottom border. So, if your original video was 1920×800, or cropped to 1920×800 when you encoded, then you will have a bottom border of 140, which would make your bottom offset 180 (40 + 140). If you will be copying this to a USB drive instead of a dvd, you will need to go to the ‘Split & cut’ tab, and select ’split by size every’ and set that to 4GB or under. Now is also the time to set chapter points in the ‘Blu-ray’ tab.

Next, in the ‘Output’ section, choose ‘Create Blu-ray disk’ and browse to your empty folder and click the ‘Start muxing’ button. When finished, you will have a BDMV and CERTIFICATE folder in your destination folder.

When finished, you can delete the mkv you created earlier.

If you wish to copy this to a FAT32 USB drive, you will need a program named AVCHD Me.exe (google it, also available in some of my wmv uploads). Copy this to your destination folder containing the BDMV and CERTIFICATE folders and run that program. It will rename all the necessary files to make this playable on the PS3. When finished, remove this from the folder. Rename your folder to AVCHD (not sure if this is necessary…) and copy it to a USB drive. You can now connect this to your PS3 and it will show up as an AVCHD disc.

If you want to create a dvd, you will need to use a burning program that supports UDF 2.50. Here is how to do it with ImgBurn:

Open ‘ImgBurn.exe’. You should be presented with the “EZ Mode Picker” asking “What would you like to do?” In this instance, you would like to choose ‘Create image file from files/folders’ (or press CTRL+ALT+B). On the left side you will need to choose your source.  Either use the file menu on top ‘File->Browse for a source folder…’ or hit the little folder icon with the magnifying glass. You will need to select the folder you saved your Blu-ray disc files to. On the right, you will have 4 tabs. Select the ‘Options’ tab, choose ‘UDF’ in the File System drop down box, and choose ‘2.50′ in the UDF Revision drop down box. If you want, you can select the ‘Labels’ tab next and enter a label for your disc. Below where you choose your source folder, you will need to choose where you want to save your iso.

Again, two options, you can use the File menu, ‘File->Browse for a destination file…’ or you can hit the little folder icon with the magnifying glass next to where it says ‘Destination’. Alternately, you can hit the little cd icon below that box and choose to write the files to disc directly instead of creating an iso first.

That’s it, you now have an iso that is ready to burn to a dvd.

(based on the guide by Koadic)

Popularity: 79% [?]

Related posts:

  1. How to merge multiple CSV files This is a very simple trick I picked up that has saved me A LOT of time when doing research that has required multiple csv...

26 Comments

  • At 2008.10.20 08:00, narendra.s.v said:

    wow thats well explained :D better if it’s for wii too ;)

    • At 2008.10.21 08:57, Donace said:

      hmm I haven’t ever done it for wii…but I will research and let you know

    • At 2008.10.21 08:52, Norhafidz said:

      very good guide thank you

      • At 2008.10.21 08:59, Donace said:

        cheers man glad it of use to you

      • At 2008.11.27 21:40, Ill Named said:

        HI, great write-up. I am just wondering if you would know why when I open EE2 and load the movie file, it only shows ffdshow under codecs and non of my others installed? I have all the ones installed that you have but they don’t show up. It still encodes fine, aside from it being a little bit choppy at times(any idea how to fix that?)
        Thanks
        Ill

        • At 2008.11.28 00:29, Donace said:

          Hey man thanks for dropping by and glad it was of use to you.
          Re: the codecs not showing up…as long as you can preview the video in EE2 it should be fine.
          In regards to the ‘chopiness’ if this occurs only in the ‘action’ or ‘faster’ scenes this may be due to a fra,erate drop…try using the ‘adaptive’ encoding method and increase the encoding rate (kb/s) by a fraction.

        • At 2008.12.01 20:05, Ill Named said:

          one more question. My TMPGExpress wont load my .dts file that I have. It tells me that it is an unsupported format, can you tell me why?
          Thanks
          Ill

          • At 2009.01.09 16:32, Proton said:

            Try just demuxing the audio again and then try loading the .dts track into tmpgenc. You made sure to pick the output as demux and not m2ts or something? Worked like a charm for me and it’s my first try. Good luck.

            • At 2009.01.25 22:28, cdawg said:

              what does “EE2″ mean? i saw that you said open EE2 to change some settings but you never mentioned anything about a EE2 before that… i have no idea what EE2 is. any help?

              • At 2009.01.25 23:46, cdawg said:

                nvm. i figured it out. sucks that that EE2 program is like $200 =(. anyone know where i can get it for “cheaper”? lol

                • At 2009.01.26 00:33, Donace said:

                  If your a student you can grab it for real cheap / free via rebates or the dreamspark initiative; Though if you look hard enough you can find a ‘alternate’ ‘cheaper’ version.

                • At 2009.02.10 10:26, Robert said:

                  Hi why can’t I load the m2ts file I tried everything you sayd in that tutorial but it still won’t open the mused m2ts file :(

                  • At 2009.02.10 10:29, Donace said:

                    what part are you having an issue with? …how far have yo gotten?

                    • At 2009.02.10 10:36, Robert said:

                      Can you give me again that link?

                  • At 2009.02.10 10:41, Donace said:
                    • At 2009.02.10 11:51, Robert said:

                      OK EE2 works now like it should ;) Just a tiny problem I want to calculate the bitrate using your formula but when I run the muxed m2ts in VLC Media Player I can’t see the lenght of the video :|

                      • At 2009.02.10 13:15, Donace said:

                        try running it in a different player; if it encoded correctly i.e. is playing…can skip/rewind/forward etc then it may just be vlc….give media player classic or KMPlayer a go.

                      • At 2009.02.11 11:42, Robert said:

                        I converted the video and now I am at the “Encoding / Muxing 5.1 Audio”. From what I read there this step can help me make a 5.1 sound movie, but I only want it stereo because I don’t have a 5.1 audio system. So should I skip this step?

                        • At 2009.02.11 11:56, Donace said:

                          no; just pick ‘VBR Quality 98, 48kHz, stereo VBR’ as format…rest should be the same.

                        • At 2009.03.15 11:29, soadtrails said:

                          When I try to load both the wma and the wmv file in the windows stream editor, and then add them to the output audience, I get an error that says “All audiences in the output tree must have the same content type”

                          Any ideas?

                          • At 2009.05.25 07:33, Robert said:

                            Mate it’s been 3 months since I followed this tutorial to rip a Bluray movie to WMV I want to thank you (better later then never :D ) and if your bood with torrents and stuff I will talk try to help you get a HDBits.org invitation the cream of all HD movies sites :D

                            • At 2009.05.25 08:30, Donace said:

                              sweet man; thanks for the offer but I rarely use torrents site now :p

                              Glad it helped you though..have fun!

                            • At 2009.06.04 06:35, Research Paper said:

                              I get an error that says “All audiences in the output tree must have the same content type”

                              • At 2009.06.04 09:05, Donace said:

                                Hey please sign off with your name at least so I know ho I am addressing. Where are you getting this error ?

                              • At 2009.08.26 23:31, Brandon said:

                                Hey, Expression Encoder 3 is out which is also free. As a bonus, it now does WMA with 5.1 making the whole process much easier!

                                • At 2009.08.27 02:02, Donace said:

                                  Sweet thanks for the heads up.

                                  (A must)
                                  (Another Must but dont worry will not be published)

                                  Archives

                                  Full Archive

                                  Tag Cloud

                                  .htaccess adgitize Alexa Internet automation Backlink Backlinks Blog bot Bots code competitons Contest copyright entrecard Firefox Google Google Page Rank How to howto Law link building Link Love links news Optimization PageRank PHP plugin Programming Promotion Rants of a loony toon rapidshare Search Engines Security SEO Site update Site updates Spammers TheDuke traffic tutorial updates Weblogs Webmaster Web traffic