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 / 5861 )

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 / 2846 )

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 ( 23 views )   |  permalink   |   ( 3 / 2768 )

DVDtoAVI 2.9 Update 
Thursday, April 17, 2008, 10:42 PM
More tweaks to the x264 encoding options, and a couple of tweaks to the preview and stream extraction options results in faster and better quality final encodes. Also fixed a small bug in the volume normalizer.

Details are in the manual.
DVDtoAVI 2.9 is available here.
1 comment ( 18 views )   |  permalink   |   ( 3 / 2721 )

MEncoder and the iPod Touch 
Sunday, September 30, 2007, 08:27 AM
This weekend I tweaked DVDtoAVI's x264 encoding setup for the Apple iPod. Here is the new command line (this for a two pass encode of a wide-screen movie from DVD):

mencoder dvd://1 -aid 128 -sws 9 -of lavf -lavfopts format=mp4 -vf pullup,softskip,scale=576:320,dsize=576:320,harddup, unsharp=l3x3:0.5 -ovc x264 -x264encopts bitrate=1381:vbv_maxrate=1500:vbv_bufsize=2000:nocabac:me=umh: subq=6:trellis=1:level_idc=30:global_header:threads=2:pass=1:turbo -oac faac -faacopts mpeg=4:object=2:br=160:raw -channels 2 -srate 48000 -ofps 24000/1001 -o TEMP.mp4

mencoder dvd://1 -aid 128 -sws 9 -of lavf -lavfopts format=mp4 -vf pullup,softskip,scale=576:320,dsize=576:320,harddup, unsharp=l3x3:0.5 -ovc x264 -x264encopts bitrate=1381:vbv_maxrate=1500:vbv_bufsize=2000:nocabac:me=umh: subq=6:trellis=1:level_idc=30:global_header:threads=2:pass=2 -oac faac -faacopts mpeg=4:object=2:br=160:raw -channels 2 -srate 48000 -ofps 24000/1001 -o TEMP.mp4

nicmp4box -add TEMP.mp4 OUTPUT.mp4

I'll break down this command line into some nice easy pieces for you:

dvd://1 -aid 128

These set the input to MEncoder, telling it to get it's input from your DVD drive, title number 1, using the audio track with the ID 128.

-of lavf -lavfopts format=mp4 -ofps 24000/1001 -o TEMP.mp4

These set the output options, telling it that we are going to output to an .mp4 container file, and that the movie is at film frame rate. If this were a PAL DVD it would be -ofps 25. We are also telling it that it is going to be writing a file called TEMP.mp4.

-oac faac -faacopts mpeg=4:object=2:br=160:raw -channels 2 -srate 48000

These set the audio output options. We are telling MEncoder that we want to use the faac audio codec to produce an AAC audio track, with the properties appropriate for a Quicktime compatible audio stream in an mpeg4 movie. We want a stereo AAC file, 48000 sampling rate, at a bitrate of 160kbps.

-vf pullup,softskip,scale=576:320,dsize=576:320,harddup, unsharp=l3x3:0.5

These are the video filters we are using on the title. The pullup, softskip filters tell MEncoder to convert the 29.97 fps output from the DVD to a progressive 23.976 fps output, since we are sure this is a movie output. If this were a PAL DVD we would skip these two filters, as they would not be needed. The scale here is appropriate to convert a wide-screen format movie to a size that will play back comfortably on an iphone or ipod touch screen. The screen on these devices are only 480x320, so the size seems a bit large. They have this feature where a double tap on the touch screen will zoom into the video so that the height fits the screen, giving you a nice full screen view of the movie while cutting a bit off the sides. This scale accomodates that feature while keeping the quality of the movie high even while zoomed in. The dsize parameter ensures that the resulting .mp4 file has a SAR (pixel aspect ratio) of 1:1, required by the iPod. The harddup parameter ensures that all frames, even duplicate ones, are actually present in the output stream. The unsharp setting is a tweak to make sure the picture looks great on the iPod screen - scaling tends to soften things a little.

-ovc x264 -x264encopts bitrate=1381:vbv_maxrate=1500:vbv_bufsize=2000:nocabac:me=umh: subq=6:trellis=1:level_idc=30:global_header: threads=2:pass=1:turbo

These set the video encoding options. We want to use the x264 codec for the video stream in our output file, at a bitrate of 1381. This bitrate is a little on the high side, and will produce excellent, artifact-free video from most sources. You can go as low as 768 with the bitrate if you want to produce smaller output files, at the risk of introducing blocking artifacts that the iPod doesn't seem to be too adept at hiding. The vbv_maxrate and vbv_bufsize parameters are there to ensure that the bitrate doesn't climb above 1500, the iPod's stated technical limit for bitrate in an x264 video stream. The nocabac parameter turns CABAC (context based adaptive arithmatic coding) off in this video stream, as this is an x264 feature that is not supported on the iPod. The me=umh tells MEncoder to use the "uneven multi hexagon" search" algorithm in it's motion estimation. This is better, but slower than the default 2 pixel radius hexagon search. This helps compression. MEncoder's default sub-pixel refinement quality setting (subq) is 5. Setting it to 6 is one better, and increases the quality of the output. The trellis setting stabilizes the bitrate needs of each frame vs wild fluctuations in bitrate, and usually increases the quality of the output file. The idc_level=30 tells MEncoder that we only want x264 options up to level 3.0, the top complexity limit stated in the iPod technical specs. The global_header parameter adjusts the structure of the video stream so that header information is repeated only once in the stream, for compatibility with the iPod.

The threads option is going to be different on everyone's computer. My computer has a dual-core processor, so setting threads=2 allows both CPUs to work on encoding the video at the same time. If you have only one CPU core in your computer, you can eliminate the threads parameter completely. If you have more cores, set this to an appropriate value. pass=1:turbo allows MEncoder to skip some CPU heavy calculations on the first pass that won't really affect the bitrate decisions on the second pass, and this speeds things up a bit.

nicmp4box -add TEMP.mp4 OUTPUT.mp4

This is necessary. You'll need nicmp4box to set the iPod UUID atom in the resulting output file, because this is something that MEncoder cannot do on its own. Without this atom, the resulting file would play fine in MPlayer, Quicktime and iTunes, but would not be synched to the iPod.
add comment   |  permalink   |   ( 3 / 3274 )

Back Next