Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big endian fixes #308

Open
wants to merge 116 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
ab8ef3a
First merge of readd dash variant
Dec 16, 2016
82b8613
Revert to simple template
Dec 18, 2016
b716c44
Working version with split template in .h
Dec 18, 2016
fe33879
Splitting adpatationset and representation
Dec 18, 2016
ab5f44b
Video footer OK
Dec 18, 2016
427bc97
Split Adpatationset and representation for audio too
Dec 18, 2016
69710ee
write an quasi empty multivariant manifest
Dec 18, 2016
8af33ad
Add varname, ctxname - suffix
Dec 18, 2016
a39c7fd
Video variant working with argument in the configuration file
Dec 21, 2016
7a55c64
Add audio should work choosing etheir track
Dec 21, 2016
17256ce
Add an description/example on how it work
Dec 21, 2016
64de3c6
Fix dash nested in a way
Dec 22, 2016
1049d8a
Change the comment on the README about nested
Dec 22, 2016
fcfba1b
Remove unused variable
Dec 23, 2016
f95bfa7
Decode on cue point scte35
Apr 2, 2017
f784f79
Add preliminary support for onCuepoint support on dash
Apr 9, 2017
9852a07
Not needed
Apr 10, 2017
cf1d365
Add support for onCuepoint to emsg box
Apr 14, 2017
157f6e6
Add scte_event support ; seems working well
May 16, 2017
472b677
Update the readme
May 16, 2017
8a4b642
Indentation in markdown :/
May 16, 2017
dad6035
Grr
May 16, 2017
0c53af1
Better level loging
May 17, 2017
f7e94c1
Some fix and hack for dahsjs
May 19, 2017
56e907b
Some cleaning
May 26, 2017
095ccc9
Add max flag to ensure the manifest was only write once
ut0mt8 Jun 1, 2017
72cfb17
Authors ?
ut0mt8 Jun 1, 2017
9951c17
Add a todolist
ut0mt8 Jun 1, 2017
025ac8a
Better not write max flag
ut0mt8 Jun 1, 2017
bdb6418
Fix case when chain amf handler
ut0mt8 Jun 6, 2017
5949267
Add switch to not add inbandeventstream when ad_markers is not enabled
ut0mt8 Jun 13, 2017
fc899f3
Some clarification and fix for elemental live
ut0mt8 Jun 26, 2017
d58ec7d
Fix timestamp mess with elemental server
ut0mt8 Jun 27, 2017
ed48ca3
Revert change to something working
ut0mt8 Jun 30, 2017
3ffc69e
Initial test of new variant version
ut0mt8 Jun 30, 2017
128d4fd
OK same file for now :/
ut0mt8 Jun 30, 2017
a2cb484
Working version with segment file ?
ut0mt8 Jun 30, 2017
bec65e8
Working version :)
ut0mt8 Jun 30, 2017
f76af36
Revert this pseudo fix as Elemental Live is definitively out of sync
ut0mt8 Jul 10, 2017
c89d54b
Merge branch 'dev' of https://github.com/sergey-dryabzhinsky/nginx-rt…
ut0mt8 Aug 7, 2017
86171ee
Prelimaniry stuff to handle end marker, fix non scte oncuepoint
ut0mt8 Oct 16, 2017
9374981
Small fix on timestamp delta
ut0mt8 Oct 18, 2017
361e40a
Another try fixing timestamp mess
Oct 20, 2017
9484952
First try handling ad continuation message
ut0mt8 Oct 23, 2017
59e9a20
End marker round two, and simplification
ut0mt8 Oct 25, 2017
cf617af
Add template for segment timeline with repetition
ut0mt8 Apr 25, 2018
1306475
Add repetition to manifest in order to reduce their size
ut0mt8 Apr 26, 2018
4a9e289
Merge remote-tracking branch 'upstream/dev' into dev
ut0mt8 Apr 26, 2018
5dc33e7
Add a fallback in scte logic
ut0mt8 Apr 26, 2018
3ad4e88
Better including start and end of the current fragment
ut0mt8 Apr 26, 2018
eed82c4
Also add repetition for audio in variant/master manifest
ut0mt8 Apr 27, 2018
7612f6b
Preleminary work on aes-ctr ; mess for now
ut0mt8 Apr 27, 2018
9add183
Correct signature of function
ut0mt8 Apr 27, 2018
fe48d3d
Let's try a shorter version
ut0mt8 May 1, 2018
b216121
Not mp4 specific so...
ut0mt8 May 1, 2018
21df9eb
Print counter in hex to debug
ut0mt8 May 1, 2018
c66c132
Change sample structure
ut0mt8 May 4, 2018
e2fa640
populate these fields
ut0mt8 May 4, 2018
23738a8
Add function to increment 8bytes IV
ut0mt8 May 6, 2018
f2068e1
Add some initialisation to iv
ut0mt8 May 7, 2018
af388c9
Signalisation mess round one saiz saio and senc
ut0mt8 May 10, 2018
0911590
Hope this is correct; saio offset to first iv in senc
ut0mt8 May 10, 2018
f3e2d56
Fix iv allocation and increment
ut0mt8 May 11, 2018
f05f65b
Change key for test
ut0mt8 May 11, 2018
aafe3a4
Read key from file specified in dash_cenc_key configuration parameter
ut0mt8 May 13, 2018
e0b1293
Some debug to see everything is ok
ut0mt8 May 13, 2018
97e7ba9
Initial try to signaling encv
ut0mt8 May 14, 2018
4c0c874
Add encrypted audio sig
ut0mt8 May 15, 2018
ab0f53e
Well not in the good box location
ut0mt8 May 15, 2018
7e2dd30
Grmbl I known this will happen ;/
ut0mt8 May 15, 2018
c9f7f6d
renaming aes_ctr to cenc
ut0mt8 May 16, 2018
eb9f3af
Good old fashioned c
ut0mt8 May 16, 2018
c5b3833
Need a struct to pass kid/pssh information to mp4 init
ut0mt8 May 17, 2018
405392d
some progress on sig / argh
ut0mt8 May 20, 2018
200eaba
Add content protection in manifest yupi
ut0mt8 May 22, 2018
64daef9
Add consistancy check
ut0mt8 May 23, 2018
d347814
Bug fixing thnak you Jacob
ut0mt8 May 24, 2018
04a1ebc
Let's go for sub sample...
ut0mt8 May 25, 2018
98e036e
Begin impleme of sub sample
ut0mt8 May 27, 2018
d8bf80b
Working sub-sample ?
ut0mt8 May 28, 2018
4c8171a
well very close but...
ut0mt8 May 29, 2018
1a55c30
Magic number :)
ut0mt8 May 29, 2018
012c945
Yupi working
ut0mt8 May 30, 2018
def8fb4
Fix where there is no variant
ut0mt8 May 30, 2018
d7be1fb
Real base64 encoding
ut0mt8 May 30, 2018
1eb019f
Preliminary support for widevine
ut0mt8 Jun 1, 2018
f810844
Add configuration for widevine
ut0mt8 Jun 3, 2018
82ed592
near the end
ut0mt8 Jun 3, 2018
cdcbf33
Use ngx default function
ut0mt8 Jun 3, 2018
540d45c
A bit of refacto
ut0mt8 Jun 4, 2018
11c1d55
Yurray
ut0mt8 Jun 4, 2018
820a234
Correct %V madness
ut0mt8 Jun 5, 2018
ebec59d
Refacto
ut0mt8 Jun 7, 2018
2ab001d
Better but good enough
ut0mt8 Jun 7, 2018
ee32286
Better
Jun 7, 2018
17cd0df
better static alloc
ut0mt8 Jun 9, 2018
1444985
Ok go for wdv pssh in init segment
ut0mt8 Jun 9, 2018
c4b5213
Clarification
ut0mt8 Jun 9, 2018
6006e83
MSPR first try
ut0mt8 Jun 9, 2018
12cfd11
Up2date todo
ut0mt8 Jul 9, 2018
5fc7573
Add mspr in init
ut0mt8 Jul 9, 2018
089921e
New readme
ut0mt8 Jul 10, 2018
c7c96e3
Add DRM file :)
ut0mt8 Jul 12, 2018
7db1076
md file
ut0mt8 Jul 12, 2018
9b4fed5
Clarity
ut0mt8 Jul 12, 2018
12698a9
Add some doc and time_hack
ut0mt8 Oct 10, 2018
b42863f
More doc
ut0mt8 Oct 10, 2018
f8ec83d
Litte documentation fix
ut0mt8 Oct 10, 2018
ef40588
Link
ut0mt8 Oct 10, 2018
97aa4eb
clarification
ut0mt8 Oct 10, 2018
c0e7c00
Typo
ut0mt8 Oct 10, 2018
df4113f
ngx_rtp_cenc.c: move ngx_{config,core}.h to top
cotequeiroz Dec 6, 2018
f0ea623
Merge pull request #13 from cotequeiroz/include-order
ut0mt8 Dec 7, 2018
5b06d1c
arut's e0e278bc7fedd6f7465648d1d20df1a8422d60bf [removed endian-depen…
May 13, 2020
7fb255e
arut's 205664d8c5e040a61b36ae0b74ddf17bc16d2150 [fixed sending protoc…
May 13, 2020
96ffb76
More LE/BE compatibility
May 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,10 @@ Fork author:

