BluRay to .mp4 Part 3 
Wednesday, February 4, 2009, 06:48 AM
Well, it has been an interesting week of tinkering around, trying to find the best way to do this process of turning a bluray title into an .mp4 file. The software line-up has been reduced considerably.

Of course you need AnyDVD HD. And you'll need to follow the instructions in Part 1 of these instructions on obtaining and installing a UDF File System. And you'll need the neroaacencoder - follow the instructions in Part 1 for that.

You need the newest version of eac3to. There have been a lot of improvements to this tool that makes the process fairly painless.

Ok, let's start. Put your bluray disc (I'm still using Wall-E as my example) into your bluray drive, and open up a Command Prompt window. With the latest eac3to in your path, cd to a place on your computer where you want to store the 20Gb intermediate files that you are going to be ripping from the bluray disc. Then enter the following command:

eac3to j:

J: is the drive letter of my bluray drive - substitute the letter for your own drive here.

eac3to will chew on the disc a bit, and then spit out a listing of all the playlists. Now in the case of Wall-E there are 7 different playlists - the main movie in 3 different languages, plus the "geek squad" version of the movie in 3 different languages, etc. etc. With some experimentation on my part, I found that the playlist I wanted was #6. Remember - the longest playlist is not necessarily the movie. On Wall-E the longest playlist is the geek squad version. Not what you want. Now, enter this command to list the streams for playlist 6:

eac3to j: 6)

This will take some time--about 5-6 minutes--but be patient, eventually eac3to will list the video, audio, and subtitle streams contained in playlist 6. What we want is video stream 2, and audio stream 5. The command syntax for eac3to is really simple - you list the stream, and then say what you want done with it. Enter the following command line:

eac3to j: 6) 2: video.* 5: audiodump.wav -down2 -down16

I'll break this down a bit:

2: video.*
This tells eac3to that we want to save track 2 as a file called "video". The "*" tells it to give the file an extension according to the format of the stream. In Wall-E's case, the video is encoded with h264, so the resulting file will be "video.h264". Easy.

5: audiodump.wav -down2 -down16
This tells eac3to that we want audio track 5 saved to a .wav file, down-mixed to stereo, and down-converted to 16 bit audio.

eac3to will set about doing these tasks, and will take some time to do it - up to 4 hours or so depending on the speed of your system. If you have the drive space to do so, ripping the entire disc to your harddrive first will speed up the process considerably. For example, if you had ripped Wall-E to the harddrive first, you'd use the following syntax:

eac3to e:\quack_d1_can, substituting your own drive letter and the name of your particular folder.

eac3to will do the processing in 2 passes. Because the movie Wall-E is chopped up into several files (46 pieces in all) there are tiny gaps in the audio track. eac3to will recognize this, and create a gap log file as it does the first pass. It will then go back and do a second pass on the audio, using the log file created in the first pass to eliminate the gaps. The reason the movie is chopped up into so many pieces is actually a testament to Pixar's obsessive tendencies - they not only translate the audio for the movie into different languages, but they also translate most of the visual signage seen in the movie - each little piece is a version of a scene where there is a sign or other visual material that has printed English in it. Other playlists use other pieces, with all those visual bits translated into either french, or spanish. Pretty cool.

In the end, you'll have a video stream "video.h264" and an audio file "audiodump.wav". Follow the rest of the steps from Part 2 to encode the audio and video, and mux them into an .mp4 file.
add comment   |  permalink   |   ( 3 / 5262 )

Blu-Ray to .mp4 Part 2 
Sunday, January 11, 2009, 10:14 AM
Ammendment
After writing this, I discovered that I was doing a step wrong. There is an additional tool you will need called BDInfo that will parse the playlists on the blu-ray disc, and help you discover the correct playlist for your movie. You can then load the playlist in TSMuxer instead of the process I described below, and have a much easier (and correct) time of putting the movie back together. I heartily recommend this tutorial and in fact I've been having a lot of fun with the MediaCoder program described in that tutorial. Pretty nice GUI for beginners, and has access to the advanced encoder options for fussy people like me.

