Category Archives: Techniques

Using the Roku Internet video box with a USB Drive

I bought a Roku box last month and its been quite a bit of fun. When we watch TV, we now watch Vimeo or Netflix. There is a lot of great “user created” content – in fact, I have not watched satellite TV in six weeks now and plan to terminate our subscription this coming weekend.

The new Roku box also supports an external USB drive – which could be either Flash or hard disk based.

Streaming my own videos from the drive has mostly worked fine. Except for some that pause frequently and say “loading, please wait”. Looking around the net, I found a number of mostly random explanations.

The simple reason is that the data rate of the videos I created (from my own video productions) was too high. I had encoded 1080/30p videos at 16 Mbps (same as BluRay discs).

I registered as a software developer (in real life I am a professional software engineer) with Roku and have downloaded the developer documentation.

According to the documentation, Roku supports .mp4 files, mov and .m4v files having h.264 video compression, and WMV9 SD and VC-1 HD video files, using constrained variable bit rate (VBR) encoding. (I have not succeeded in getting the .wmv files or .mov files to work, however.)

The frame rate must be either 23.976 or 29.97 fps and this is probably the key part – the average USB disk video bit rate is limited to 8 Mbps depending on the codec used and the peak video bit rate is limited to 1.5 x the average bit rate. (For streaming videos coming over the Internet, the data rate is limited to an average of 1.6 to 4 Mbps depending on the coding. For H.264 HD, its limited to an average of 3.2 Mbps.)

Depending on your MP4 encoding tools, you might have difficulty specifying precisely the options you want. The key goals, it appears, are to try and select a constrained VBR, set to less than 8 Mbps, at 23.976 (a.k.a. 24 fps) or 29.97 (a.k.a. 30 fps).

I am doing some experiments with encoding at different data rates to see what happens and I will probably post an update later.

One thing that is clear – encoding a 1920x1080p video is sort of a waste of time since you’ll have to encode it at less than 8 Mbps. At that level of compression, a 1280x720p at 8 Mbps will actually look much better. (Well, unless your video is mostly static images with little movement.)

Consequently, while the Roku box really does support 1080p, you are unlikely to see video clips that are actually any better than 720p. In fact, most people cannot tell the difference between 720p and 1080p anyway, especially if the screen is less than 55 inches.

Update: On Mac OS X, I used MPEG Streamclip to create some 1280×720 video files for playing off a USB drive with the Roku. At about 7.5 Mbps, the video almost plays without buffering. I probably need to pick a slightly lower data rate – may be 7.2 Mbps for the video clip.

I had much better success playing some 8, and even 12 and 16 Mbps encoded videos produced by the Magix Movie Edit Pro 17 program on Windows 7.

I am guessing that it is not strictly the data rate but the “complexity” of the h.264 encoding used as well as whatever the unspecified “peak” data rate might be. MPEG Streamclip does not provide many options to control the h.264 encoding while Magix provides overrides of just about everything. Again, I’m guessing here but I suspect that MPEG Streamclip might be using one of the higher complexity profiles, or setting the “peak” rate to perhaps 2 x the selected data rate, and the Roku just can’t keep up.

I do think we’ve identified why some of us have received the “loading” message periodically while trying to play our own videos off a USB drive using the Roku box. The solution is to encode at a data rate probably between 7 and 8 Mbps using a variable bit rate h.264 encoder and setting the peak data rate, if you can set it, to something less than 12 Mbps.

Recording video direct to Mac hard disk (updated)

I have re-written this original post. I discovered that upgrading to Snow Leopard destroyed my ability to record from a Firewire HDV camera direct to the Macbook.  Apple has buried in a support note on their web site that this, apparently, previously relied on Final Cut Pro native HDV support. As of Snow Leopard, support for Final Cut Pro 5.1 was terminated and all users, especially those using HDV, must upgrade to FCP 6 or the newest version 7.

However, it appears there is still a work around to make this work, without any version of Final Cut needed for basic HDV capture live from the camera. And it even works with the new Quicktime X installed by Snow Leopard. (FYI – the older version of Quicktime Pro, if you had it, is moved to the Applications / Utilities folder so you can still use that too).

What you need to do

Go to Perian.org and download and install Perian on your system.

Go to this university web site and download the Perian HDV and MPEG2 components. These are ZIP files. Double click to unzip the PerianHDV.component file and the PerianMPEG2.component file.

Using Finder, navigate to the Library / Quicktime folder. Move the above two component files into the Quicktime folder.

