`

深入:FLASH视频播放传输方式——渐进式与流式

阅读更多

本博客中原有一篇“Introduction - How to Create Streaming Video”作为FLASH视频的初级入门文档,为了更多了解FLASH视频播放,深入了解各种方案的利弊,为选择FLASH视频播放方案提供依据,又特译了此篇! 

 

 

本文从《Flash.Video.for.Professionals Expert Techniques for Integrating Video on the Web》摘录而来,并做了关键性的翻译。

 欢迎转载,转载时请注明出处,由于本人也正在学习FLASH相关的知识,本文如有翻译错误,请指正!!

 

Progressive or Streaming? That Is the Question

Now that you’ve got the interface and functionality under control, it’s time to answer the eternal question: What method will you use to deliver the video? You have three options:

 

三种视频传输方式:

• Embed the video in an SWF.

视频嵌入到SWF

 

• Provide a progressive download FLV, loaded into an SWF.

提供一个渐进式下载然后载入到SWFFLV视频格式文件

 

• Stream from Flash Media Server (FMS), viewed through an SWF.

通过SWF观看从FMSFLASH媒体服务器)流式下载的的视频

 

 

Note that in each method, you will need an SWF shell to play the FLV through.

This shell will contain all the ActionScript needed to load the FLV. (Yea! Finally, some

ActionScript!) First, let’s look at each delivery option in detail.

注意以上每种方式,你都需要一个SWF的外壳程序来播放FLV视频。这个外壳程序包含装载FLV视频文件的ActionScript脚本。

 

Embed Video in SWF

SWF中嵌入视频

This is the most basic option, available for Flash 4 and up (see Figure 3.2). In most professional applications, though, you’d never use this method. It’s good for very short clips (5 seconds or less) whose quality is not so important. The only reason you’d ever want to use this method would be if you needed to deploy one single encapsulated SWF or if you needed to deliver short clips to older versions of Flash. Also, some older versions of the Linux Flash Player have reportedly had issues with FLV playback, so it’s common to use SWF videos when delivering short videos to Linux clients. This embed method can actually be helpful because it gives you visual feedback if you need to develop animation overlays and interactivity. It lets you actually see each frame on the timeline in Flash as you animate.

此种方式主要用于那些视频质量并不重要且非常短小的剪辑(5秒或更短),只有当你需要部署一个单一的封装好的SWF(把剪辑绑定到SWF中)或需要把短小视频剪辑用于老版本Flash中。这种嵌入方式益处在于当你需要开发覆盖与交互功能的动画时它能让你看清你FLASH动画中每一个时间线上的动画帧。

 

Note: Embedded video is limited to 16,000 frames, and audio can quickly fall out of sync with the video. Also, the SWF’s frame rate must match the video frame rate,which can sometimes create headaches.嵌入式视频有16000帧限制,还有视频音频的同步难题。

 

 

Progressive Download

渐进式下载

This is most likely the method you’ll end up using in your application. It is the most commonly used, being compatible with Flash Player 6 and up. “Progressive” means that as the FLV file is downloaded to your computer, or “cached,” it starts to play. This method is most efficient for clips that are 5–90 seconds in length, but longer clips can be accommodated with well-planned caching. There is no limit to file size or duration, and there are no audio synchronization issues. Because the FLV file is external to the SWF shell, it is relatively easy to swap video content without republishing your SWF. This gives you great flexibility in developing dynamic video applications. The frame rate of the video can be different from the SWF, which is also invaluable when swapping videos, allowing you to accommodate files with differing frame rates into the same shell.

这种方式是我们应用最多的方式,可适用于Flash Player 6或以上。渐进(Progressive)表示当FLV视频文件被下载或缓存到我们的电脑,然后再播放。对5-90秒长度的视频很有效,如果更长时间的视频则需要适宜的缓存策略。这种方式没有文件大小与时长限制、没有音频同步问题。由于FLV文件在SWF播放程序外部,所以非常容易在不用重新发布我们的SWF而实现视频切换。

SWF播放的视频可以是不同的帧率,这往往在切换视频时非常有用,可以实现在同一播放程序中调节不同文件为不同帧率播放。

 

Progressive download isn’t the perfect solution, however. There are three issues that you’ll want to be aware of. First, viewers can’t seek ahead in the video beyond the portion that’s been downloaded, which can be a problem with large video files. Often your viewer wants to skip ahead to a part of the video or see if the content is something they want to watch. Second, when viewers do jump ahead in a fully downloaded video, they’re constrained to jumping between keyframes. This results in a “choppy” feel to the video, which can be undesirable. Finally, there’s the issue of digital rights management (DRM). The FLV file is actually downloaded to the viewer’s machine after it’s cached, and is stored on their hard drive. This can be a big problem if you’re delivering copyright-protected video. If this is an issue for you, you’ll be glad to know that we’ll talk about DRM in more detail later in this chapter.

然而渐进式下载并不是完美的方案。有三个问题你需要了解清楚。

第一,我们不能向前播放那些还没有被下载到我们电脑的那部分视频段,这对于大的视频文件就是个问题了。

第二,当观看者在下载完的视频中向前跳跃播放时,他们会被限制在关键帧间,这就造成视频的波动(闪动,如果没有点击到关键帧,会自动跳动关键帧开始播放?)感。

最后,数字版权管理问题,FLV文件缓存后实际已被下载到观看者的电脑里,被存放到电脑硬盘中。

 

Streaming

流式下载

If progressive download is the workhorse of Flash video delivery, streaming is the luxury model. Delivered through a streaming server such as Flash Media Server (FMS) and compatible with Flash Player 6 and up, this method features built-in bandwidth detection, high-quality playback, faster video start time, advanced logging and monitoring, and real-time data synchronization. With its persistent connection between the client and server, streaming allows on-the-fly changes to FLV content. For example, you could change to a lower-quality video if the viewer’s connection slows down during playback. Or with live video, you could switch camera angles based on user interaction. You can even use the persistent connection to send data along with the video, such as a chat room or synchronized slides controlled by a live presenter. Scrubbing is streamlined as well; you can smoothly jump ahead in a video without having to download the file to that point, and without the jerkiness of jumping to the nearest existing keyframe (as in progressive download); keyframes are created on the fly by FMS.

如果说渐进式下载是粗重的Flash视频传输模式的话,流式就是一种豪华模式。通过一个媒体服务器(如FMS)传输视频且兼容Flash Player 6或以上版本,这种方式的特点包括了带宽检测、高品质播放、更快的视频开启时间、高级的日志与监视功能,以及实时的数据同步。利用在客户端与服务端的持久性连接,流式传输允许在运行时改变FLV的内容,如可以在观看者在网速下降情况下播放视频时传输更低品质的视频。或者在实时视频中,我们可以基于不同的用户交互下切换摄像的视角。你还可以利用持久的连接在传输视频时发送一些数据,如聊天室或被展示者控制的同步的幻灯片。选段播放(Scrubbing)同样是高效的,你可以平滑向前跳跃到还未下载下来的视频点,不会有渐进式下载时因为跳跃到最近的已下载的关键帧而产生的闪动(jerkiness)现象,关键帧被FMS在运行时创建。

 

As with progressive download, the SWF acts as a shell containing the video content,

so updating does not require republishing the SWF. Streaming also saves on bandwidth and hardware resources; viewers only download the portion of the video they watch, and nothing is stored on their hard drive. This brings us to another pretty significant benefit—the video is never cached, providing more security for copyrighted content. Currently this is the extent of DRM offered by Flash video. So, if you don’t want your viewers to have a copy of your video somewhere on their hard drive after viewing, streaming is your answer (though we will show you some tricks to add extra barriers to downloading later in this chapter). If you have large quantities of stored video, very long video clips, or live video (such as live event broadcasts or webcam chat rooms), you’ll want to choose streaming. The downside to streaming, of course, is its significantly higher deployment cost. Programming for FMS is also complex, as is setting up your own FMS server. Luckily, there are options such as Flash Video Streaming Services (FVSS) that can help streamline the deployment process in many cases. We’ll cover your various deployment options

而且流式传输可以节省带宽与硬件资源,观看视频的人只要下载那些他们需要观看的视频部分,硬盘上不会存储视频的任何东西(版权管理有用)。

如果你有大量的视频、长时段的视频剪辑或实时视频(如实时广播和视频聊天),则可以利用流式传输。但视频部署成本很高,且在FMS上编程也较复杂。

 

三种视频传输方式的特点对比:

三种传输方式比较

  • 大小: 8.5 KB
2
0
分享到:
评论
1 楼 xlhtc007 2010-07-15  
这篇文章写得不错!有空了好好学习一下你分享的这本书!

相关推荐

Global site tag (gtag.js) - Google Analytics