You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://packagist.org/packages/aminyazdanpanah/php-ffmpeg-video-streaming)
[](https://packagist.org/packages/aminyazdanpanah/php-ffmpeg-video-streaming)
This package provides an integration with [PHP-FFmpeg](https://github.com/PHP-FFMpeg/PHP-FFMpeg) and packages well-known live streaming techniques such as DASH and HLS. Also you can use DRM for HLS packaging.
10
+
This package provides integration with [PHP-FFmpeg](https://github.com/PHP-FFMpeg/PHP-FFMpeg) and packages well-known live streaming techniques such as DASH and HLS. Also, you can use DRM for HLS packaging.
13
11
14
12
- Before you get started, please read the FFMpeg Document found **[here](https://ffmpeg.org/ffmpeg-formats.html)**.
15
13
-**[Full Documentation](https://video.aminyazdanpanah.com/)** is available describing all features and components.
@@ -45,33 +43,40 @@ This library requires a working FFMpeg. You will need both FFMpeg and FFProbe bi
**NOTE:** You must download MediaInfo CLI. If you want this package autodetect the MediaInfo binary, you need to add the path of CLI to your system path. Otherwise, You have to pass the full path of binary to `setMediaInfoBinary` method.
49
+
**NOTE:** You must download MediaInfo CLI. If you want this package autodetect the MediaInfo binary, you need to add the path of CLI to your system path. Otherwise, you have to pass the full path of binary to `setMediaInfoBinary` method.
52
50
53
51
#### 3. OpenSSL
54
52
For HLS encryption you will need a working OpenSSL:
You can find Full Documentation **[here](https://video.aminyazdanpanah.com/).**
68
+
First of all, you need to include the package in Your Code:
69
+
70
+
```php
71
+
require 'vendor/autoload.php'; // path to the autoload file
72
+
```
73
+
74
+
- If you are using such a framework(e.g. [Laravel](https://github.com/laravel/laravel)) that include the autoload automatically, then you can skip this step.
75
+
- You can find Full Documentation **[here](https://video.aminyazdanpanah.com/).**
71
76
72
77
### Configuration
73
78
74
-
FFMpeg will autodetect ffmpeg and ffprobe binaries. If you want to give binary paths explicitly, you can pass an array as configuration. A Psr\Logger\LoggerInterface can also be passed to log binary executions.
79
+
FFMpeg will autodetect FFmpeg and FFprobe binaries. If you want to give binary paths explicitly, you can pass an array as configuration. A Psr\Logger\LoggerInterface can also be passed to log binary executions.
Also, the path to save the file, the method of request, and [request options](http://docs.guzzlephp.org/en/stable/request-options.html) can be passed to the method.
110
+
Also, the path to save the file, the method of the request, and [request options](http://docs.guzzlephp.org/en/stable/request-options.html) can be passed to the method.
@@ -140,7 +145,7 @@ Amazon S3 or Amazon Simple Storage Service is a service offered by [Amazon Web S
140
145
- For getting credentials, you need to have an AWS account or you can [create one](https://portal.aws.amazon.com/billing/signup#/start).
141
146
- Before you get started, please read the "AWS SDK for PHP" Document found **[here](https://aws.amazon.com/sdk-for-php/)**.
142
147
143
-
For downloading a file from Amazon S3, you need to pass an array as configuration, name of the bucket, and the key of your bucket to `fromS3` method:
148
+
For downloading a file from Amazon S3, you need to pass an associative array of options, the name of your bucket, and the key of your bucket to the`fromS3` method:
144
149
145
150
```php
146
151
$config = [
@@ -174,7 +179,7 @@ $video->DASH()
174
179
->save(); // It can be passed a path to the method or it can be null
175
180
```
176
181
177
-
Also, You can create multi-representations video files using `Representation` object:
182
+
Also, You can create multi-representations video files using the `Representation` object:
178
183
179
184
```php
180
185
use Streaming\Representation;
@@ -207,7 +212,7 @@ $video->HLS()
207
212
->save();
208
213
```
209
214
210
-
Create multi-qualities video files using `Representation` object(set bit-rate and size manually):
215
+
Create multi-qualities video files using the `Representation` object(set bit-rate and size manually):
211
216
212
217
```php
213
218
use Streaming\Representation;
@@ -235,7 +240,7 @@ See [HLS options](https://ffmpeg.org/ffmpeg-formats.html#hls-2) for more informa
235
240
236
241
The encryption process requires some kind of secret (key) together with an encryption algorithm.
237
242
238
-
HLS uses AES in cipher block chaining (CBC) mode. This means each block is encrypted using the cipher text of the preceding block. [Learn more](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation)
243
+
HLS uses AES in cipher block chaining (CBC) mode. This means each block is encrypted using the ciphertext of the preceding block. [Learn more](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation)
239
244
240
245
Before we can encrypt videos, we need an encryption key. However you can use any software that can generate a key, this package requires a working OpenSSL to create a key:
241
246
@@ -264,9 +269,9 @@ $video->HLS()
264
269
265
270
### Transcoding
266
271
267
-
You can transcode videos using the `on` method in the format class.
268
-
269
-
Transcoding progress can be monitored in realtime, see Format documentation in [FFMpeg documentation](https://github.com/PHP-FFMpeg/PHP-FFMpeg#documentation) for more information.
272
+
A format can also extend FFMpeg\Format\ProgressableInterface to get realtime information about the transcoding.
273
+
274
+
Transcoding progress can be monitored in realtime, see Format documentation in [FFMpeg documentation](https://github.com/PHP-FFMpeg/PHP-FFMpeg#documentation) for more information.
270
275
271
276
```php
272
277
$format = new Streaming\Format\HEVC();
@@ -303,7 +308,7 @@ $video->HLS()
303
308
There are three options to save your packaged video files:
304
309
305
310
#### 1. To a Local Path
306
-
You can pass a local path to the `save` method. If there was no directory in the path, then the package auto make the directory.
311
+
You can pass a local path to the `save` method. If there was no directory in the path, then the package auto makes the directory.
For more information, please read [AWS SDK for PHP](https://aws.amazon.com/sdk-for-php/) document.
394
399
395
-
-**NOTE:** You can mix opening and saving options together. For Instance, you can open a file on your local computer/server and save packaged files to a Cloud (or vice versa).
400
+
-**NOTE:** You can mix opening and saving options together. For instance, you can open a file on your local computer/server and save packaged files to a Cloud (or vice versa).
396
401
397
402

398
403
399
404
### Video Analysis
400
-
This library uses [MediaInfo](https://mediaarea.net/en/MediaInfo) to analyze videos and extracting metadata. Why MediaInfo?! Although FFprobe can go way more indepth and is much more powerful, in some cases MediaInfo is much more reliable and more powerful. For instance, as it can be seen in this issue(#12), MKV format does not store some parameters such as duration, frame rate, and bit rate in its container. So FFprobe cannot obtain the value of these parameter and as a result, this package cannot calculate the value of `kilo bite rate` to autogenerate representations. However, MediaInfo cannot obtain these value as well, it has a general info that contains the value of `OveralBitRate`. In spite of `OveralBitRate` is not equal to the video bite rate, it can estimate the value of video's bite rate.
405
+
This library uses [MediaInfo](https://mediaarea.net/en/MediaInfo) to analyze videos and extracting metadata. Why MediaInfo?! Although FFprobe can go way more in-depth and is much more powerful, in some cases MediaInfo is much more reliable and more powerful. For instance, as it can be seen in this issue([#12](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/issues/12)), MKV format does not store some parameters such as duration, frame rate, and bit rate in its container. So FFprobe cannot obtain the value of these parameters and as a result, this package cannot calculate the value of `kilo bite rate` to auto-generate representations. However, MediaInfo cannot obtain these value as well, it has general info that contains the value of `OveralBitRate`. In spite of `OveralBitRate` is not equal to the video bite rate, it can estimate the value of the video's bite rate.
401
406
402
407
- Please download and install the latest version of [MediaInfo](https://mediaarea.net/en/MediaInfo).
403
408
404
-
You can extract the media info and analyze streams when packaging is done. It also puts a `analysis.json` file in the packaged video directory:
409
+
You can extract the media info and analyze streams when packaging was done. It also puts a `analysis.json` file in the packaged video directory:
You can easily use other advanced features in the [PHP-FFMpeg](https://github.com/PHP-FFMpeg/PHP-FFMpeg) library. In fact, when you open a file with `open` method(or `fromURL`), it holds the Media object that belongs to the PHP-FFMpeg.
436
+
You can easily use other advanced features in the [PHP-FFMpeg](https://github.com/PHP-FFMpeg/PHP-FFMpeg) library. In fact, when you open a file with the `open` method(or `fromURL`), it holds the Media object that belongs to the PHP-FFMpeg.
432
437
433
438
For exploring other advanced features, please read the [Full PHP-FFMpeg Documentation](https://github.com/PHP-FFMpeg/PHP-FFMpeg#documentation).
434
439
@@ -451,7 +456,8 @@ $video
451
456
```
452
457
453
458
## Several Open Source Players
454
-
You can use these players to play your packaged videos
459
+
You can use these players to play your packaged videos.
460
+
455
461
-**WEB**
456
462
- DASH and HLS: [Plyr](https://github.com/sampotts/plyr)
457
463
- DASH and HLS: [MediaElement.js](https://github.com/mediaelement/mediaelement)
@@ -465,15 +471,15 @@ You can use these players to play your packaged videos
465
471
-**Android**
466
472
- DASH and HLS: [ExoPlayer](https://github.com/google/ExoPlayer)
467
473
468
-
## Contributing and Reporting bug
474
+
## Contributing and Reporting Bugs
469
475
470
476
I'd love your help in improving, correcting, adding to the specification.
471
477
Please [file an issue](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/issues)
472
478
or [submit a pull request](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/pulls).
473
479
474
480
- Please see [Contributing File](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/blob/master/CONTRIBUTING.md) for more information.
475
481
476
-
- Please just [file an issue](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/issues) for reporting bugs.
482
+
- Please, just [file an issue](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/issues) for reporting bugs.
477
483
- If you discover a security vulnerability within this package, please send an e-mail to Amin Yazdanpanah via:
0 commit comments