伪视频流技术(Pseudo Streaming)

做视频站点的人,都会或多或少的接触伪视频流技术

伪流技术是一种能在常见HTTP服务器如APACHE、tomcat、IIS或lighttpd, nginx 上安装提供的一种协议。它使用服务端脚本来提供FLASH到服务器的视频交互。播放器在URL上携带start time的参数发送HTTP请求到服务端,服务端的脚本处理视频流并且给予回复,保证提供的视频流起始位置与START TIME参数所对应。这个start time的参数通常命名为“start”,这个技术同样被风靡全球的youtube所使用,它使用的是lighttpd WEB服务器。

 

对于播放器来说,使用伪流或其他流式的解决方案最大的好处是:能跳转到尚未下载到的视频部分。这种情况在很符合大文件播放需求,比如2个小时的视频,用户想立刻跳转到它的后面部分开始播放,(这样不需要下载中间用户不关心的部分了)。好处如下:

 

# 能够随机跳转到视频的任意时间
# 从视频的中间开始播放
# 提供客户方流媒体服务器和服务端脚本集成的可能(???)
# 支持FLV和H.264的视频

更多

查看linux configure arguments

We can use nginx as an example:

[[email protected]:~]nginx -V
nginx version: nginx/1.4.1
built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)
TLS SNI support enabled
configure arguments: –prefix=/etc/nginx/ –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –pid-path=/var/run/nginx.pid –lock-path=/var/run/nginx.lock –http-client-body-temp-path=/var/cache/nginx/client_temp –http-proxy-temp-path=/var/cache/nginx/proxy_temp –http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp –http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
–http-scgi-temp-path=/var/cache/nginx/scgi_temp –user=nginx –group=nginx –with-http_ssl_module
–with-http_realip_module –with-http_addition_module –with-http_sub_module –with-http_dav_module
–with-http_flv_module –with-http_mp4_module –with-http_gzip_static_module –with-http_random_index_module
–with-http_secure_link_module –with-http_stub_status_module –with-mail –with-mail_ssl_module
–with-file-aio –with-ipv6 –with-cc-opt=’-O2 -g’ –add-module=/usr/src/headers-more-nginx-module-0.20

 

If we compile nginx from source, we can use

./configure –with-http_flv_module –with-http_mp4_module –with-other-modules

在landing page上增加audio

一般人的解决方案是用niftyplayer 来增加audio,但是我个人可能会更加喜欢yahoo media 的解决方案。 Anyway,众口相传的解决方案确实是有道理的

使用办法:

  1. 下载niftyplayer: niftyplayer
  2. 把下列代码加入你的LP当中

<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0″ width=”165″ height=”38″ id=”niftyPlayer1″ align=””>
<param name=movie value=”niftyplayer.swf?file=betty.mp3&as=1″>
<param name=quality value=high>
<param name=bgcolor value=#FFFFFF>
<embed src=”niftyplayer.swf?file=betty.mp3&as=1” quality=high bgcolor=#FFFFFF width=”165″ height=”38″ name=”niftyPlayer1″ align=”” type=”application/x-shockwave-flash” pluginspage=”http://www.macromedia.com/go/getflashplayer”>
</embed>
</object>

注意字体为红色的地方,是你需要修改的

把betty.mp3改为你的mp3的文件

as = 1 表示自动播放,0表示不是自动播放