Home > Articles

Using Video

This chapter is from the book

Optimizing Video

Two topics relate to optimization: optimizing performance and optimizing download speed. Although these are, indeed, two different topics, in the case of video, they're often related. That is, a video file with many detailed frames tends to be large (so it downloads slower), and it also tends to perform worse because there's so much data that needs to be uncompressed and displayed onscreen. The topic of playback performance is discussed in greater detail later in Hour 20. For now, let's talk about how to make video files small.

It may seem obvious that the reason to keep Flash movies small is to minimize download time. However, because Flash can stream (meaning that the movie starts playing before it's entirely downloaded), you don't need to worry so much about the entire movie's download time, rather just the pause before playback begins. For example, if a movie takes 2 minutes to download, that's only "long" if the movie's playback time is 10 seconds. Conversely, a 2-minute download for a movie that plays for 2 minutes isn't long at all considering it will start playing after only a 12-second pause (later frames are downloaded while the user watches the first frames). I calculated the preload using the following formula:

preload = (download time) x (play time) + (10% of play time)

So really, the concern is keeping that preload time to a minimum. The preload time is a factor of the relationship between download time and play time (plus a 10% safety for fluctuations in connection speed). It just so happens that a video with a long playback time is nearly always going to have a similarly large download time—but not always. The point is that we care about the preload, not necessarily the total download time. By the way, the Bandwidth Profiler (introduced in Hour 20) will be instrumental for calculating actual download and preload times.

Settings for Sorenson Spark

Every time you import video into Flash you're given options as to how you want to compress the video. The compression technology used in Flash is called Spark and is licensed from Sorenson. During the process of compression, your video is analyzed for ways that similar data (say the portion of an unmoving background) can be recycled to make the file smaller. Basically, the video is compressed to make the file smaller (not unlike "zipping" or "stuffing" a file). Then after it's downloaded and playing on the user's machine, it's decompressed. In the case of zipping or stuffing a file, you want all the data in the original to be restored. That's called lossless compression. In the case of video, you want to use so-called lossy compression because it makes the file even smaller. The only side effect is that data is lost. Just like .JPG images or .MP3 sounds (which are also lossy) that's not a problem because the data that's lost is usually not noticeable. It just depends; when you compress a lot, the quality becomes notably worse.

The simple rule for compression is: compress as much as possible without compressing so much that quality becomes unacceptable. Obviously, this is subjective. And, unfortunately, video compression can be complex because multiple images as well as sound all factor into the process. Luckily, you don't have to learn any more than the few dials that appear in the Spark compression dialog box shown in Figure 17.9.

Figure 17.9 It's worth learning each setting in the compression dialog box because they affect quality and download time.

You need to make several considerations when configuring the Spark compression dialog box. Probably the first thing to note is the source video's data. The Movie Size includes the pixel dimensions (190x240 in Figure 17.9). If you want, you can scale that down by dragging the Scale slider or by typing a percentage. Any change you make will be reflected in the output properties on the right. Without exception, a scaled-down video (besides looking smaller) results in a smaller file size.

The Quality setting is the most difficult to judge because you won't see the results of a higher or lower quality until after you click OK. If you're unhappy with the quality results (either it doesn't look good or you think you could sacrifice even more quality), you'll need to re-import the video to make another selection. I suggest always setting that at least a tad lower than 100—even just down to 99 will result in a smaller file without noticeable quality degradation. Actually, the best process is to go "too far" toward low quality and then back off (going higher) until you're satisfied. (Again, you'll have to re-import the video to make new compression settings—but that's easily done from the Library item's properties dialog box shown in Figure 17.10).

Figure 17.10 To re-import (and choose different compression settings), select the properties option for the Library item.

Although Scale and Quality are subjective decisions, they happen to be the easiest to understand. Keyframe Interval requires you know a little about how Sorenson Spark compression works. It's called "temporal" (or over time), meaning that the entire first frame of the video is saved. And then, during the ensuing frames, only the difference that appears over time is saved (which saves space) until the following keyframe where the whole frame is saved again.

The Keyframe Interval lets you specify how far apart the keyframes occur. That is, exactly how many "interframes" before the next keyframe. The simple rule is a lower Keyframe Interval means more keyframes, which means a larger file but one that allows for better instant-access to any one frame. You should only select a low Keyframe Interval if you plan to script a way to play the video backward, or if the visual content is fast changing. Similarly, only select a high Keyframe Interval if the visual content is slow changing. Ultimately, you just have to play around with it and note how performance and file size are affected.

Finally, the synchronization options let you control how a video with one frame rate will play inside Flash, which has its own frame rate (which may or may not be the same). Take the likely situation in which your original video's frame rate is 30 fps, but you plan to keep your Flash movie at a more conservative 12 fps. If the video is 10 seconds long, that's a total of 300 frames. But a Flash movie at 12 fps will only display 120 frames in the same 10 seconds.

There are many options for how to deal with this mismatch. For example, you may want to import only 12 frames for every second of video; in which case, you'd only import fewer than every other frame. Or, you might want to import all 300 frames, but then the video would appear to play slowly (in addition to having audio drift out of synch—and, no, you can't just play the audio slowly). You'll usually just select the option Synchronize Video to Macromedia Flash Document Frame Rate, which translates to mean: I want the video to match my current frame rate (in Flash) even if that means frames are skipped (called drop frames) during import. Realize, of course, that the motion in a 30 fps video playing at 12 fps (and having dropped frames) will look jumpier than it will at 30 fps.