Contacts:
[email protected]

Fork ot the fork author:
Raphael Mazelier
Paris, France

Contacts:
[email protected]
32 changes: 32 additions & 0 deletions DAI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

## AD Insertion markers

nginx-rtmp module can interpret ad insertion markers message sent by encoder in amf rmtp message.
It then extract the information and write it in an emsg box at the begining of the next chunk.
The emsg box contains the relative start time of the ad-break, its duration, and possibly some metadata.
Enabling ad_marker also add the following inband event in the manifest.
This is the responsability of the player to watch this event, and to treat it.

```
<InbandEventStream schemeIdUri="urn:scte:scte35:2013:xml" value="1" />
```

Options to enable ad marker processing are :

```
dash_ad_markers off|on_cuepoint|on_cuepoint_scte35;
```

- on_cuepoint is the simple variant (without scte message)
- on_cuepoint_scte35 is the scte35 variant with program_id metadata

```
dash_ad_markers_timehack off|on;
```

- off implement the standard timing as described in reference documentation
- on implement a hack on the start time. This is need to be more resilient. Warning this need a patched version of your player. (currently this is what is test and in production with a one line patch on dashjs)

Currently there is only elemental encoder tested and compliant.

See [here](https://theyosh.nl/speeltuin/dash/dash.js-2.0.0/samples/ad-insertion/) for the original examples and inspiration.
80 changes: 80 additions & 0 deletions DRM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

## DRM Common Encryption

This fork give the possibility of packaging dash "protected" stream.
Concretely it implement the minimal requirement of "common-encryption" as described in ISO/IEC 23001-7:2015, Information technology — MPEG systems technologies — Part 7: Common encryption in ISO Base Media File Format files - 2nd Edition.
You can read a brief description here : "https://w3c.github.io/encrypted-media/format-registry/stream/mp4.html#bib-CENC"

### How to use it :

You need at least to enable common_encryption and provide one key and one key id with the following directives :

```
dash_cenc on; # enable common encryption on all stream in this block
dash_cenc_kid XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; # 16 bytes KEY-ID in hex
dash_cenc_key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; # 16 bytes KEY in hex
```

It enable automatically Clear-Key pseudo DRM. (use it only for testing purpose)

Currently the are two real DRM supported : Widevine and Microsoft Playready.

For widevine you need the following directives in addition :

```
dash_wdv on; # enable widevine signalling
dash_wdv_data AAAAbHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAA... ; # base64 encoded widevine pssh
```

For playready you need the following directives in addition (you can use both widevine and playready together with the same kid:key pair):

```
dash_mspr on; # enable playready signalling
dash_mspr_data AAACsHBzc2gAAAAAmgTweZhAQoarkuZb4Ih...; # base64 encoded playready pssh
dash_mspr_kid AAATH/7xxxfUbpB8mhqA==; # base64 encoded playready kid
dash_mspr_pro kAIAAAEAAQCGAjwAVwBSAE0ASABFAEEARA...; # base64 encoded playready PRO (Playready Object)
```

### Implementation :

_TLDR;_ This was quite an adventure

The implementation is based on the ISO_IEC_23001-7_2016 normative document.
I also took lot of inspiration on kaltura nginx-vod module.

It implement the minimal requirement of the norm, the 'cenc' scheme, AES-CTR mode full sample and video NAL Subsample encryption.

Audio track are encrypted in full sample mode with AES-CTR.

Video track are encrypted in sub sample mode, assuming one NALU per frame, using enough clear text size at the beginning of the frame to keep the NAL header in clear. (the module does not analyse NAL Headers).

The clear size is rounded to make encrypted size of data a multiple of the AES-CRT block size.

The implementation allow only one KID:KEY couple used for all tracks.

The implementation use 64bits IVs.

### Conformity :

This implementation have been tested with and known working :

Clearkey :
- Firefox: dashjs/shakaplayer
- Chrome: dashjs/shakaplayer

Widevine :
- Firefox: dashjs/shakaplayer
- Chrome: dashjs/shakaplayer

Playready:
- Edge : dashjs/shakaplayer

Bitmovin player seem also to work.

### Thanks:

- Thanks to all the opensource communauty.
- Special thanks to Eran Kornblau from Kaltura, Joey Parrish, and Jacob Timble.



Loading