Tuesday, May 27, 2008, 11:08 AMI'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.
Monday, April 21, 2008, 07:42 AMI 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.
Thursday, April 17, 2008, 10:42 PMMore 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.
Sunday, September 30, 2007, 08:27 AMThis 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.
Saturday, September 29, 2007, 02:29 PMThere are many devices out now that will let you watch movies, listen to music, surf the web, or view photographs on the go. A couple of good choices for these tasks would be either the Sony PSP, or the Apple iPod touch. I'd like to take a few minutes and compare the strengths and weaknesses of each device.
This image shows the new slimmer PSP and the ipod touch at the same relative scale.
You can see right away that the ipod touch will fit in your pocket better, because the entire size of the unit is only slightly bigger than the PSP's screen. This also means the PSP's screen is much larger than the ipod touch's screen area. And, it's got a really nice screen. The ipod touch has a maximum of 16Gb of memory, the contents of which must be managed by the iTunes on a "host" PC or Mac. The PSP uses memory sticks up to 8Gb in size which can be swapped on the go. Additionally, any PC can be used to put content on the PSP, as no special application is needed at all other than a file browser. The PSP also accepts commercial movies on UMD discs, while the ipod touch has no such capability. The PSP's screen is larger, and arguably nicer to watch videos on, and the built-in speakers make watching movies and videos on the go that much more convenient. Winner: psp..
Listening to Music
The ipod touch is an ipod. This means you get the ipod's legendary audio output, small size, great interface, and WiFi access to the iTunes music store. On the downside, your music collection is tethered to the iTunes library on the "host" computer. Listening to music is what the ipod does best, and the interface on the touch is particularly impressive, and a breeze to browse through your library with. You can manage the PSP's music library from any computer, and you can download music content from certain sites using the built-in web browser. The music listening interface is far more clunky than the ipod's. On the plus side, you get some really neat visualizers to stare at while you listen to music. Both players will continue to play music while you are otherwise engaged in using the devices. Winner: ipod touch.
There really is no contest here. The photo viewing capability of the ipod touch with its gestural interface really blows away the rudimentary photo viewing capability of the PSP. The only real hurdle to this feature is the necessity of having to use iTunes to manage everything on the ipod. The PSP has no such restriction, and photos can be added to the memory stick from any computer. Winner: ipod touch.
Surfing the Web
Both of these devices are capable of basic wireless web surfing. The PSP however has a fairly crippled mobile browser that isn't capable of doing much else than stuggle to display most web pages. The Safari browser built into the ipod touch isn't perfect either, but is much more capable of displaying most sites (if they don't rely on flash for navigation, that is). Safari on the ipod touch is insanely easy to navigate and zooom around pages with - it's a genuine pleasure to use. Winner: ipod touch.
The PSP is great for playing games. The ipod touch has no games at all (at the time of this writing). The ipod touch has a few rudimentary applications - calculator, calendar, world clock, but nothing that is going to make or break your purchasing decision. The PSP can act as a really cool little wireless network strength meter, while the ipod touch is really limited to showing you one of three signal strength states. The PSP has a camera and TV tuner add-ons available for it - no such thing for the ipod touch. The ipod touch can watch YouTube videos through it's own special interface - nothing like that available on the PSP, even through it's limited web browser.
Both devices are capable of being charged via USB cable. This is the iPod touch's only means of recharging. The PSP comes with a power supply, so it can be charged on the go.
Overall, the PSP is a much more general device, with more expansion options (memory stick, accessories, and UMD media) that also happens to be a great media viewer. The ipod touch is a more constrained device with specific purposes, which it happens to excel at. Winner: psp.
Value for Money
The Sony PSP retails for $250 Canadian, and for that you get a pretty good game (Daxter), a collection of five Family Guy episodes, the PSP unit itself, a power supply, and a 1Gb memory stick. No earphones or USB cable are included. The ipod touch retails for $499 Canadian, and for that you get the ipod touch, a cleaning cloth, ear phones, and a usb cable. Winner psp.
The ipod touch is going to amaze your friends and confound your enemies with its sheer cool factor, while the retooled slimmer PSP is going to get a yawn from everyone as 'old news already'. Which is unfortunate, because overall the PSP is the more capable, less restricted device, which also happens to cost about half as much. Winner: psp.