Launch Quicktime X.

Choose File / New Movie Recording

When it starts, it shows the view from the built in iSight camera (if on a Macbook notebook). On the bottom of the screen are the video record controls. At the right hand side there is an inverted triangle. Click on that. This shows a pop up menu with a selection for Camera, Microphone and Quality. Select your camera, then select your camera also for the Microphone, and then set Quality to High. In “High”, Quicktime will capture your video in the HDV native format. Captured video will be saved to the folder listed in the “Save to” pop up menu item; you can change that if you want.

Then select the Red record button to record your video.

After capturing the video clips, I imported them into Final Cut Pro 5.1, which I have on my notebook. FCP gave a warning about these clips not being optimized for FCP, what ever that means, but I was able to drag them into the project timeline and edit without any problems. I assume this would likely work in FCP 3.5 HD also, if you don’t have version 4.

Sure wish I could have figured this out before last Saturday. Then, I did do some recording direct to disk using a work around of importing through iMovie. But this was gawd awful. I fed the live Firewire video into iMovie and captured the video. If you turn off the camera before stopping the iMovie capture, iMovie crashes. If you do it right, iMovie than starts creating “thumbnail” images. Which took 4 to 7 minutes for each clip! I didn’t have that much time before I had to start recording the next event!

I had to use Force Quit to kill iMovie, then restart iMovie and set up the capture all over again.

iMovie does not capture in native format either – it transcodes to AIC format and your 13 GB/hour HDV video grows to about 40 or more GB/hour, quickly using up your hard disk space.

While this work around using Perian will let you capture native HDV on your Mac notebook, you will still need either Final Cut to edit the native HDV file, or you can import to iMovie – which will then transcode in to AIC and make the file bigger.

Apple’s success seems to be causing them to turn into Microsoft in terms of their deleting functionality during upgrades and not adequately testing software, like iMovie.

Disabling automatic gain control on consumer cameras

Lower cost consumer level cameras do not provide a switch to turn off automatic video gain. When the scene gets dark, the automatic exposure opens up the aperture as much as it can – and if that does not let in sufficient light, then the camera starts amplifying the heck out of the video signal as the automatic exposure tries to make everything look like daylight.

The result is that interior scenes and anything shot at night end up looking horribly grainy due to the video amplification.

There are a number of tricks in use to over ride the video gain.

  1. The slightly hard one, in practice, is to point the camera at something bright enough, and then select the exposure lock feature, if the camera has that capability. Then point the camera back at whatever it is you want to look dark without tons of amplification noise. This is impractical for most “live” recording but works well for static subjects and short scenes.
  2. Another is to try one of the camera’s automatic settings – such as “fireworks” or “spotlight”. I’ve had excellent results using the fireworks setting for outdoor night time scenes that did not involve fireworks. The spotlight mode is for such things as stage lighting – where the subject is brightly lit but the background is typically dark. Most cameras mess up the exposure turn the subject into a bright white smudge in order to expose the background. Where I can, I usually set exposure manually, but you might also try the spotlight automatic setting if your camera as that ability.

I attended the 2010 Consumer Electronics Show in Las Vegas in January.  The only camera I took along was an older Canon HG10. I set the camera to record in its 24p mode and selected, usually, the fireworks setting, to get some excellent results with outdoor night time shots using what ever lighting was there.

Example – you can watch this in full screen mode to see how clean the video looks – and yeah, this is an inexpensive consumer grade camcorder, the Canon HG10.

You’ll get much higher quality on the video if you go directly to the Vimeo page itself rather than using the embedded player. Go to:

Canon HG10 night time video shot sample from coldstreams on Vimeo.

Achieving Depth of Field with the Canon XH A1

This past year as seen the phenomenal growth of the Digital SLR (DSLR) market for cameras that now also shoot HD video – either 1280 x 720 or 1920 x 1080, depending on the camera. This market is about to take a huge leap forward over the next few months as all the camera makers introduce new products that begin to support video needs much better than their first or second generation cameras.

