Hack 83. Encode a Video to Stream on the Internet

 < Day Day Up > 

Video files tend to be quite large, even when compressed, and can take a long time to download. By streaming a video, your viewers can get near-instant satisfaction.

The Internet is a great way to distribute your video. Cable modems, satellite dishes, and digital subscriber lines (DSL) have all brought broadband Internet connections to the people who want them. But even with a broadband connection to the Internet, downloading large files can still be a time-consuming process. Video files of any decent length, even when compressed, are much larger than even graphics-intensive web pages.

To overcome the hurdle of time-consuming downloads for video, various companies and organizations created methods to send video files in small pieces. These small pieces can be displayed immediately. The process of sending the pieces is called streaming video.

In order to stream video, three pieces of technology need to be in place. First is the video client, which the viewer will use to watch the video. Second is the streaming server [Hack #85], where the video will be distributed to the viewer. Third is the video file itself, which must be formatted or encoded in a specific way.

7.9.1. Creating a Streaming Video

There are a number of ways to create a streaming video. The amount of time it takes to encode video is different for each process and might also depend on the speed of your computer. However, as a general rule, you can expect "live" encoding to be the fastest and lowest quality, exporting from an editing system being in the middle for both speed and quality, and encoding from an uncompressed video file to be the slowest to process but the best in quality.

7.9.1.1. Encoding a live video.

I use the term live video to represent two forms of video. The first is an actual live event, such as a sporting event, where action is occurring while you are encoding. The second is merely playing video from a camera or deck. Both types can be encoded using the same solution. However, this hack does not cover how to broadcast a live event [Hack #87].

Microsoft and Apple have both made encoding software available for free. Microsoft's application is called Media Encoder and can be downloaded from http://www.microsoft.com/windows/windowsmedia/9series/encoder/default. aspx. Apple's application is called QuickTime Broadcaster, which is available for download at http://www.apple.com/quicktime/download/broadcaster/. Both programs work quite well and offer decent results, considering they are encoding (and often compressing) video in real time. Figure 7-28 is an image of Microsoft's Media Encoder about to broadcast and archive a stream and Figure 7-29 shows QuickTime Broadcaster.

The quality of your video will depend on your streaming server's upload speed. Do not exceed your server's upload speed when configuring your video's data rate. I have personally had good results at 500Kbps for a data rate with both applications.

Encoding and saving to disk is especially useful when you need to place the video online as soon as possible, because the encoding occurs in real time. However, because the encoding is done is real time, you will not get the best results possible.


To send video to either application, connect your camera or deck to your computer using an IEEE-1394 (a.k.a. FireWire or i.LINK) connector. After connecting your video source, launch the encoding application and configure your settings appropriately. Make sure you have set the application to hint the resulting file for streaming, as well as to save your encoded file to disk. You will need the saved file in order to create a video on-demand later on in the process.

Figure 7-28. Media Encoder ready to encode a video at 548Kbps


There is a bug in QuickTime Broadcaster that occurs when recording for long periods of time to a disk larger than 2GB in size. If you plan on capturing a video that is longer than 15 minutes in length, you should either partition a disk to have a 2GB partition or create a 2GB disk image using Disk Utility. I have used the latter option successfully in a production environment.


7.9.1.2. Exporting from your editing system.

Most editing systems have a method to export video to a file on your computer. Depending on the operating system, the editing software, and possibly the plug-ins you've installed, your options for exporting a streaming video will vary. Make sure that your system allows you to export a streaming video. It will also be helpful if you know which codec you plan to use [Hack #77].

Figure 7-29. QuickTime Broadcaster set to Record to disk



Avid

File Export


Final Cut

File Export Using Compressor…


Movie Maker

Tasks Finish Movie Send to the Web


Premiere

File Export Movie Settings button


iMovie

File Share QuickTime Compress movie for: Web Streaming

Some editing systems will export based on your timeline's current In and Out points as a default. If you are trying to export your entire movie, you need make sure your marks are set properly. You probably don't want to find out you've waited for your system to export your movie for the last three hours, only to discover you left off the first five minutes of your timeline.

7.9.1.3. Encoding using Discreet's cleaner

If you want the best quality streaming video you can achieve, and you have the time to wait for your system to carefully encode your video, use an application specifically designed for video encoding. Discreet's cleaner (http://www.discreet.com; $549) is such a program and provides great results. Additionally, cleaner offers a wide variety of options for encoding your video, including unlocking some of the more hidden features of digital video, such as URL references [Hack #84].

To get the best quality video out of cleaner, capture your video at the highest resolution possible. This will most likely be uncompressed DV. Once you have captured your video, launch cleaner and drag-and-drop your video file onto the Batch window.

A really nice feature of cleaner is the ability to set an In point and an Out point. This allows you to change your settings, encode just the portion of video between your In and Out points, and then view the result. In practice, this enables you to tailor your settings to each individual movie, because you can make a change and see if your quality is better than before you made the change. Figure 7-30 shows the In and Out markers along the timeline as green and red marks, in addition to showing the current settings for the encoding process.

Following the In/Out approach, here's an example workflow:

  1. Double-click on the movie for which you would like to change the settings.

  2. Click on the Settings tab and make any desired changes, such as reducing the frame rate.

  3. Locate a point in your video you would like to have as the start of your video tests.

  4. Mark your In point (Edit Set In Point).

  5. Mark your Out point (Edit Set Out Point).

  6. Encode).

  7. Repeat until happy or tired.

By following this workflow, you will consistently have a higher quality movie at the lowest possible data rate. If you are really patient, or possibly a masochist, you can change your In and Out points, encode, and view another section of your video. Depending on the outcome, you can continue the process or accept your results.

When you are finally happy with your settings, make sure you set your In and Out points to the actual start and end times for your movie. Encode and enjoy.

Figure 7-30. In and Out points appearing as green and red marks, respectively


     < Day Day Up > 


    Digital Video Hacks
    Digital Video Hacks: Tips & Tools for Shooting, Editing, and Sharing (OReillys Hacks Series)
    ISBN: 0596009461
    EAN: 2147483647
    Year: 2005
    Pages: 158
    Authors: Joshua Paul

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net