|
| __construct ($aObject, $oStorage) |
|
| applyFilter_Poster ($sFile, $aParams) |
|
| applyFilter_Mp4 ($sFile, $aParams) |
|
| applyFilter_Webm ($sFile, $aParams) |
|
| _convertVideo ($sFile, $sFileOut, $sExt, $aParams, $aOptions) |
|
| _getOptionSizeForVideo ($sFile, $aParams) |
|
| _getFfmpegThreadsParams () |
|
| storeTranscodedFileInQueueStorage ($mixedHandler, $sTmpFile, &$sFileUrlResult) |
|
| addToQueue ($mixedHandler, $iProfileId=0) |
|
| applyFilter_Resize ($sFile, $aParams) |
|
| isFileReady_Folder ($mixedHandlerOrig, $isCheckOutdated=true) |
|
| isFileReady_Storage ($mixedHandlerOrig, $isCheckOutdated=true) |
|
| isPrivate_Folder ($mixedHandler) |
|
| isPrivate_Storage ($mixedHandler) |
|
| getFilePath_Folder ($mixedHandler) |
|
| storeFileLocally_Folder ($mixedHandler) |
|
| storeFileLocally_Storage ($mixedHandler) |
|
| storeFileLocally_Queue ($mixedHandler) |
|
| getOrigFileUrl_Folder ($mixedHandler) |
|
| getOrigFileUrl_Storage ($mixedHandler) |
|
| initFilters () |
|
| clearCacheDB () |
|
| processHandlerForRetinaDevice ($mixedHandler) |
|
This class transcodes videos and generates video thumbnails.
To generate video which plays in all moders browsers along with video poster, you need to create 3 different video transcoding objects which will generate .mp4, .webm videos and video poster. Video is converting upon first access, so it is probably better to force video conversion by calling
- See also
- BxDolTranscoderVideo\getFileUrl just after video uploading. Video for conversion is queued and when cron is run video conversion is performed. While video is pending for conversion or in the process then
-
BxDolTranscoderVideo\getFileUrl methods returns empty string for video and predefined image for video poster.
Transcoder object and other params are the same as in
- See also
- BxDolTranscoderImage, but it is highly recommended to disable 'atime_pruning' and 'atime_tracking', or set it to fairly big value, since video transcoding is not performed on the fly and takes some time.
Video conversion can be performed on separate server or multiple servers, to do it:
- install the script on separate server(s), but connect to the same DB which your main site is using
- enable 'sys_transcoder_queue_files' option (when it is enabled it takes a little longer to convert videos)
- add the following code to the begining of inc/header.inc.php file on the main site, where your actual site in installed:
define('BX_TRANSCODER_PROCESS_COMPLETED', '');
- if you don't want your main site to convert videos, so all conversion will be performed on the separate server, add the following code to the begining of inc/header.inc.php file on the main site:
define('BX_TRANSCODER_NO_TRANSCODING', '');
- all servers must have different host name
- only main server must be used as site, additional sites are just for video conversion, don't perform any action on these sites
Available filters:
- Mp4 - this filter convert video into .mp4 format along with resizing, the parameters are the following:
- h - height of resulted video (360px by default), for video it is highly recommended to specify only height parameter (without width parameter)
- video_bitrate - video bitrate (512k by default)
- audio_bitrate - video bitrate (128k by default)
- ffmpeg_options - additional command line options for ffmepeg, as key => value array (empty by default)
- Webm - this filter convert video into .webm format along with resizing, the parameters are the same as for Mp4 filter
- Poster - this filter generates video thumbnail, it tries to get poster at 0, 3 and 5 seconds from the beginning, it gets first not fully black/white thumb
Example of usage:
$oTranscoderMp4->registerHandlers();
$oTranscoderWebm->registerHandlers();
$oTranscoderPoster->registerHandlers();
$sUrlMp4 = $oTranscoderMp4->getFileUrl(33);
$sUrlWebM = $oTranscoderWebm->getFileUrl(33);
$sUrlPoster = $oTranscoderPoster->getFileUrl(33);
echo 'My cat:' . BxTemplFunctions::getInstance()->videoPlayer($sUrlPoster, $sUrlMP4, $sUrlWebM);
static getObjectInstance($sObject)
Definition BxDolTranscoder.php:52
Also
- See also
- transcoder_videos sample for complete example.