In some situations you'll want to modify the default synchronize option or even turn it off. If you're importing video originally created for television, the video's frame rate may likely be the odd number 29.97 fps. In fact, this is close enough to 30 fps, where if the audio were to drift out of sync it would take a long time to notice. However, if your Flash movie is at 30 fps and you select the synchronize option, you may see a subtle visual artifact where the graphics jitter periodically. It's definitely subtle, and I can't say that I've actually seen it—but it's a real thing.

Usually, original videos will have a higher frame rate, in which case, you'll have to decide whether to drop frames to make it match. However, it's possible that the video was created at a lower frame rate. If you select the synchronize option in this case, you'll actually add paused frames to make the video match. Normally, this is not a problem; however, it's worth considering lowering the Flash movie's frame rate (that tends to make everything smaller because there will be fewer total frames). By the way, if you don't synchronize in this case (of a video with a lower frame rate), the video will play extra fast.

Just to be complete (and to perhaps add more detail than you want), I should mention a setting called Video Frames to Flash Frames Ratio. We already considered the case of a video with a higher frame rate than Flash and how you could select the synchronize option to drop the appropriate number of frames to make it stay synchronized. But what if you want to drop even more frames to make the file smaller? Naturally, the motion in the video will look even worse—but it may be worth it. The drop-down list normally shows 1:1, meaning that one video frame will be compressed for every one frame in Flash. If you set it to 1:2 that means only one video frame will be compressed for every two frames in Flash. This forces every other frame that would have otherwise been compressed to be dropped.

You can select other ratios, and each one means that the video will be jumpier but smaller. I understood this option much better when I explored different options and simply looked at the resulting output properties on the dialog box. Finally, realize that this ratio option can be independent of the synchronize. Think of it this way: Synchronize has priority, meaning that necessary adjustments are made for this first. Then, if you select a ratio other than 1:1, Flash looks at the frames it planned on compressing and then compresses even fewer depending on your setting.

Here's a quick rundown of my compression suggestions:

  • Select the scale (or, really, the final window size) first.

  • Determine the target file size (based on how much of a pause the viewer will endure).

  • Determine the Flash movie's frame rate before importing a video because this affects the synchronization options.

  • Think about the nature of your content. Does image quality or motion smoothness have a higher priority? Tinker with both the quality setting and the video-to-Flash frames ratio (to drop frames).

  • Always lower the quality a little—even if just to 99.

  • Don't mess with the keyframe interval unless the user needs quick random access to any specific frame (in which case, you lower the keyframe interval).

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020