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
This package provides integration with **[PHP-FFmpeg](https://github.com/PHP-FFMpeg/PHP-FFMpeg)** and packages well-known online streaming techniques such as DASH and HLS. You can also use DRM for HLS packaging.
12
-
-Before you get started, please read the FFMpeg Document found **[here](https://ffmpeg.org/ffmpeg-formats.html)**.
10
+
This package provides integration with **[PHP-FFmpeg](https://github.com/PHP-FFMpeg/PHP-FFMpeg)** and packages media content for online streaming such as DASH and HLS. You can also use DRM for HLS packaging. There are options to open a file from clouds and also save files to clouds.
11
+
-This package uses FFMpeg, so before you get started, take the time to read the **[FFMpeg documentation](https://ffmpeg.org/ffmpeg-formats.html)**.
13
12
-**[Full Documentation](https://video.aminyazdanpanah.com/)** is available describing all features and components.
14
-
- For DRM and encryption(DASH and HLS), I **strongly recommend** to try **[Shaka PHP](https://github.com/aminyazdanpanah/shaka-php)**, which is a great tool for this use case.
13
+
- For DRM and encryption, I **recommend** to try **[Shaka PHP](https://github.com/aminyazdanpanah/shaka-php)**, which is a great tool for this use case.
15
14
16
15
**Contents**
17
16
-[Requirements](#requirements)
@@ -24,7 +23,9 @@ This package provides integration with **[PHP-FFmpeg](https://github.com/PHP-FFM
-[Several Open Source Players](#several-open-source-players)
29
30
-[Contributing and Reporting Bug](#contributing-and-reporting-bugs)
30
31
-[Credits](#credits)
@@ -52,7 +53,7 @@ First of all, you need to include the package in Your Code:
52
53
```php
53
54
require 'vendor/autoload.php'; // path to the autoload file
54
55
```
55
-
**Note:** 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.
56
+
**Note:** If you are using such a framework(e.g. **[Laravel](https://github.com/laravel/laravel)**) that auto include the autoload in your code, then you can skip this step.
56
57
57
58
### Configuration
58
59
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.
Amazon S3 or Amazon Simple Storage Service is a service offered by **[Amazon Web Services (AWS)](https://aws.amazon.com/)** that provides object storage through a web service interface. [Learn more](https://en.wikipedia.org/wiki/Amazon_S3)
126
127
- For getting credentials, you need to have an AWS account or you can **[create one](https://portal.aws.amazon.com/billing/signup#/start)**.
127
-
- Before you get started, please read the AWS SDK for PHP Document found **[here](https://aws.amazon.com/sdk-for-php/)**.
128
128
129
129
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:
A path can also be passed to save the file on your local computer/server.
145
-
144
+
A path can also be passed to save the file on your local machine.
146
145
147
146
#### 4. From Google Cloud Storage
148
-
[Google Cloud Storage](https://console.cloud.google.com/storage) is a RESTful online file storage web service for storing and accessing data on Google Cloud Platform infrastructure. The service combines the performance and scalability of Google's cloud with advanced security and sharing capabilities. It is an Infrastructure as a Service (IaaS), comparable to Amazon S3 online storage service. Contrary to Google Drive and according to different service specifications, Google Cloud Storage appears to be more suitable for enterprises. [Learn more](https://en.wikipedia.org/wiki/Google_Storage)
149
-
- For creating credentials, read the Cloud Storage Authentication found **[here](https://cloud.google.com/storage/docs/authentication)** or you can [create it](https://console.cloud.google.com/apis/credentials) directly.
147
+
**[Google Cloud Storage](https://console.cloud.google.com/storage)** is a RESTful online file storage web service for storing and accessing data on Google Cloud Platform infrastructure. The service combines the performance and scalability of Google's cloud with advanced security and sharing capabilities. It is an Infrastructure as a Service (IaaS), comparable to Amazon S3 online storage service. Contrary to Google Drive and according to different service specifications, Google Cloud Storage appears to be more suitable for enterprises. [Learn more](https://en.wikipedia.org/wiki/Google_Storage)
148
+
- For creating credentials, read the Cloud Storage Authentication found **[here](https://cloud.google.com/storage/docs/authentication)** or you can **[create it](https://console.cloud.google.com/apis/credentials)** directly (Select the "Service account key" option).
150
149
151
150
For downloading a file from Google Cloud Storage, you need to pass an associative array of config, the name of your bucket, and the name of your file in the bucket to the `fromGCS` method:
152
151
```php
153
152
$config = [
154
-
'keyFilePath' => '/path/to/credentials.json'
153
+
'keyFilePath' => '/path/to/credentials.json' // Alternativaely, you can authenticate by setting the environment variable. See https://cloud.google.com/docs/authentication/production#auth-cloud-implicit-php
A path can also be passed to save the file on your local computer/server.
160
+
A path can also be passed to save the file on your local machine.
162
161
163
162
### DASH
164
163
**[Dynamic Adaptive Streaming over HTTP (DASH)](https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP)**, also known as MPEG-DASH, is an adaptive bitrate streaming technique that enables high quality streaming of media content over the Internet delivered from conventional HTTP web servers.
**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).
385
+
**NOTE:** You can mix opening and saving options together. For instance, you can open a file on your local machine and save packaged files to a Cloud (or vice versa).
387
386
388
387

389
388
@@ -395,7 +394,7 @@ $metadata = $hls->save();
395
394
echo $metadata['filename']; // path to metadata.json
396
395
var_dump($metadata['metadata']); // dump all metadata
397
396
```
398
-
**NOTE:** You can save these metadata in your database.
397
+
**NOTE:** You can save these metadata to your database.
399
398
400
399
### Other Advanced Features
401
400
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.
Packaging process will may take a while and it is recommended to run it in the background(or in a cloud e.g. Google Cloud). There are some libraries that you can use.
415
+
-**[Symphony(The Console Component)](https://github.com/symfony/console):** You can use this library to create command-line commands. Your console commands can be used for any recurring task, such as cronjobs, imports, or other batch jobs. [Learn more](https://symfony.com/doc/current/components/console.html#learn-more)
416
+
417
+
-**[Laravel(Queues)](https://symfony.com/doc/current/components/console.html):** If you are using laravel for development, Laravel Queues is a wonderful tool for this use case. It allows you to create a job and dispatch it. [Learn more](https://laravel.com/docs/6.0/queues)
418
+
419
+
-**[Google Cloud Tasks](https://github.com/googleapis/google-cloud-php-tasks):** Google Cloud Tasks is a fully managed service that allows you to manage the execution, dispatch and delivery of a large number of distributed tasks. You can asynchronously perform work outside of a user request. [Learn more](https://cloud.google.com/tasks/)
420
+
421
+
**NOTE:** It is not necessary to use this library. It is just a suggestion. You can also create a script to create packaged video files and run it in a cron-job.
422
+
414
423
## Several Open Source Players
415
424
You can use these libraries to play your streams.
416
425
-**WEB**
@@ -433,9 +442,11 @@ You can use these libraries to play your streams.
433
442
I'd love your help in improving, correcting, adding to the specification.
434
443
Please **[file an issue](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/issues)** or **[submit a pull request](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/pulls)**.
435
444
- Please see **[Contributing File](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/blob/master/CONTRIBUTING.md)** for more information.
436
-
-Please, just **[file an issue](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/issues)** for reporting bugs or if you have any question.
445
+
-If you have any questions or you want to report a bug, please just **[file an issue](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/issues)**
437
446
- If you discover a security vulnerability within this package, please see **[SECURITY File](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/blob/master/SECURITY.md)** for more information to help with that.
438
447
448
+
**NOTE:** If you have any questions about this package or FFMpeg, please **DO NOT** send an email to me or submit the contact form in my website. Emails related to these issues **will be ignored**.
0 commit comments