-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from hadronepoch/shalmor-patch-1
Update README.md
- Loading branch information
Showing
1 changed file
with
31 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
# 📼 PHP FFmpeg Video Streaming | ||
[![Build Status](https://travis-ci.org/aminyazdanpanah/PHP-FFmpeg-video-streaming.svg?branch=master)](https://travis-ci.org/aminyazdanpanah/PHP-FFmpeg-video-streaming) | ||
[![Build status](https://img.shields.io/appveyor/ci/aminyazdanpanah/PHP-FFmpeg-video-streaming/master.svg?style=flat&logo=appveyor)](https://ci.appveyor.com/project/aminyazdanpanah/php-ffmpeg-video-streaming) | ||
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/aminyazdanpanah/PHP-FFmpeg-video-streaming/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/aminyazdanpanah/PHP-FFmpeg-video-streaming/?branch=master) | ||
[![Total Downloads](https://img.shields.io/packagist/dt/aminyazdanpanah/php-ffmpeg-video-streaming.svg?style=flat)](https://packagist.org/packages/aminyazdanpanah/php-ffmpeg-video-streaming) | ||
[![Latest Version on Packagist](https://img.shields.io/packagist/v/aminyazdanpanah/php-ffmpeg-video-streaming?color=success)](https://packagist.org/packages/aminyazdanpanah/php-ffmpeg-video-streaming) | ||
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/blob/master/LICENSE) | ||
|
||
|
||
## Overview | ||
This library is a wrapper around **[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](https://en.wikipedia.org/wiki/Digital_rights_management)** for HLS packaging. There are several options to open a file from a cloud and save files to clouds as well. | ||
- **[Full Documentation](https://video.aminyazdanpanah.com/)** is available describing all features and components. | ||
- For using encryption and DRM, I **recommend** trying **[Shaka PHP](https://github.com/aminyazdanpanah/shaka-php)**, which is a great tool for this use case. | ||
- **[Full Documentation](https://www.hadronepoch.org/op/php/ffmpeg-streaming/)** is available describing all features and components. | ||
- **Your support is crucial to our ongoing work on open-source projects**. We kindly request that you consider exploring the **[available options](#support-us)** to assist us in this endeavor. Your encouragement and assistance will help us continue to deliver high-quality results in this important area. Thank you for your consideration and support. | ||
|
||
**Contents** | ||
- [Requirements](#requirements) | ||
|
@@ -29,6 +25,7 @@ This library is a wrapper around **[PHP-FFMpeg](https://github.com/PHP-FFMpeg/PH | |
- [Asynchronous Task Execution](#asynchronous-task-execution) | ||
- [Several Open Source Players](#several-open-source-players) | ||
- [FAQs](#faqs) | ||
- [Support Us](#support-us) | ||
- [Contributing and Reporting Bugs](#contributing-and-reporting-bugs) | ||
- [Credits](#credits) | ||
- [License](#license) | ||
|
@@ -89,7 +86,7 @@ See **[FFmpeg Protocols Documentation](https://ffmpeg.org/ffmpeg-protocols.html) | |
|
||
**For example:** | ||
```php | ||
$video = $ffmpeg->open('https://www.aminyazdanpanah.com/?"PATH TO A VIDEO FILE" or "PATH TO A LIVE HTTP STREAM"'); | ||
$video = $ffmpeg->open('https://www.hadronepoch.org/?"PATH TO A VIDEO FILE" or "PATH TO A LIVE HTTP STREAM"'); | ||
``` | ||
|
||
#### 2. From Clouds | ||
|
@@ -98,7 +95,7 @@ You can open a file from a cloud by passing an array of cloud configuration to t | |
```php | ||
$video = $ffmpeg->openFromCloud($from_google_cloud); | ||
``` | ||
Visit **[this page](https://video.aminyazdanpanah.com/start/clouds?r=open)** to see some examples of opening a file from **[Amazon S3](https://aws.amazon.com/s3)**, **[Google Cloud Storage](https://console.cloud.google.com/storage)**, **[Microsoft Azure Storage](https://azure.microsoft.com/en-us/features/storage-explorer/)**, and a custom cloud. | ||
Visit **[this page](https://www.hadronepoch.org/op/php/ffmpeg-streaming/start/clouds?r=open)** to see some examples of opening a file from **[Amazon S3](https://aws.amazon.com/s3)**, **[Google Cloud Storage](https://console.cloud.google.com/storage)**, **[Microsoft Azure Storage](https://azure.microsoft.com/en-us/features/storage-explorer/)**, and a custom cloud. | ||
|
||
#### 3. Capture Webcam or Screen (Live Streaming) | ||
You can pass the name of a supported, connected capture device(i.e. the name of a webcam, camera, screen and etc) to the `capture` method to stream a live media over network. | ||
|
@@ -137,7 +134,7 @@ $video->dash() | |
->addRepresentations([$r_144p, $r_240p, $r_360p, $r_480p, $r_720p, $r_1080p, $r_2k, $r_4k]) | ||
->save('/var/media/dash-stream.mpd'); | ||
``` | ||
See **[DASH section](https://video.aminyazdanpanah.com/start?r=dash#dash)** in the documentation, for more examples. | ||
See **[DASH section](https://www.hadronepoch.org/op/php/ffmpeg-streaming/start?r=dash#dash)** in the documentation, for more examples. | ||
|
||
### HLS | ||
**[HTTP Live Streaming (also known as HLS)](https://developer.apple.com/streaming/)** is an HTTP-based adaptive bitrate streaming communications protocol implemented by Apple Inc. as part of its QuickTime, Safari, OS X, and iOS software. Client implementations are also available in Microsoft Edge, Firefox, and some versions of Google Chrome. Support is widespread in streaming media servers. [Learn more](https://en.wikipedia.org/wiki/HTTP_Live_Streaming) | ||
|
@@ -162,7 +159,7 @@ $video->hls() | |
->addRepresentations([$r_360p, $r_480p, $r_720p]) | ||
->save(); | ||
``` | ||
See **[HLS section](https://video.aminyazdanpanah.com/start?r=hls#hls)** in the documentation, for more examples such as Fragmented MP4, live from camera/screen and so on. | ||
See **[HLS section](https://www.hadronepoch.org/op/php/ffmpeg-streaming/start?r=hls#hls)** in the documentation, for more examples such as Fragmented MP4, live from camera/screen and so on. | ||
|
||
#### Encryption(DRM) | ||
The encryption process requires some kind of secret (key) together with an encryption algorithm. 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) | ||
|
@@ -177,7 +174,7 @@ The following code generates a key for all segment files. | |
$save_to = '/home/public_html/"PATH TO THE KEY DIRECTORY"/key'; | ||
|
||
//An URL (or a path) to access the key on your website | ||
$url = 'https://www.aminyazdanpanah.com/?"PATH TO THE KEY DIRECTORY"/key'; | ||
$url = 'https://www.hadronepoch.org/?"PATH TO THE KEY DIRECTORY"/key'; | ||
// or $url = '/"PATH TO THE KEY DIRECTORY"/key'; | ||
|
||
$video->hls() | ||
|
@@ -190,7 +187,7 @@ $video->hls() | |
##### Key Rotation | ||
An integer as a "key rotation period" can also be passed to the `encryption` method (i.e. `encryption($save_to, $url, 10)`) to use a different key for each set of segments, rotating to a new key after this many segments. For example, if 10 segment files have been generated then it will generate a new key. If you set this value to **`1`**, each segment file will be encrypted with a new encryption key. This can improve security and allows for more flexibility. | ||
|
||
See **[the example](https://video.aminyazdanpanah.com/start?r=enc-hls#hls-encryption)** for more information. | ||
See **[the example](https://www.hadronepoch.org/op/php/ffmpeg-streaming/start?r=enc-hls#hls-encryption)** for more information. | ||
|
||
**IMPORTANT:** It is very important to protect your key(s) on your website. For example, you can use a token(using a Get or Post HTTP method) to check if the user is eligible to access the key or not. You can also use a session(or cookie) on your website to restrict access to the key(s)(**It is highly recommended**). | ||
|
||
|
@@ -271,7 +268,7 @@ A path can also be passed to save a copy of files to your local machine. | |
$hls->save('/var/media/hls-stream.m3u8', [$to_google_cloud, $to_custom_cloud]); | ||
``` | ||
|
||
Visit **[this page](https://video.aminyazdanpanah.com/start/clouds?r=save)** to see some examples of saving files to **[Amazon S3](https://aws.amazon.com/s3)**, **[Google Cloud Storage](https://console.cloud.google.com/storage)**, **[Microsoft Azure Storage](https://azure.microsoft.com/en-us/features/storage-explorer/)**, and a custom cloud. | ||
Visit **[this page](https://www.hadronepoch.org/op/php/ffmpeg-streaming/start/clouds?r=save)** to see some examples of saving files to **[Amazon S3](https://aws.amazon.com/s3)**, **[Google Cloud Storage](https://console.cloud.google.com/storage)**, **[Microsoft Azure Storage](https://azure.microsoft.com/en-us/features/storage-explorer/)**, and a custom cloud. | ||
|
||
**NOTE:** This option(Save To Clouds) is only valid for **[VOD](https://en.wikipedia.org/wiki/Video_on_demand)** (it does not support live streaming). | ||
|
||
|
@@ -304,14 +301,14 @@ $metadata = $hls->metadata()->export(); | |
print_r($metadata); | ||
``` | ||
|
||
See **[the example](https://video.aminyazdanpanah.com/start?r=metadata#metadata)** for more information. | ||
See **[the example](https://www.hadronepoch.org/op/php/ffmpeg-streaming/start?r=metadata#metadata)** for more information. | ||
|
||
### Conversion | ||
You can convert your stream to a file or to another stream protocols. You should pass a manifest of the stream to the `open` method: | ||
|
||
#### 1. HLS To DASH | ||
```php | ||
$stream = $ffmpeg->open('https://www.aminyazdanpanah.com/?PATH/TO/HLS-MANIFEST.M3U8'); | ||
$stream = $ffmpeg->open('https://www.hadronepoch.org/?PATH/TO/HLS-MANIFEST.M3U8'); | ||
|
||
$stream->dash() | ||
->x264() | ||
|
@@ -321,7 +318,7 @@ $stream->dash() | |
|
||
#### 2. DASH To HLS | ||
```php | ||
$stream = $ffmpeg->open('https://www.aminyazdanpanah.com/?PATH/TO/DASH-MANIFEST.MPD'); | ||
$stream = $ffmpeg->open('https://www.hadronepoch.org/?PATH/TO/DASH-MANIFEST.MPD'); | ||
|
||
$stream->hls() | ||
->x264() | ||
|
@@ -414,7 +411,7 @@ You can use these libraries to play your streams. | |
|
||
## FAQs | ||
**I created stream files and now what should I pass to a player?** | ||
You must pass a **master playlist(manifest) URL**(e.x. `https://www.aminyazdanpanah.com/?"PATH TO STREAM DIRECTORY"/dash-stream.mpd` or `/PATH_TO_STREAM_DIRECTORY/hls-stream.m3u8` ) to a player. | ||
You must pass a **master playlist(manifest) URL**(e.x. `https://www.hadronepoch.org/?"PATH TO STREAM DIRECTORY"/dash-stream.mpd` or `/PATH_TO_STREAM_DIRECTORY/hls-stream.m3u8` ) to a player. | ||
See the demo page of these players for more information(**[hls.js Demo](https://hls-js.netlify.app/demo/)**, **[dash.js Demo](https://reference.dashif.org/dash.js/v3.1.2/samples/dash-if-reference-player/index.html)**, **[videojs Demo](https://videojs.com/advanced?video=elephantsdream)** and etc). | ||
|
||
**My player does not show the quality selector button to change the video quality?** | ||
|
@@ -426,15 +423,29 @@ If you save your stream content to a cloud(i.e. **[Amazon S3](https://aws.amazon | |
**Does [IOS](https://www.apple.com/ios) support the DASH stream?** | ||
No, IOS does not have native support for DASH. Although there are some libraries such as **[Viblast](https://github.com/Viblast/ios-player-sdk)** and **[MPEGDASH-iOS-Player](https://github.com/MPEGDASHPlayer/MPEGDASH-iOS-Player)** to support this technique, I have never tested them. So maybe some of them will not work properly. | ||
|
||
See [this page](https://video.aminyazdanpanah.com/start?r=faq#faq) for more FAQs. | ||
See [this page](https://www.hadronepoch.org/op/php/ffmpeg-streaming/start?r=faq#faq) for more FAQs. | ||
|
||
## Support Us | ||
We greatly appreciate your support in our efforts to contribute to open-source projects. If you're able to, we kindly ask that you take a moment to check out the available options for assisting us. Your help would enable us to maintain our commitment to producing exceptional results. Thank you for your support. | ||
|
||
### 1. purchasing a service or product | ||
Our company offers a range of products and services, including video streaming, video-on-demand, video conferencing, and an HR assistance application. If you wish to purchase any of these offerings, kindly direct your inquiries to our email address at **[email protected]**. We will be updating **[our website](https://www.hadronepoch.org)** with further details in the near future. | ||
|
||
### 2. sponsoring the project or org | ||
Thank you for considering the option of sponsoring our organization. Your generous donations will greatly assist us in our efforts to enhance and expand our existing libraries, as well as build new ones. There are several options available for sponsorship, including clicking on the **[provided link](https://github.com/sponsors/hadronepoch)** or utilizing alternative methods such as **[crypto](https://hadronepoch.org/support)**, **[Patreon](https://patreon.com/HadronEpoch)**, **[Open Collective](https://opencollective.com/hadronepoch)**, and **[ko-fi](https://ko-fi.com/hadronepoch)**. Your support is greatly appreciated and will help us to continue our mission of providing valuable resources to the community. | ||
|
||
### 3. Star and Share | ||
If you find this project to be of value, kindly consider **[starring it](stargazers)** and **sharing it** with those in your network who may benefit from this type of software. Your support would be greatly appreciated and would help to increase visibility and accessibility of this project. | ||
|
||
Thank you for your consideration. | ||
|
||
## Contributing and Reporting Bugs | ||
I'd love your help in improving, correcting, adding to the specification. 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)**. | ||
- See **[Contributing File](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/blob/master/CONTRIBUTING.md)** for more information. | ||
- 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. | ||
|
||
## Credits | ||
- **[Amin Yazdanpanah](https://www.aminyazdanpanah.com/?u=github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming)** | ||
- **[Amin Yazdanpanah](https://www.hadronepoch.org/?u=github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming)** | ||
- **[All Contributors](https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming/graphs/contributors)** | ||
|
||
## License | ||
|