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
You can pass a local path of video(or a supported resource) to the method(`hls` or `dash`):
51
51
```python
52
52
video ='/var/www/media/videos/video.mp4'
53
53
```
54
54
55
-
For opening a file from a supported FFmpeg resource such as `http`, `ftp`, `pipe`, `rtmp` and etc. please see **[FFmpeg Protocols Documentation](https://ffmpeg.org/ffmpeg-protocols.html)**
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)**
**NOTE:** You cannot use HEVC(libx265) and VP9 formats for HLS packaging.
144
144
145
-
#### Encrypted HLS
145
+
#### DRM (Encrypted HLS)
146
146
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)
147
147
148
148
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:
149
149
150
+
##### Single Key
151
+
The following code generates a key for all TS files.
**NOTE:** It is very important to protect your key on your website using a token or a session/cookie(****It is highly recommended****).
172
+
173
+
##### 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).
175
+
```python
176
+
import tempfile
177
+
from os.path import join
178
+
from random import randrange
179
+
180
+
import ffmpeg_streaming
181
+
from ffmpeg_streaming.key_info_file import generate_key_info_file
**NOTE:** It is very important to protect your key(s) on your website using a token or a session/cookie(****It is highly recommended****).
210
+
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.
170
212
171
213
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.
172
214
@@ -276,7 +318,7 @@ A path can also be passed to save a copy of files to your local machine.
276
318
progress=progress)
277
319
)
278
320
```
279
-
**NOTE:** This option(Save To Clouds) is only for **[VOD](https://en.wikipedia.org/wiki/Video_on_demand)** (it does not support live streaming).
321
+
**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).
0 commit comments