At this point you've downloaded all the software I mentioned in Part 1. You'll need to put all this software on your computer somewhere in your PATH. Follow the instructions here. You've got the UDF driver installed according to the instructions in Part 1. You've got your blu-ray drive hooked up, and you are ready to go.

Step 1: Extract the movie.
Put your blu-ray disc in your blu-ray drive. For the sake of this tutorial, I'm going to be using Wall-E from Disney, since it has the most obnoxious file arrangement I've seen on a blu-ray disc (so far). If you can rip this one, you can rip anything.

Start up tsMuxeR GUI. Click the "add" button, and navigate to your blu-ray disc. You'll see a few folders. Enter the one called "BDMV". You'll see a few more folders. Enter the one called "STREAM". Here you'll see a large number of ".m2ts" files. If this were a normal blu-ray disc, you could simply select the largest file and that would be the main movie. On this particular disk the movie is scattered across 23 different files. By a process involving playing each file with mplayer, I determined that the movie was in files 00000.m2ts through 00022.m2ts. Select the 00000.m2ts file to begin. tsMuxeR will chew on the file a bit, then add it to the input files box.

A number of tracks appear in the Tracks box. Ignore these for now - we have to add the other 22 pieces of the movie to the input box. Click the "append" button, and select the "00001.m2ts" file. You'll see that it is appended to the input files list. Repeat this step for each of the remaining 21 files. When you are done, scroll through the input files list to make sure you got all the files, in the right order, with no repeats.

Now we'll have to delete tracks we don't want to demux. Select the first track in the list, and note that the track info (you might have to widen the tsMuxeR interface to see it completely) lists this as a lower resolution track. Click the "remove" button to delete the track. Repeat this for the second track as well. We want to keep the 1920 x 1080 track. We also want to keep the DTS audio track, so skip down to the AC3 track following that, and keep hitting the "remove" button until only two tracks remain in the list.

Under the Output section, select the "Demux" radio button, and then click "Browse" to select a spot on your hard drive with a LOT of room - about 20 Gb free. Then click the Start Demuxing button, and then go find something interesting to do. On my machine, with this movie, the process too about an hour.

When you are done you'll have two large files saved on your hard drive with long file names. Rename them to something sensible, such as "video.264" and "audio.dts".

Step 2: Encode the audio
Relative to the other steps, this one is fairly quick, so we'll do it first. Open a command prompt, and navigate to the folder you demuxed the files to. Enter this command:

eac3to audio.dts audiodump.wav -down2 -down16

This will convert the DTS file into a stereo .wav file. Once this is done, you can delete the audio.dts file.

Now enter this command:

neroaacenc -lc -br 128000 -if audiodump.wav -of temp_audio.m4a

This will convert the .wav file into a standard .m4a AAC file. Once this is done you can delete the audiodump.wav file.

Step 3: Encode the video
First we need to determine the cropping and scaling. Mplayer will help us out here. Enter this command:

mplayer video.264 -vf cropdetect

Let it run a little while, then ESC out of the video playback. The correct cropping will be reported on the command line. For Wall-E, the cropping was -vf crop=1904:800:8:140. Now, with that information in hand, enter this command:

mplayer video.264 -vf crop=1904:800:8:140,scale=1280:-10 -frames 10

mplayer will report the correct scaling needed for this movie. In this case, it is 1280x544. You can substitute any other mod16 number for 1280, depending on what size you want to encode the file movie at, and mplayer will give you the correct height.

With these two pieces of information at hand, we are ready to encode the video:

mencoder video.264 -fps 24000/1001 -o temp_video.h264
/-of rawvideo -sws 9
/-vf crop=1904:800:8:140,scale=1280:544,dsize=1280:544
/-nosound -mc 0 -ovc x264
/-x264encopts qp=18:bframes=3:partitions=all:me=umh:nocabac
/:nofast_pskip:nodct_decimate:frameref=6:subq=6:mixed_refs
/:level_idc=31:threads=auto


This will take a very long time - on my system it took about 8 hours to churn through the movie. When this is done you can delete the video.264 file.