DSLRs are becoming popular for video photography because:

  1. Many still photographers have quite a collection of lenses that are a much larger investment than the camera body! Now they can put those to use for video too.
  2. Having the combined function of both high quality still and video in one camera is very convenient. In a national park in Canada recently, I was carrying a non-video DSLR, an extra lens, extra battery, a Canon HV30 video camera, a wide angle lens, extra tapes and extra batteries – plus a video tripod – on an 8.5 mile challenging hike. That hike convinced me that next year, I’d like to have a video capable DSLR! Less stuff to carry!
  3. DSLRs are capable of narrow depth of field in a way that most video cameras cannot do – except for extremely expensive professional cameras.
  4. DSLRs can use special effect lenses to create unusual optical effects, such as making the real world look like miniature models! (My wife thinks that is funny since so many in the movie making world work very hard to make their models look like the real world – now we try to make the real look like a model!) For example, see this.
  5. DSLRs can be used less obtrusively to shoot video than using larger cameras like the XH A1 or Sony EX-3.

To video photographers, DSLRs have their drawbacks – so far. Typically their audio feature set is limited.  They display video only on exterior LCD panels, which may not be tiltable (this is changing for the new models) and which is hard to see in daylight. They limit maximum clip length to 12 minutes or similar. They often do not auto focus in video mode and there is no such thing as a motor driven slow zoom – they are all manually operated.

But the one feature that stands out in videos shot on DSLRs is their depth of field capabilities. They can achieve narrow depth of field because their image sensors are much larger than typical video cameras. The larger the sensor size relative to the lens, the easier it is to have that narrow focus range.

The good news is that you can kinda sorta achieve some DoF capabilities with the XH A1. At the wide angle setting the lens opens up to f1.8. It stops down a bit on telephoto. If you manually control the aperture (set to the Av setting) you can achieve some nice DoF effects. Its not the same as a DSLR, but there are some decent views that you can obtain this way. I’ve done some experiments to get some effects I wanted – and its okay.

A possible problem is when you open up to f1.8 in bright sunlight, the shutter speed may drop to 1/600 or worse. For moving subjects or pans, this may create too much of a strobe effect at 24f or 30f frames per second.

An alternative is to use neutral density filters. I have not yet tried this – but with external ND filters (in addition to those built in to the camera) it should be possible to shoot at wide apertures with a lower shutter speed like 1/30th to 1/100th of a second.

Anyone try this yet?

Playing 1920×1080 MPEG4 video files without “stuttering”

I previously played my own HD videos (videos that I created) at 1920×1080 by streaming them off a slightly older Windows XP PC over a network to an Xbox 360 connected to an HDTV.

Two things happened that killed that solution:

  1. The Xbox 360 eventually died completely (already been down the “red ring of death” problem in the past).
  2. My youngest child is now old enough that she did not care if we replaced the 360.

Looking for a low cost solution I re-assigned my old 3.06 Ghz single processor machine still running XP to play videos through the VGA connector on the HDTV. I still used that machine for some software development but spent today transferring over the last files and programs I needed on to my much newer multi-core desktop that I use for development and video editing.

The good news is that this all went well.

The bad news is that any time I tried to play a 1920×1080 MPEG4 video (most of mine are encoded at 4 to 8 Mbps depending on the content), the images stuttered badly. One in particular looked like I was watching a slide show, not a video!

I tried using Quicktime, VLC and the Media Player Classic Home Cinema software and all had various kinds of problems from stuttering to false colors (VLC).

Looking around I discovered that the problem is due to H.264 decoders that are too slow and can not keep up with full frame video.

But there is a solution – CoreAVC 2.0 and CoreAAC codecs. They have optimized their H.264 decoders for far faster performance than all the others.

Once I bought and installed those codecs, I can now play the 1920×1080 H.264 videos in Windows Media Player and get smooth video. No frame drops that I could see. Plus, the fan on the PC only kicked up half way to keep the CPU cool – so the fan noise was lower too.

For the $18 cost of the software, I’ve replaced the parts of the Xbox 360 that we really wanted – streaming our own videos. Plus we can now watch YouTube, Hulu, Vimeo and eventually Netflix videos too. And I’m going to have give Flight Simulator or X-Plane a whirl soon too 🙂

The CoreAVC and AAC codecs are working well for me. You might take a look at them if you are having trouble playing 1920×1080 videos on an older computer.

Update: If you are having trouble playing 1920×1080 videos on Youtube … it is probably because your computer cannot keep up. Decoding and displaying an H.264 1920×1080 video image, at 30 times per second, seems to be beyond the capacity of most computers. My quad core computer seems to be able to just keep up. It might work better for you if you first wait for the entire video to download, and then try playing again. Alternatively, just use the 720p version. Most people cannot tell the difference between 1080p and 720p, especially after it was encoded once for upload to Youtube, and then transcoded at Youtube, downloaded and decoded to play on your computer.