Skip to content

Commit 40d80b4

Browse files
update readme
1 parent ff0990e commit 40d80b4

1 file changed

Lines changed: 35 additions & 6 deletions

File tree

README.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This package uses the **[FFmpeg](https://ffmpeg.org)** to package media content
3333
## Requirements
3434
1. This version of the package is only compatible with **[Python 3.6](https://www.python.org/downloads/)** or higher.
3535

36-
2. To use this package, you need to **[install the FFMpeg](https://ffmpeg.org/download.html)**. You will need both FFMpeg and FFProbe binaries to use it.
36+
2. To use this package, you need to **[install the FFmpeg](https://ffmpeg.org/download.html)**. You will need both FFMpeg and FFProbe binaries to use it.
3737

3838
## Installation
3939
The latest version of `ffmpeg-streaming` can be acquired via pip:
@@ -47,7 +47,7 @@ pip install python-ffmpeg-video-streaming
4747
There are two ways to open a file:
4848

4949
#### 1. From a FFmpeg supported resources
50-
You can pass a local path of video(or a supported resource) to the `open` method:
50+
You can pass a local path of video(or a supported resource) to the method(`hls` or `dash`):
5151
```python
5252
video = '/var/www/media/videos/video.mp4'
5353
```
@@ -60,7 +60,7 @@ video = 'https://www.aminyazdanpanah.com/PATH/TO/VIDEO.MP4'
6060
```
6161

6262
#### 2. From Clouds
63-
You can open a file from a cloud by passing an array of cloud configuration to the `openFromCloud` method.
63+
You can open a file from a cloud by passing a tuple of cloud configuration to the method.
6464

6565
In **[this page](https://video.aminyazdanpanah.com/python/start/clouds?r=open)**, you will find 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.
6666
```python
@@ -195,6 +195,35 @@ def progress(percentage, ffmpeg):
195195
##### Output From a Terminal:
196196
![transcoding](https://github.com/aminyazdanpanah/aminyazdanpanah.github.io/blob/master/video-streaming/transcoding.gif?raw=true "transcoding" )
197197

198+
##### Show a progress bar using **[tqdm](https://github.com/tqdm/tqdm)**
199+
You can get realtime information about transcoding by passing a callable method to the `package` method:
200+
```python
201+
import ffmpeg_streaming
202+
from tqdm import tqdm
203+
204+
# initialize the tqdm object
205+
bar = tqdm(total=100)
206+
last_per = 0
207+
208+
def progress(percentage, ffmpeg):
209+
# update the progress bar
210+
global last_per
211+
if last_per != percentage:
212+
bar.update(percentage - last_per)
213+
last_per = percentage
214+
215+
216+
(
217+
ffmpeg_streaming
218+
.hls(video)
219+
.format('libx264')
220+
.auto_rep()
221+
.package('/var/www/media/videos/hls/hls-stream.m3u8', progress=progress)
222+
)
223+
224+
# close the progress bar
225+
bar.close()
226+
```
198227
### Saving Files
199228
There are two ways to save your files.
200229

@@ -219,10 +248,10 @@ It can also be null. The default path to save files is the input path.
219248
.package(progress=progress)
220249
)
221250
```
222-
**NOTE:** If you open a file from a cloud and do not pass a path to save the file to your local machine, you will have to pass a local path to the `save` method.
251+
**NOTE:** If you open a file from a cloud and do not pass a path to save the file to your local machine, you will have to pass a local path to the `package` method.
223252

224253
#### 2. To Clouds
225-
You can save your files to a cloud by passing an array of cloud configuration to the `package` method.
254+
You can save your files to a cloud by passing a tuple of cloud configuration to the `package` method.
226255

227256
In **[this page](https://video.aminyazdanpanah.com/python/start/clouds?r=save)**, you will find 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.
228257

@@ -322,7 +351,7 @@ import ffmpeg_streaming
322351
.hls('https://www.aminyazdanpanah.com/PATH/TO/DASH-MANIFEST.MPD')
323352
.format('libx264')
324353
.auto_rep(heights=[360, 240])
325-
.package('/var/www/media/hls-stream.mpd', progress=progress)
354+
.package('/var/www/media/hls-stream.m3u8', progress=progress)
326355
)
327356
```
328357

0 commit comments

Comments
 (0)