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)
10
10
11
+
## Overview
11
12
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.
- Before you get started, please read the FFMpeg Document found **[here](https://ffmpeg.org/ffmpeg-formats.html)**.
15
+
-**[Full API Documentation](https://video.aminyazdanpanah.com/)** is available describing all features and components.
16
+
- 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.
-[Several Open Source Players](#several-open-source-players)
38
+
-[Contributing](#contributing)
39
+
-[Security](#security)
40
+
-[Reporting Bugs](#reporting-bugs)
41
+
-[Credits](#credits)
42
+
-[License](#license)
14
43
15
-
-****NOTE:**** 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.
16
44
45
+
## Installation
17
46
18
-
## Required Libraries
47
+
###Required Libraries
19
48
20
49
This library requires a working FFMpeg. You will need both FFMpeg and FFProbe binaries to use it.
You can find Full Documentation **[here](https://video.aminyazdanpanah.com/).**
74
68
75
69
### Configuration
76
70
@@ -87,7 +81,6 @@ $config = [
87
81
$ffmpeg = Streaming\FFMpeg::create($config);
88
82
```
89
83
90
-
91
84
### Opening a File
92
85
93
86
There are two ways to open a file:
@@ -111,10 +104,9 @@ Also, the path to save the file, the method of request, and [request options](ht
111
104
### DASH
112
105
**[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.
113
106
114
-
Similar to Apple's HTTP Live Streaming (HLS) solution, MPEG-DASH works by breaking the content into a sequence of small HTTP-based file segments, each segment containing a short interval of playback time of content that is potentially many hours in duration, such as a movie or the live broadcast of a sports event. The content is made available at a variety of different bit rates, i.e., alternative segments encoded at different bit rates covering aligned short intervals of playback time. While the content is being played back by an MPEG-DASH client, the client uses a bit rate adaptation (ABR) algorithm to automatically select the segment with the highest bit rate possible that can be downloaded in time for playback without causing stalls or re-buffering events in the playback. The current MPEG-DASH reference client dash.js offers both buffer-based (BOLA) and hybrid (DYNAMIC) bit rate adaptation algorithms. Thus, an MPEG-DASH client can seamlessly adapt to changing network conditions and provide high quality playback with fewer stalls or re-buffering events.
107
+
Similar to Apple's HTTP Live Streaming (HLS) solution, MPEG-DASH works by breaking the content into a sequence of small HTTP-based file segments, each segment containing a short interval of playback time of content that is potentially many hours in duration, such as a movie or the live broadcast of a sports event. The content is made available at a variety of different bit rates, i.e., alternative segments encoded at different bit rates covering aligned short intervals of playback time. While the content is being played back by an MPEG-DASH client, the client uses a bit rate adaptation (ABR) algorithm to automatically select the segment with the highest bit rate possible that can be downloaded in time for playback without causing stalls or re-buffering events in the playback. The current MPEG-DASH reference client dash.js offers both buffer-based (BOLA) and hybrid (DYNAMIC) bit rate adaptation algorithms. Thus, an MPEG-DASH client can seamlessly adapt to changing network conditions and provide high quality playback with fewer stalls or re-buffering events. [Learn more](https://en.wikipedia.org/wiki/Dynamic_Adaptive_Streaming_over_HTTP)
->HEVC() // Format of the video. For Using another format, see Traits\Formats
@@ -123,9 +115,7 @@ $video->DASH()
123
115
->save(); // It can be passed a path to the method or it can be null
124
116
```
125
117
126
-
127
-
#### Create Representations Manually
128
-
Create multi-representations video files using `Representation` object:
118
+
Also, You can create multi-representations video files using `Representation` object:
129
119
130
120
```php
131
121
$rep_1 = (new Representation())->setKiloBitrate(800)->setResize(1080 , 720);
@@ -141,7 +131,7 @@ $video->DASH()
141
131
```
142
132
143
133
144
-
#### Transcoding
134
+
#### Transcoding(DASH)
145
135
146
136
You can transcode videos using the `on` method in the format class.
147
137
@@ -170,18 +160,18 @@ For more information about **[FFMpeg](https://ffmpeg.org/)** and its **[dash opt
170
160
171
161
**[HTTP Live Streaming (also known as HLS)](https://en.wikipedia.org/wiki/HTTP_Live_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.
172
162
173
-
HLS resembles MPEG-DASH in that it works by breaking the overall stream into a sequence of small HTTP-based file downloads, each download loading one short chunk of an overall potentially unbounded transport stream. A list of available streams, encoded at different bit rates, is sent to the client using an extended M3U playlist.
HLS resembles MPEG-DASH in that it works by breaking the overall stream into a sequence of small HTTP-based file downloads, each download loading one short chunk of an overall potentially unbounded transport stream. A list of available streams, encoded at different bit rates, is sent to the client using an extended M3U playlist. [Learn more](https://en.wikipedia.org/wiki/HTTP_Live_Streaming)
176
164
165
+
#### Create HLS Files
166
+
Create HLS files based on original video(auto generate qualities).
177
167
```php
178
168
$video->HLS()
179
169
->X264()
180
170
->autoGenerateRepresentations() // Auto generate representations
181
171
->save(); // It can be passed a path to the method or it can be null
182
172
```
183
173
184
-
Create multi-qualities video files using `Representation` object:
174
+
Create multi-qualities video files using `Representation` object(set bit-rate and size manually):
185
175
186
176
```php
187
177
$rep_1 = (new Representation())->setKiloBitrate(1000)->setResize(1080 , 720);
@@ -199,7 +189,7 @@ $video->HLS()
199
189
```
200
190
See [HLS options](https://ffmpeg.org/ffmpeg-formats.html#hls-2) for more information.
-**Note:** Alternatively, you can generate a key info using another library and pass the path of key info to the `setHlsKeyInfoFile` method.
234
+
-**NOTE:** It is very important to protect your key on your website using a token or a session/cookie(****It is highly recommended****).
248
235
-**NOTE:** For getting the benefit of the OpenSSL binary detection in windows, you need to add it to your system path otherwise, you have to pass the path to OpenSSL binary to the `generateRandomKeyInfo` method explicitly.
249
236
250
237
### Other Advanced Features
251
-
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, it holds the Media object that belongs to the PHP-FFMpeg.
238
+
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.
0 commit comments