在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:xemle/html5-video-php开源软件地址:https://github.com/xemle/html5-video-php开源编程语言:PHP 100.0%开源软件介绍:Create HTML5 Videosffmpeg wrapper to convert videos to HTML5 compatible formats of MP4, WEBM, and OGG to support all common mobile devices and desktop browsers. Converted videos can be used with videojs or flowplayer. With different ffmpeg versions, their specific option syntax and different devices it is tricky to convert videos to HTML5 compatible videos. This wrapper library makes HTML5 video conversion as easy as possible. To support most devices and browser MP4, WEBM, and OGG video container are supported. See Video on the Web for further details. To support also Apples iDevices like iPod, iPhone, and iPad following settings are used for MP4 format (see Video Encoding, Flowplayer.org):
Further Quickstart$config = array(
'ffmpeg.bin' => '/usr/bin/ffmpeg',
'qt-faststart.bin' => '/usr/bin/qt-faststart',
);
$html5 = new Html5Video\Html5Video($config);
$html5->convert('source.avi', 'html5-720p.mp4', '720p-sd'); Requirements
Following ffmpeg versions from 0.6 are supported Install ffmpeg on Ubuntu
Windows buildsDownload latest ffmpeg from Zeranoe FFmpeg builds and qt-faststart from Windows qt-faststart Builds Installinghtml5-video-php uses composer
UsageInclude
Create a H264 video $config = array(
'ffmpeg.bin' => '/usr/bin/ffmpeg',
'qt-faststart.bin' => '/usr/bin/qt-faststart',
);
$html5 = new Html5Video\Html5Video($config);
// target format is the file extension of $targetVideo. One of mp4, webm, or ogg
$profileName = '720p-hd'; // other profiles are listed in src/Html5Video/profiles
$html5->convert($srcVideo, $targetVideo, $profileName); Usage CLIYou can also you the command line interface $ php bin/Html5VideoConverter.php input.avi output.mp4 720p-sd ProfilesThere are different video profiles to create different video sizes:
hd stands for high definition and sd for standard definition profiles. The profile are simple json definition files like {
"video": {
"width":1280,
"height": 720,
"bitrate": "5000k",
"framerate": 30
},
"audio": {
"bitrate": "160k",
"samplingrate": 44100
}
} You can add your on definitions and add them to the $config variable: $config = array(
'profile.dirs' => array('YOUR PROFILE PATH')
); APIHtml5Video($config = array(), $process = null, $cache = null) Constructor
Html5Video::convert($src, $dst, $profileName, $options = array()) Convert given video file to HTML5 compatible format Options are:
If (array) Html5Video::getVideoInfo($src) Get basic information about video file. Values contain
(array) Html5Video::listProfiles() Get list of available profile names (object) Html5Video::getProfile($name) Get profile data (array) Html5Video::getVersion() Get current ffmpeg version as array (array) Html5Video::getEncoders() Get list of supported encoders TestingFor testing phpunit is used. Run $ phpunit in LicenseMIT License. See LICENSE file |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论