Skip to content

Commit 7d63891

Browse files
bug fixes
1 parent dcf2c9b commit 7d63891

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 📼 PHP FFMPEG Video Streaming
1+
# 📼 PHP FFmpeg Video Streaming
22
[![Build Status](https://travis-ci.org/aminyazdanpanah/PHP-FFmpeg-video-streaming.svg?branch=master)](https://travis-ci.org/aminyazdanpanah/PHP-FFmpeg-video-streaming)
33
[![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)
44
[![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)
@@ -266,7 +266,7 @@ $hls
266266
->setMasterPlaylist('/var/www/stream/live-master-manifest.m3u8')
267267
->live('http://YOUR-WEBSITE.COM/live-stream/out.m3u8');
268268
```
269-
**NOTE:** In the HLS streaming method, you should pass the master playlist to your player. So you should upload the master manifest to your server as well as other files.
269+
**NOTE:** In the HLS method, you must upload the master manifest to the server manually. (Upload the `/var/www/stream/live-master-manifest.m3u8` file to the `http://YOUR-WEBSITE.COM`)
270270

271271
Please see **[FFmpeg Protocols Documentation](https://ffmpeg.org/ffmpeg-protocols.html)** for more information.
272272

@@ -280,7 +280,7 @@ $stream = $ffmpeg->open('https://www.aminyazdanpanah.com/PATH/TO/HLS-MANIFEST.M3
280280
$stream->DASH()
281281
->X264()
282282
->addRepresentations([$r_360p, $r_480p])
283-
->save();
283+
->save('/var/www/media/dash-stream.mpd');
284284
```
285285

286286
#### 2. DASH To HLS
@@ -290,11 +290,16 @@ $stream = $ffmpeg->open('https://www.aminyazdanpanah.com/PATH/TO/DASH-MANIFEST.M
290290
$stream->HLS()
291291
->X264()
292292
->autoGenerateRepresentations([720, 360])
293-
->save();
293+
->save('/var/www/media/hls-stream.mpd');
294294
```
295295

296296
#### 3. Stream(DASH or HLS) To File
297297
``` php
298+
$format = new Streaming\Format\X264();
299+
$format->on('progress', function ($video, $format, $percentage){
300+
echo sprintf("\rTranscoding...(%s%%) [%s%s]", $percentage, str_repeat('#', $percentage), str_repeat('-', (100 - $percentage)));
301+
});
302+
298303
$stream->stream2file()
299304
->setFormat($format)
300305
->save('/var/www/media/new-video.mp4');

src/HLS.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ protected function getPath(): string
199199
*/
200200
private function savePlaylist($path, $reps)
201201
{
202-
$manifests = pathinfo($path, $this->master_playlist ? PATHINFO_DIRNAME : PATHINFO_FILENAME);
203-
HLSPlaylist::save($this->master_playlist ?? $path, $reps, $manifests);
202+
HLSPlaylist::save($this->master_playlist ?? $path, $reps, pathinfo($path, PATHINFO_FILENAME));
204203
}
205204
}

0 commit comments

Comments
 (0)