Publish Multiple Format Videos

PHP Media Handler Pro provide media processing template section where you can create unlimited no of templates and use these templates in your code to generate multiple outputs

Overview

PHP Media Handler Pro provide media processing template section where you can create unlimited no of templates and use these templates in your code to generate multiple outputs.

These templates will help you to separate all videos and audio options in separate location so you can easily manage and adjust it time to time based on your requirements.

Templates

List of builtin templates available in PHP Media Handler Pro script.

iTag Detail Information
0
240p flv video.
1
360p flv video
2
480p flv video
3
720p flv video
4
240p mp4 video
5
360p mp4 video
6
480p mp4 video
7
720p mp4 video
8
1080p mp4 video
9
240p webm video
10
360p webm video
11
480p webm video
12
720p webm video
13
1080p webm video
14
mp3 audio

Example Code

iTags can be passed to encoder.php script to generate multi level, multi format outputs from source video or audio file.

include_once("encoder.php");
$itags = array();
$itags[] = 5; // 360p mp4 encoding
$itags[] = 7; // 720p mp4 encoding
$itags[] = 11; // 480p webm encoding
$itags[] = 14; // mp3 encoding
$mhandler->itags = $itags;

Example: Complete example.

include_once("encoder.php");
ini_set('max_execution_time', 3600); // set max execution time
$servicePath =  $rootPath . "ffmpeg/"; // ffmpeg path
$mhandler = new mhpEncoder();
$mhandler->rootPath = $rootPath;
$mhandler->servicePath = $servicePath;
$mhandler->sourcePath = $rootPath . "contents/source/";
$mhandler->publishPath = $rootPath . "contents/published/";
$mhandler->thumbsDirectory = $rootPath . "contents/thumbs/";
$mhandler->sourceFileName = "sample.avi";
$mhandler->publishFileName = "sample.mp4";
$mhandler->grabThumbs = false; // don't capture thumbs
$itags = array();
$itags[] = 5; // 360p mp4 encoding
$itags[] = 7; // 720p mp4 encoding
$itags[] = 11; // 480p webm encoding
$itags[] = 14; // mp3 encoding
$mhandler->itags = $itags;
$mhandler->postWatermark = false; // post watermark
$info = $mhandler->Process();
if($info->errorcode > 0)
{
	echo "Error Code: " . $vinfo->errorcode . ", Message: " . $vinfo->errorMessage;
	exit;
} 
echo returnOutput($info);

Articles