本文整理汇总了PHP中Video::extractSegment方法的典型用法代码示例。如果您正苦于以下问题:PHP Video::extractSegment方法的具体用法?PHP Video::extractSegment怎么用?PHP Video::extractSegment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::extractSegment方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Video
<?php
namespace PHPVideoToolkit;
include_once './includes/bootstrap.php';
try {
$video = new Video($example_video_path);
$process = $video->extractSegment(new Timecode(10), new Timecode(20))->save('./output/test-' . time() . '.mp3', null, Media::OVERWRITE_EXISTING);
echo '<h1>Executed Command</h1>';
Trace::vars($process->getExecutedCommand());
echo '<hr /><h1>FFmpeg Process Messages</h1>';
Trace::vars($process->getMessages());
echo '<hr /><h1>Buffer Output</h1>';
Trace::vars($process->getBuffer(true));
echo '<hr /><h1>Resulting Output</h1>';
Trace::vars($process->getOutput()->getMediaPath());
} catch (FfmpegProcessOutputException $e) {
echo '<h1>Error</h1>';
Trace::vars($e);
$process = $video->getProcess();
if ($process->isCompleted()) {
echo '<hr /><h2>Executed Command</h2>';
Trace::vars($process->getExecutedCommand());
echo '<hr /><h2>FFmpeg Process Messages</h2>';
Trace::vars($process->getMessages());
echo '<hr /><h2>Buffer Output</h2>';
Trace::vars($process->getBuffer(true));
}
} catch (Exception $e) {
echo '<h1>Error</h1>';
Trace::vars($e->getMessage());
示例2: Video
<?php
namespace PHPVideoToolkit;
include_once './includes/bootstrap.php';
try {
$video = new Video($example_video_path);
// $process->setProcessTimelimit(1);
$process = $video->extractSegment(new Timecode(10), new Timecode(20))->save('./output/big_buck_bunny.flv', null, Media::OVERWRITE_EXISTING);
echo '<h1>Executed Command</h1>';
Trace::vars($process->getExecutedCommand());
echo '<hr /><h1>FFmpeg Process Messages</h1>';
Trace::vars($process->getMessages());
echo '<hr /><h1>Buffer Output</h1>';
Trace::vars($process->getBuffer(true));
echo '<hr /><h1>Resulting Output</h1>';
Trace::vars($process->getOutput()->getMediaPath());
} catch (FfmpegProcessOutputException $e) {
echo '<h1>Error</h1>';
Trace::vars($e);
$process = $video->getProcess();
if ($process->isCompleted()) {
echo '<hr /><h2>Executed Command</h2>';
Trace::vars($process->getExecutedCommand());
echo '<hr /><h2>FFmpeg Process Messages</h2>';
Trace::vars($process->getMessages());
echo '<hr /><h2>Buffer Output</h2>';
Trace::vars($process->getBuffer(true));
}
} catch (Exception $e) {
echo '<h1>Error</h1>';
示例3: Video
<?php
namespace PHPVideoToolkit;
include_once './includes/bootstrap.php';
echo '<a href="?method=blocking">Blocking</a> | <a href="?method=non-blocking">Non blocking</a><br />';
try {
$video = new Video($example_video_path);
$video->extractSegment(new Timecode(10), new Timecode(30));
$process = $video->getProcess();
$multi_output = new MultiOutput();
$flv_output = './output/big_buck_bunny.multi1.ogg';
$format = Format::getFormatFor($flv_output, null, 'VideoFormat');
$format->setVideoDimensions(VideoFormat::DIMENSION_SQCIF);
$multi_output->addOutput($flv_output, $format);
$threegp_output = './output/big_buck_bunny.multi2.3gp';
$format = Format::getFormatFor($threegp_output, null, 'VideoFormat');
$format->setVideoDimensions(VideoFormat::DIMENSION_XGA);
$multi_output->addOutput($threegp_output, $format);
$threegp_output = './output/big_buck_bunny.multi3.3gp';
$format = Format::getFormatFor($threegp_output, null, 'VideoFormat');
$format->setVideoDimensions(VideoFormat::DIMENSION_XGA);
$multi_output->addOutput($threegp_output, $format);
if (isset($_GET['method']) === true && $_GET['method'] === 'blocking') {
echo '<h2>Blocking Method</h2>';
// If you use a blocking save but want to handle the progress during the block, then assign a callback within
// the constructor of the progress handler.
// IMPORTANT NOTE: most modern browser don't support output buffering any more.
$progress_data = array();
$progress_handler = new ProgressHandlerNative(function ($data) use(&$progress_data) {
// do something here like log to file or db.
开发者ID:kunitwru,项目名称:phpvideotoolkit-v2,代码行数:31,代码来源:convert-to-multiple-output-progress-handler-native.php
示例4: Video
$config->gif_transcoder = 'gifsicle';
} else {
if ($gif_transcoder === 'gifsicle-with-convert') {
$config->convert = $convert;
$config->gif_transcoder = 'gifsicle';
} else {
if ($gif_transcoder === 'convert') {
$config->convert = $convert;
$config->gif_transcoder = 'convert';
}
}
}
$output_format = Format::getFormatFor($output_path, $config, 'ImageFormat');
$output_format->setVideoFrameRate(12);
$video = new Video($example_video_path, $config);
$process = $video->extractSegment(new Timecode(10), new Timecode(30))->save($output_path, $output_format, Media::OVERWRITE_EXISTING);
$length = microtime_float() - $start;
echo '<h1>' . str_replace('-', ' ', $gif_transcoder) . '</h1>';
echo 'File = ' . $output_path . '<br />';
echo 'Time to encode = ' . $length . '<br />';
echo 'File size = ' . filesize($output_path) / 1024 / 1024 . ' MB<br />';
}
} catch (FfmpegProcessOutputException $e) {
echo '<h1>Error</h1>';
Trace::vars($e->getMessage());
echo '<h2>FfmpegProcessOutputException</h2>';
Trace::vars($e);
$process = $video->getProcess();
if ($process->isCompleted()) {
echo '<hr /><h2>Executed Command</h2>';
Trace::vars($process->getExecutedCommand());
示例5: Video
<?php
namespace PHPVideoToolkit;
include_once './includes/bootstrap.php';
try {
$video = new Video($example_video_path);
$video->extractSegment(new Timecode(15));
$process = $video->save('./output/big_buck_bunny.my_silly_custom_file_extension', new ImageFormat_Jpeg('output'), Media::OVERWRITE_EXISTING);
echo '<h1>Executed Command</h1>';
Trace::vars($process->getExecutedCommand());
echo '<hr /><h1>FFmpeg Process Messages</h1>';
Trace::vars($process->getMessages());
echo '<hr /><h1>Buffer Output</h1>';
Trace::vars($process->getBuffer(true));
echo '<hr /><h1>Resulting Output</h1>';
Trace::vars($process->getOutput()->getMediaPath());
} catch (FfmpegProcessOutputException $e) {
echo '<h1>Error</h1>';
Trace::vars($e);
$process = $video->getProcess();
if ($process->isCompleted()) {
echo '<hr /><h2>Executed Command</h2>';
Trace::vars($process->getExecutedCommand());
echo '<hr /><h2>FFmpeg Process Messages</h2>';
Trace::vars($process->getMessages());
echo '<hr /><h2>Buffer Output</h2>';
Trace::vars($process->getBuffer(true));
}
} catch (Exception $e) {
echo '<h1>Error</h1>';
示例6: Video
<?php
namespace PHPVideoToolkit;
include_once './includes/bootstrap.php';
ob_start();
echo '<p>This is an example to chain processing on from one output to another to another and so on.</p><hr />';
echo '<p>.mov status: <strong id="status-1">---</strong></p>';
echo '<p>resize mov status: <strong id="status-2">---</strong></p>';
echo '<p>jpeg from resized mov status: <strong id="status-3">---</strong></p>';
ob_flush();
try {
$video = new Video($example_video_path);
$progress_handler = new ProgressHandlerNative();
$process = $video->extractSegment(new Timecode(10), new Timecode(20))->saveNonBlocking('./output/big_buck_bunny.mov', null, Media::OVERWRITE_EXISTING, $progress_handler);
$dot_count = -1;
while ($progress_handler->completed !== true) {
$dot_count += 1;
$data = $progress_handler->probe(true);
if ($data['started'] === true) {
echo '<script>document.getElementById("status-1").innerHTML = ' . json_encode('Encoding to mov ' . $data['percentage'] . '% ' . str_pad('', $dot_count, '.')) . '</script>';
echo ' ';
ob_flush();
//sleep(1);
if ($dot_count > 10) {
$dot_count = -1;
}
} else {
echo '<script>document.getElementById("status-1").innerHTML = ' . json_encode('Waiting for encoding to start') . '</script>';
echo ' ';
ob_flush();
示例7: Video
<?php
namespace PHPVideoToolkit;
include_once './includes/bootstrap.php';
try {
$video = new Video($example_video_path);
// $process->setProcessTimelimit(1);
$process = $video->extractSegment(new Timecode(10), new Timecode(20))->save('./output/big_buck_bunny.ogg');
echo '<h1>Executed Command</h1>';
Trace::vars($process->getExecutedCommand());
echo '<hr /><h1>FFmpeg Process Messages</h1>';
Trace::vars($process->getMessages());
echo '<hr /><h1>Buffer Output</h1>';
Trace::vars($process->getBuffer(true));
echo '<hr /><h1>Resulting Output</h1>';
Trace::vars($process->getOutput()->getMediaPath());
} catch (FfmpegProcessOutputException $e) {
echo '<h1>Error</h1>';
Trace::vars($e);
$process = $video->getProcess();
if ($process->isCompleted()) {
echo '<hr /><h2>Executed Command</h2>';
Trace::vars($process->getExecutedCommand());
echo '<hr /><h2>FFmpeg Process Messages</h2>';
Trace::vars($process->getMessages());
echo '<hr /><h2>Buffer Output</h2>';
Trace::vars($process->getBuffer(true));
}
} catch (Exception $e) {
echo '<h1>Error</h1>';
示例8: Video
<?php
namespace PHPVideoToolkit;
include_once './includes/bootstrap.php';
try {
$video = new Video($example_video_path);
// $process->setProcessTimelimit(1);
$process = $video->extractSegment(new Timecode(10), new Timecode(20))->save('./output/big_buck_bunny.mp3', new AudioFormat_Mp3('output'), Media::OVERWRITE_EXISTING);
echo '<h1>Executed Command</h1>';
Trace::vars($process->getExecutedCommand());
echo '<hr /><h1>FFmpeg Process Messages</h1>';
Trace::vars($process->getMessages());
echo '<hr /><h1>Buffer Output</h1>';
Trace::vars($process->getBuffer(true));
echo '<hr /><h1>Resulting Output</h1>';
Trace::vars($process->getOutput()->getMediaPath());
} catch (FfmpegProcessOutputException $e) {
echo '<h1>Error</h1>';
Trace::vars($e);
$process = $video->getProcess();
if ($process->isCompleted()) {
echo '<hr /><h2>Executed Command</h2>';
Trace::vars($process->getExecutedCommand());
echo '<hr /><h2>FFmpeg Process Messages</h2>';
Trace::vars($process->getMessages());
echo '<hr /><h2>Buffer Output</h2>';
Trace::vars($process->getBuffer(true));
}
} catch (Exception $e) {
echo '<h1>Error</h1>';