Archive for the ‘mac’ Category

From Flash to MP4

May 25, 2010

I’ve been thinking about saving some Flash videos from YouTube, Vimeo (videos without a download link), and other sites for playing on iPods and other platforms that don’t support Flash video. Since most Flash video these days uses the h.264 codec, it should be possible to de-multiplex the .flv file to extract the video and audio streams, then re-multiplex them into an MP4 container, with no re-encoding.

On a Mac with Perian and QuickTime Pro installed, just open the .flv file in QuickTime Player 7, do “Save As,” choose “self-contained movie,” and after a few seconds, you’ll get a copy of the video in a QuickTime .mov file.

There’s also a more roundabout way to do it on Windows, if you really want a .mp4 container file.

  1. Download the Flash video file (.flv extension). The Firefox add-on DownloadHelper is one way to do this. You should probably download the highest-resolution version available.
  2. Run FLV Extract and drop the .flv file onto it to create .264 and .aac files, which contain the video and audio respectively. If it produces files with different extensions, your Flash video file isn’t encoded in h.264 so the next step won’t work, sorry.
  3. Run YAMB and add the .264 and .aac files to re-multiplex them into a .mp4 file.
  4. Play the .mp4 file and check that audio and video stay in sync before you delete the .flv file.
Advertisement

Audio Encoding in iTunes

January 19, 2010

If you use iTunes to make MP3s, you’re not making the best sounding MP3s you could. It appears to me that the iTunes MP3 encoder is optimized for encoding speed, not sound quality. For better sound quality, use the newer AAC (M4A) format instead of MP3; but if you need to make MP3s for compatibility with older players (hardware or software), the iTunes MP3 encoder is not the best one to use. For low bit rates (below 128 kbps), the Fraunhofer MP3 encoder produces the best results; it’s used in some commercial software such as the Pro Tools MP3 Option.

For medium to high bit rates (roughly 128 kbps and above), the best sounding MP3 encoder in my comparisons (and other peoples’) is a popular free one called LAME. On Macs, there is a way to make MP3s in iTunes using LAME instead of the iTunes built-in MP3 encoder. It’s a free application called iTunes-LAME. Here are its download page and installation instructions.

The LAME encoder program in the iTunes-LAME package is fine, but it is not the newest version (as of this writing, iTunes-LAME comes with LAME 3.97, and the newest is 3.98.2). If you want to take advantage of more recent quality and speed improvements to LAME, you can get a newer version of LAME for MacOS X. Look for a listing like “LAME 3.98 for MacOS X: A universal binary which will run on both PowerPC and Intel powered Macs”. To install it, double-click its DMG file, and a window should open up showing two files, “lame” and “COPYING”. Next, right-click (or control-click) on the iTunes-LAME application and select “Show Package Contents”. Open up the Contents folder in the resulting window, and the Resources folder under that. Rename the existing “lame” file there to something like “lame original” in case you ever want to revert to it, then drag the new “lame” file into that Resources folder.

Or, if you really want to keep up with the latest version and are comfortable compiling programs, you can get the LAME source code. You’ll need to use a Terminal window to compile it (and you need the Apple XCode Tools installed), then install the new “lame” file as described earlier.

Once you have iTunes-LAME installed, when you run iTunes a scroll icon (signifying scripts) shows up in your iTunes menu bar, toward the right. Click on the scroll and select “Import with LAME…” from the drop-down menu. This brings up the iTunes-LAME window.

The iTunes-LAME encoding options are specified using a text box. For personal use to get the best sound quality, I type --preset extreme (those are two dashes in a row before “preset”). If I want to use a particular bit rate, say 256 kbps, I type --preset cbr 256. Some other good settings for various purposes are documented on audio forums.

LAME has way more options than most people would care about, but fortunately you can ignore most of them. When you see references to --alt-preset, that’s just an older name for the --preset option.

The iTunes-LAME Prefs button brings up a preferences window which includes the option of whether it should encode all the tracks in the current playlist that are checkmarked, or those that are highlighted (selected). Set it whichever way you find more convenient.

After you have entered in the LAME encoding settings, to make MP3s just select (or checkmark, depending on that setting) one or more tracks in iTunes and click the big round Import button on the iTunes-LAME window.

Recording and Archiving TV Is Still Not Simple

January 2, 2010

We have Comcast cable TV with a digital tuner box that contains a hard drive to support video recording. When its hard drive filled up with shows we wanted to watch in the future, I had to figure out how to save them somewhere else to free up disk space for new recordings. As I pondered how to do it, I thought back a few decades and wondered why this process can still be cumbersome, given the improvements in technology….

In the 1970s, it became possible to record shows from your TV for viewing later, using a video cassette recorder (VCR). This is called time-shifting, and was ruled to be legal by the U.S. Supreme Court in the infamous 1984 “Betamax case”.

Doing this required learning how to program your VCR using its primitive interface and looking up show times on a printed TV schedule in a newspaper or TV Guide magazine. You could archive the shows you wanted to watch later by storing the video tapes.

In 1999, TiVo introduced a hard disk based digital video recorder (DVR), which downloaded the TV guide over a phone line or (later) the Internet. This let you choose shows to record by name; TiVo even records shows it thought you might like. For archiving, hobbyists figured out ways to get the recorded MPEG2 video files off of the TiVo’s hard drive and onto a home computer’s hard drive, where they could then be stored, viewed on a computer, burned onto DVDs, or converted into other formats such as MPEG4.

That was a great arrangement, but the TiVo boxes cost several hundred dollars plus a recurring subscription fee for the guides, and TiVo gradually made them harder to hack into to get the video files. The cable TV companies (like Comcast) started offering their own, simpler DVR boxes for cheaper (just the monthly fee). Our is made by Motorola. It has some computer connectors on the back, like Firewire, which aren’t enabled by the Comcast software on it.

So, how to copy shows off of the Comcast DVR? It’s ridiculous, but I have to record the shows in real-time into a computer. I got a Canopus ADVC-110 DV capture card that connects by Firewire to a Mac laptop running Final Cut Express, and by S-Video and RCA audio to the Comcast DVR. After I capture each show from the Comcast DVR into FCE, I trim out the commercials (replacing them with chapter markers), black out the in-frame ads for other shows with cropped slugs, de-letterbox by zooming if applicable, and save it as a QuickTime DV file that I can re-encode into MPEG2 for a DVD. There’s no good technical reason for these extra steps, just corporate politics.

I also use the Canopus to capture video from VHS tapes and analog camcorders, so I needed it anyway; I didn’t get it just to save shows from the DVR. Otherwise, I might have considered getting a TiVo and a CableCard. Other possible capture devices include:

  • A standalone DVD recorder to skip the re-encoding step, but that wouldn’t let me cleanly edit out commercials or re-encode for viewing on computers or portable devices.
  • For smaller captured file sizes, a capture device that encodes in MPEG4 instead of DV, such as the Elgato Video Capture. That would mean editing out the commercials using QuickTime Pro 7 or MPEG Streamclip, instead of Final Cut or iMovie. I find the Final Cut interface easiest to use and it gives me the most power in editing.
  • To capture HD, I’d have to use something with component video inputs like the Blackmagic Intensity Pro PCI-e card, but I don’t have a Mac with PCI-e slots near my TV. Or the Hauppauge HD PVR, which encodes in AVCHD format, which I would need to decompress to edit. And HD video uses even more disk space. Someone else has written up a procedure to convert HD video captured by a Hauppauge HD PVR into a standard-def DVD, for those who want to try that.