Step 4: Muxing
The final step is to remux the video and audio streams into an .mp4 file container:

mp4box -add temp_video.h264 -add temp_audio.m4a -fps 23.976 -tmp c:\temp Wall-E.mp4

Once this is done, you can delete the temp_video.h264 and temp_audio.m4a files. Congratulations - you're done! The resulting .mp4 file should be playable on an AppleTV, XBox360 or Sony PS3.

If you want to retain the .DTS soundtrack, you can skip the audio re-encoding section, and mux everything into an .mkv file, but that's something I don't have a lot of experience with, so I'll leave that an exercise for the reader.
1 comment ( 21 views )   |  permalink   |   ( 3 / 5253 )

Blu-Ray to .mp4 Part 1 - software 
Sunday, January 11, 2009, 08:16 AM
Automating the process of re-encoding movies from Blu-Ray continues to be a hairy problem. The issue is that the content of Blu-Ray discs can vary widely. Some have H264 encoding, some have Microsoft's VC-1. Some even still use good old mpeg-2. Some discs have the main movie all in one .m2ts file, with others have the main movie split between dozens of files. For now, the process remains a largely manual one.

THIS IS FOR WINDOWS XP ONLY. I do not have Vista, so I cannot test this out on that platform.

First, you are going to need some bits of software to get the job done. AnyDVD HD is essential. Without this installed, your blu-ray discs will be unreadably encrypted.

You will also need to install a UDF filesystem so that the blu-ray disc is readable by the operating system. Get the UDF driver install from the Toshiba site. If it happens that your computer is not made by Toshiba, you'll have to fiddle around a little to get the driver to install on your system. Follow these instructions:

(copied directly from the SlySoft forums)
There is an easy way to "trick" installation of the Toshiba UDF2.5 driver on non Toshiba PCs.

1.) Unpack it.
2.) Start setup.

It will tell you, that you cannot install it on your non-Toshiba PC. DO NOT CLOSE THIS MESSAGE BOX.

Navigate to your temp directory with explorer. You'll find a directory named like this: {1347D5A6-4FE0-476A-B85F-D0FC91F55EB0}

Enter it. You'll find two files: thdudf.inf and thdudf.sys

Right click thdudf.inf, select "Install".

Wait a while. Close the Message Box. Reboot.

The next bit of software you will need is tsMuxer. You can get it from SmartLabs. This is the software that will let you demux a Blu-Ray title into its component streams, and re-assemble a multi-file title into one stream for the purposes of encoding.

To convert DTS audio into other formats, you will need eac3to, an indispensable tool for working with blu-ray titles. You will also need the Nero AAC Encoder. This will encode the audio into an .mp4 compliant AAC stream.

You will also need mp4box which is a handy little utility that you will use to mux the video and audio streams into a standard .mp4 file container.

Lastly, you'll of course need MPlayer and Mencoder. Follow the links from my Software Links page to get those.

Next post I'll show you how it all works.
add comment   |  permalink   |   ( 3 / 5179 )

Adventures in Blu-Ray 
Tuesday, May 27, 2008, 11:08 AM
I've been getting into watching HD movies on my Sony Bravia TV. It's only a 720p TV set, and I don't yet own a Blu-Ray player (otherwise known as a PS3), so I've been watching HD content from my Mac Mini. Picture quality is excellent.

I wanted a legal source of HD content, so I purchased a Pioneer blu-ray DVD ROM drive and put it into an eSATA/USB2 optical drive enclosure. Of course the Mini has no idea what to do with this device. I plugged it into my PC.

First off, I need to explain that the forces that be in Hollywood have mandated a torturous DRM scheme in hardware and software to ensure that the same fate that befell DVDs does not happen with Blu-Ray discs. To this end there is a new encryption scheme - AACS, and various hardware requirements in a blu-ray equipped PC - encrypted data path to the video card, encrypted data path to the monitor, etc etc. The system requirements on the Pioneer box read like a list of things I don't have: Windows Vista, DirectX 10, HDCP-compliant motherboard, graphics card, graphics driver, and monitor, and a SATA connection. I run XP, DirectX 9, have none of that HDCP stuff, and all my SATA connections are used up already.

