Skip to content

Commit 548a05b

Browse files
committed
2 parents f28ee41 + a299091 commit 548a05b

File tree

2 files changed

+47
-20
lines changed

2 files changed

+47
-20
lines changed

README.md

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,30 @@ It also currently provides FFmpeg-PHP emulation in pure PHP so you wouldn't need
66

77
**IMPORTANT** PHPVideoToolkit has only been tested with v1.1.2 of FFmpeg. Whilst the majority of functionality should work regardless of your version of FFmpeg I cannot guarantee it. If you find a bug or have a patch please open a ticket or submit a pull request on https://github.com/buggedcom/phpvideotoolkit-v2
88

9+
###Table of Contents
10+
11+
- [License](#license)
12+
- [Documentation](#documentation)
13+
- [Usage](#usage)
14+
- [Configuring PHPVideoToolkit](#configuring-phpvideotoolkit)
15+
- [Accessing Data About FFmpeg](#accessing-data-about-ffmpeg)
16+
- [Accessing Data About media files](#accessing-data-about-media-files)
17+
- [PHPVideoToolkit Timecodes](#phpvideotoolkit-timecodes)
18+
- [Extract a Single Frame of a Video](#extract-a-single-frame-of-a-video)
19+
- [Extract Multiple Frames from a Segment of a Video](#extract-multiple-frames-from-a-segment-of-a-video)
20+
- [Extract Multiple Frames of a Video at 1 frame per second](#extract-multiple-frames-of-a-video-at-1-frame-per-second)
21+
- [Extracting an Animated Gif](#extracting-an-animated-gif)
22+
- [Extracting Audio or Video Channels from a Video](#extracting-audio-or-video-channels-from-a-video)
23+
- [Extracting a Segment of an Audio or Video file](#extracting-a-segment-of-an-audio-or-video-file)
24+
- [Spliting a Audio or Video file into multiple parts](#spliting-a-audio-or-video-file-into-multiple-parts)
25+
- [Purging and then adding Meta Data](#purging-and-then-adding-meta-data)
26+
- [Changing Codecs of the audio or video stream](#changing-codecs-of-the-audio-or-video-stream)
27+
- [Non-Blocking Saves](#non-blocking-saves)
28+
- [Encoding with Progress Handlers](#encoding-with-progress-handlers)
29+
- [Accessing Executed Commands and the Command Line Buffer](#accessing-executed-commands-and-the-command-line-buffer)
30+
- [Supplying custom commands](#supplying-custom-commands)
31+
- [Imposing a processing timelimit](#imposing-a-processing-timelimit)
32+
933
##License
1034

1135
PHPVideoToolkit Copyright (c) 2008-2014 Oliver Lillie
@@ -29,7 +53,7 @@ PHPVideoToolkit requires some basic configuration and is one through the Config
2953
```php
3054
namespace PHPVideoToolkit;
3155

32-
$config = new \PHPVideoToolkit\Config(array(
56+
$config = new Config(array(
3357
'temp_directory' => './tmp',
3458
'ffmpeg' => '/opt/local/bin/ffmpeg',
3559
'ffprobe' => '/opt/local/bin/ffprobe',
@@ -184,11 +208,11 @@ $config->gif_transcoder = 'gifsicle';
184208

185209
$output_path = './output/big_buck_bunny.gif';
186210

187-
$output_format = \PHPVideoToolkit\Format::getFormatFor($output_path, $config, 'ImageFormat');
211+
$output_format = Format::getFormatFor($output_path, $config, 'ImageFormat');
188212
$output_format->setVideoFrameRate(5);
189213

190-
$video = new \PHPVideoToolkit\Video('media/BigBuckBunny_320x180.mp4', $config);
191-
$output = $video->extractSegment(new \PHPVideoToolkit\Timecode(10), new \PHPVideoToolkit\Timecode(20))
214+
$video = new Video('media/BigBuckBunny_320x180.mp4', $config);
215+
$output = $video->extractSegment(new Timecode(10), new Timecode(20))
192216
->save($output_path, $output_format);
193217

194218
```
@@ -205,11 +229,11 @@ $config->gif_transcoder = 'convert';
205229

206230
$output_path = './output/big_buck_bunny.gif';
207231

208-
$output_format = \PHPVideoToolkit\Format::getFormatFor($output_path, $config, 'ImageFormat');
232+
$output_format = Format::getFormatFor($output_path, $config, 'ImageFormat');
209233
$output_format->setVideoFrameRate(5);
210234

211-
$video = new \PHPVideoToolkit\Video('media/BigBuckBunny_320x180.mp4', $config);
212-
$output = $video->extractSegment(new \PHPVideoToolkit\Timecode(10), new \PHPVideoToolkit\Timecode(20))
235+
$video = new Video('media/BigBuckBunny_320x180.mp4', $config);
236+
$output = $video->extractSegment(new Timecode(10), new Timecode(20))
213237
->save($output_path, $output_format);
214238

215239
```
@@ -222,11 +246,11 @@ $config->gif_transcoder = 'php';
222246

223247
$output_path = './output/big_buck_bunny.gif';
224248

225-
$output_format = \PHPVideoToolkit\Format::getFormatFor($output_path, $config, 'ImageFormat');
249+
$output_format = Format::getFormatFor($output_path, $config, 'ImageFormat');
226250
$output_format->setVideoFrameRate(5);
227251

228-
$video = new \PHPVideoToolkit\Video('media/BigBuckBunny_320x180.mp4', $config);
229-
$output = $video->extractSegment(new \PHPVideoToolkit\Timecode(10), new \PHPVideoToolkit\Timecode(20))
252+
$video = new Video('media/BigBuckBunny_320x180.mp4', $config);
253+
$output = $video->extractSegment(new Timecode(10), new Timecode(20))
230254
->save($output_path, $output_format);
231255

232256
```
@@ -240,11 +264,11 @@ $config->gif_transcoder = 'gifsicle';
240264

241265
$output_path = './output/big_buck_bunny.gif';
242266

243-
$output_format = \PHPVideoToolkit\Format::getFormatFor($output_path, $config, 'ImageFormat');
267+
$output_format = Format::getFormatFor($output_path, $config, 'ImageFormat');
244268
$output_format->setVideoFrameRate(5);
245269

246-
$video = new \PHPVideoToolkit\Video('media/BigBuckBunny_320x180.mp4', $config);
247-
$output = $video->extractSegment(new \PHPVideoToolkit\Timecode(10), new \PHPVideoToolkit\Timecode(20))
270+
$video = new Video('media/BigBuckBunny_320x180.mp4', $config);
271+
$output = $video->extractSegment(new Timecode(10), new Timecode(20))
248272
->save($output_path, $output_format);
249273

250274
```
@@ -312,7 +336,7 @@ $output_format = new VideoFormat('output', $config);
312336
$output_format->setAudioCodec('acc')
313337
->setVideoCodec('ogg');
314338

315-
$video = new \PHPVideoToolkit\Video('media/BigBuckBunny_320x180.mp4', $config);
339+
$video = new Video('media/BigBuckBunny_320x180.mp4', $config);
316340
$output = $video->save($output_path, $output_format);
317341
```
318342

@@ -325,7 +349,7 @@ $output_path = './output/big_buck_bunny.mp3';
325349
$output_format = new AudioFormat('output', $config);
326350
$output_format->setAudioCodec('acc');
327351

328-
$video = new \PHPVideoToolkit\Video('media/BigBuckBunny_320x180.mp4', $config);
352+
$video = new Video('media/BigBuckBunny_320x180.mp4', $config);
329353
$output = $video->save($output_path, $output_format);
330354

331355
```
@@ -464,7 +488,7 @@ exit;
464488

465489
```
466490

467-
**IMPORTANT**: When encoding MP4s and having enabled qt-faststart usage either through setting ```\PHPVideoToolKit\Config->force_enable_qtfaststart = true;``` or ```\PHPVideoToolkit\VideoFormat_Mp4::enableQtFastStart()``` saves are put into blocking mode as processing with qt-faststart requires further exec calls. Similarly any encoding post processes such as when encoding FLVs will also convert a non blocking save into a blocking one.
491+
**IMPORTANT**: When encoding MP4s and having enabled qt-faststart usage either through setting ```\PHPVideoToolkit\Config->force_enable_qtfaststart = true;``` or ```\PHPVideoToolkit\VideoFormat_Mp4::enableQtFastStart()``` saves are put into blocking mode as processing with qt-faststart requires further exec calls. Similarly any encoding post processes such as when encoding FLVs will also convert a non blocking save into a blocking one.
468492

469493
###Accessing Executed Commands and the Command Line Buffer
470494

src/PHPVideoToolkit/AudioFormat.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ public function enableAudio()
132132
* @access public
133133
* @author Oliver Lillie
134134
* @param string $audio_codec
135-
* @return void
135+
* @return $this
136+
* @throws Exception
136137
*/
137138
public function setAudioCodec($audio_codec)
138139
{
@@ -183,7 +184,8 @@ public function setAudioCodec($audio_codec)
183184
* @access public
184185
* @author Oliver Lillie
185186
* @param string $bitrate
186-
* @return void
187+
* @return $this
188+
* @throws Exception
187189
*/
188190
public function setAudioBitrate($bitrate)
189191
{
@@ -257,7 +259,8 @@ public function setAudioSampleFrequency($audio_sample_frequency)
257259
* @access public
258260
* @author Oliver Lillie
259261
* @param string $channels
260-
* @return void
262+
* @return $this
263+
* @throws Exception
261264
*/
262265
public function setAudioChannels($channels)
263266
{
@@ -267,7 +270,7 @@ public function setAudioChannels($channels)
267270
return $this;
268271
}
269272

270-
if(in_array($channels, array(0, 1, 2, 6)) === false)
273+
if(in_array($channels, array(0, 1, 2, 6)) !== false)
271274
{
272275
$this->_format['audio_channels'] = $channels;
273276
return $this;

0 commit comments

Comments
 (0)