您当前的位置: 首页 > 学无止境 > 网站建设 网站首页网站建设
windows+apache+php+mysql环境下配置MP4视频流拖拽插件(mod_h264_streaming)
发布时间:2016-05-22 10:30:25编辑:雪饮阅读()
前段时间遇到一个比较棘手的任务,由于已有视频管理系统内置集成的是ckplayer的播放器核心。但出现一个问题就是对于mp4视频通过进度条拖拽会有bug,在缓冲区以内很正常,若是出现在缓冲区以外来拖拽进度条就会出现bug(每次就跑到了第一帧了)0。
这是因为服务器端缺少对视频流的配置,这里就以windows+apache的环境为例来说说如何配置该视频流拖拽插件。
在百度上你基本上会搜索到如下结果:
LoadModule h264_streaming_module modules/mod_h264_streaming.so
AddHandler h264-streaming.extensions .mp4
其实这种配置方法我也还真相信了,因为httpd.config文件中的确有很多模块都是类似配置方法。但最后证实并不可行,如此配置后apache直接就无法启动了。
后来雪饮用查阅该插件的官方英文安装说明,才知道正确的安装配置方法。
官方文档如下:
Read Me File for the Apache Haus Distribution of mod_h264_streaming 2.2.7 x64
Date: May 19, 2012
Application: mod_h264_streaming 2.2.7 x64
Distribution File: mod_h264_streaming-2.2.7-2.4.x-x64.zip
Original source by: CodeShop'
Original Home: http://h264.code-shop.com
Win32 binary by: The Apache Haus
Mail: info@apachehaus.com
Home: http://www.apachehaus.com
** This build for Apache 2.4.x x64 only! **
Supported Windows Versions:
Windows XP x64 Should Work
Windows Server 2003 x64 Should Work
Windows Vista x64 Should Work
Windows Server 2008 x64 Tested OK
Windows 7 x64 Should Work
Package Contents:
readme_first.html [this file]
LICENSE
modules/mod_h264_streaming.so
NOTES:
Built with Visual Studio 2008 x64 SP1, be sure to install the Visual C++ 2008 x64 SP1 Redistributable Package
it can be downloaded from;
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=BA9257CA-337F-4B40-8C14-157CFDFFEE4E
Licensed free under Creative Commons for non-commercial use only.
http://creativecommons.org/licenses/by-nc-sa/3.0/
Commercial use licenses are available from the author at
http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-License-Version2
Modified to:
Fix a bug which cause the error log to get polluted with an "Handler for h264-streaming.extensions returned invalid result code" error everytime a user would seek to a position in a video.
Couple casts to squash compiler warnings.
Added module announcement in Apache's server signature.
INTRODUCTION
The H264 Streaming Module is a plugin for your existing Apache webserver. Its features are as follows:
Timeshifting seek
Enable your viewers to immediately jump to any part of the video regardless of the length of the video or whether it has all been downloaded yet. Virtual video clips
You have really long video clips and you don't want to re-encode them into smaller parts? We also support 'virtual video clips', so you can specify to only playback a part of the video or create download links to specific parts of the video.
Virtual video clips also enables possibilities for Adaptive Streaming.
If you are already using the widely adopted MPEG4/H264 industry standard, there is no need to re-encode your MP4 videos, you can use your existing video files.
INSTALL
To install this module on your Apache 2.2.x server you need to copy the necessary files to your Apache folder and add items to your Apache's httpd.conf file. C:\Apache24 will be used as our ServerRoot for the examples below.
1. Install the Visual C++ 2008 SP1 Redistributable Package
Download, if you have not done so already, from the
address above.
2. Copy mod_h264_streaming.so to your Apache 2.2.x modules folder
C:/Apache24/modules/mod_h264_streaming.so for example
3. Add to your httpd.conf (example: C:/Apache24/conf/httpd.conf):
LoadModule h264_streaming_module modules/mod_h264_streaming.so<br />
<IfModule h264_streaming_module><br />
AddHandler h264-streaming.extensions .mp4<br />
</IfModule>
现在雪饮在这里总结下官方安装说明:
首先你需要下载mod_h264_streaming模块,下载地址为:
https://www.apachehaus.net/modules/mod_h264_streaming/
再该地址中选择和你apache版本相同且服务器位数相同的版本。
雪饮这里使用的是phpstudy2016集成环境其apache版本是2.4的,而服务器是64位的所以就选择了mod_h264_streaming-2.2.7-2.4.x-x64
将h.264模块解压后会得到.so的文件,将该文件存放于你的apache目录中专门用来存放模块文件的位置。例如雪饮的模块位置是“D:\phpStudy\Apache\modules”
然后再你的apache配置文件httpd.config中添加配置项如下:
LoadModule h264_streaming_module modules/mod_h264_streaming.so
<IfModule h264_streaming_module>
AddHandler h264-streaming.extensions .mp4
</IfModule>
然后重启apache,若能重启成功,并且测试视频进度条在未缓冲区的拖拽,若都正常那么恭喜你配置成功了。
关键字词:windows,apache,mod_h264_streaming,雪饮
上一篇:php原始最基础的文件上传