Funny enough, none of this matters. A quick upgrade of AnyDVD to AnyDVD HD, and an install of PowerDVD 8 and I was in business. Even hooked up via USB, Blu-ray movies play back perfectly on my PC. Silly DRM people, foiled again.

Of course, none of this does any good for me watching these movies on my TV set. I could investigate using something like Slingbox to deliver the content from pc to tv, but I'd rather go the re-encoding route. I've done a little experimenting, and I can create absolutely gorgeous .h264/aac .mp4 files from blu-ray sources using a handful of freely available software, and AnyDVD HD.

I'll be posting a script to do this once I perfect it, but for now, all you need is a copy of AnyDVD HD to do the heavy lifting of ripping the blu-ray titles from the DVD, eac3to.exe to extract and convert the audio tracks, neroAacEnc.exe to convert the audio to AAC, mencoder to convert the video to .h264, and mp4box.exe to mux it all together into an MP4 container.

I tried a couple of the gui based methods - MeGUI looks like it should do the job OK, RipBot produced uneven framerates, but my script produces absolutely perfect picture quality.

More Later.
add comment   |  permalink   |   ( 3 / 2584 )

Custom Artwork In Front Row 
Monday, April 21, 2008, 07:42 AM
I have a Mac Mini attached to my TV, which is the primary device I use to watch movies from DVD or ripped from DVD to .mp4 format. The media player I use is Apple's excellent Front Row. The picture quality on my Sony Bravia TV is amazing, and the ease and use of Front Row excellent.

I recently upgraded the operating system on the mini to Leopard, which also upgraded Front Row to the new version. There are a couple of annoying differences between the old Front Row, and the new version:

1) The old Front Row used to display a moving thumbnail of each movie in your collection. The new Front Row has different behavior -- it now displays a still thumbnail image, captured from about 3 seconds into the movie. Unfortunately this is either a black frame, or a glimpse of one of the many logos that appear before any movie. It almost never has anything to do with the movie itself. Maybe you like all the Columbia, Universal, and Warner Bros. logos, but I don't find them all that attractive.

2) The old Front Row would remember what spot you were in a movie so that when you went back to it, you could pick up from where you left off. The new Front Row only does this for movies that are in the iTunes library now.

I wanted a method to choose which movie frame was going to represent the movie in Front Row when scrolling through the collection. And, I wanted to be able to stop videos and come back to them at a later date and pick up from where I left off. A search on the internet revealled some contradictory information, but I have come up with a solution that fixes both annoyances.

First off, this method requires that the files you want to use this method on are readable by QuickTime Player. If you have a file that can't be played in QuickTime Player, I suggest Perian which is a QuickTime component that adds native support for many popular video formats.

To create the custom artwork for your Front Row movie, follow these steps:
1) Open the movie in QuickTime Player. Play, or scroll to the frame you wish to use for your custom artwork. Pause the movie at the frame you want. This can be any frame in the movie - I am a purist and tend to use a frame that displays the movie's title, but you can choose any image from the filme that evokes what the movie is all about, for you.
2) From the View menu, select "Set Poster Frame".
3) Go back to the beginning of the movie -- otherwise the movie will start at the poster frame when you start to play it in Front Row. I use the button that looks like this: |<- to do this.
4) Go to the file menu and select Save As... Leave the filename alone, but click the button "Save as Reference Movie" and hit save. This should be in the same folder as the original movie, but does not need to be. The filename will have a .mov extension on it, and will be 2-4 Mb in size, depending on the length of the movie.
5) Quit QuickTime Player, and fire up iTunes. Go to the Movies category, and drag the reference movie you just created into the window. If you have the movies listed by thumbnail, you'll see that the movie has the thumbnail of the poster frame you chose.
6) Quit iTunes, and fire up Front Row. Select Movies from the media list at the right, and you'll see the movie you added to iTunes listed there, with the correct artwork.
7) Crack open a cold one, put your feet up, and enjoy.
1 comment ( 19 views )   |  permalink   |   ( 3 / 2514 )


Next