Skip to content

Commit fd94517

Browse files
update readme
1 parent 751e0ba commit fd94517

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ You can pass a local path of video(or a supported resource) to the method(`hls`
5252
video = '/var/www/media/videos/video.mp4'
5353
```
5454

55-
For opening a file from a supported resource such as `http`, `ftp`, `pipe`, `rtmp` and etc. please see **[FFmpeg Protocols Documentation](https://ffmpeg.org/ffmpeg-protocols.html)**
55+
Please see **[FFmpeg Protocols Documentation](https://ffmpeg.org/ffmpeg-protocols.html)** for opening a file from a supported resource such as `http`, `ftp`, `pipe`, `rtmp` and etc.
5656

5757
**For example:**
5858
```python
@@ -148,7 +148,7 @@ The encryption process requires some kind of secret (key) together with an encry
148148
You must specify a path to save a random key to your local machine and also a URL(or a path) to access the key on your website(the key you will save must be accessible from your website). You must pass both these parameters to the `encryption` method:
149149

150150
##### Single Key
151-
The following code generates a key for all TS files.
151+
The following code generates a key for all TS files in a stream.
152152

153153
```python
154154
import ffmpeg_streaming
@@ -171,7 +171,7 @@ url = 'https://www.aminyazdanpanah.com/PATH_TO_KEY_DIRECTORY/random_key.key'
171171
```
172172

173173
##### Key Rotation
174-
The code below, allows you to encrypt each TS file with a new encryption key. This can improve security and allows for more flexibility. You can also modify the code to use a different key for each set of segments(i.e. if 10 TS files has been generated then rotate the key) or you can generate a new encryption key at every periodic time(i.e. every 10 seconds).
174+
This technique allows you to encrypt each TS file with a new encryption key. This can improve security and allows for more flexibility. You can also use a different key for each set of segments(e.g. if 10 TS files have been generated then rotate the key) or you can generate a new encryption key at every periodic time(e.g. every 10 seconds).
175175
```python
176176
import tempfile
177177
from os.path import join
@@ -185,11 +185,9 @@ url = 'https://www.aminyazdanpanah.com/PATH_TO_KEY_DIRECTORY/key_rotation'
185185
key_info_file_path = join(tempfile.gettempdir(), str(randrange(1000, 100000)) + '_py_ff_vi_st.tmp')
186186
k_num = 1
187187

188-
189188
def k_format(name, num):
190189
return str(name) + "_" + str(num)
191190

192-
193191
def progress(per, ffmpeg):
194192
global k_num
195193
if ".ts' for writing" in ffmpeg:
@@ -208,7 +206,7 @@ def progress(per, ffmpeg):
208206
```
209207
**NOTE:** It is very important to protect your key(s) on your website using a token or a session/cookie(****It is highly recommended****).
210208

211-
**NOTE:** However HLS supports AES encryption, that you can encrypt your streams, it is not a full DRM solution. If you want to use a full DRM solution, I recommend to try **[FairPlay Streaming](https://developer.apple.com/streaming/fps/)** solution which then securely exchange keys, and protect playback on devices.
209+
**NOTE:** However HLS supports AES encryption, which you can encrypt your streams, it is not a full DRM solution. If you want to use a full DRM solution, I recommend trying **[FairPlay Streaming](https://developer.apple.com/streaming/fps/)** solution which then securely exchange keys, and protect playback on devices.
212210

213211
See **[HLS examples](https://github.com/aminyazdanpanah/python-ffmpeg-video-streaming/tree/master/examples/hls)** and **[HLS options](https://ffmpeg.org/ffmpeg-formats.html#hls-2)** for more information.
214212

@@ -220,7 +218,7 @@ import ffmpeg_streaming
220218

221219

222220
def progress(percentage, ffmpeg):
223-
# You can update a field in your database
221+
# You can update a field in your database or you can log it to a file(e.x. logging.debug(ffmpeg))
224222
# You can also create a socket connection and show a progress bar to users
225223
sys.stdout.write("\rTranscoding...(%s%%)[%s%s]" % (percentage, '#' * percentage, '-' * (100 - percentage)))
226224
sys.stdout.flush()
@@ -238,7 +236,6 @@ def progress(percentage, ffmpeg):
238236
![transcoding](https://github.com/aminyazdanpanah/aminyazdanpanah.github.io/blob/master/video-streaming/transcoding.gif?raw=true "transcoding" )
239237

240238
#### Show a progress bar using **[tqdm](https://github.com/tqdm/tqdm)**
241-
You can get realtime information about transcoding by passing a callable method to the `package` method:
242239
```python
243240
import ffmpeg_streaming
244241
from tqdm import tqdm
@@ -266,6 +263,8 @@ def progress(percentage, ffmpeg):
266263
# close the progress bar
267264
bar.close()
268265
```
266+
**NOTE:** Please see **[tqdm documentation](https://github.com/tqdm/tqdm)** for more information.
267+
269268
### Saving Files
270269
There are two ways to save your files.
271270

0 commit comments

Comments
 (0)