Commit Graph

937 Commits

Author SHA1 Message Date
sr90 db5413ed7a
Write to buffer before writing to file for TS segments generation. (#790)
The refactoring is needed to address #554.
2020-07-04 15:18:30 -07:00
Weiguo Shao 540c0aaffb
Added AC-4 codec support (#795)
Closes #754.
2020-07-04 14:55:28 -07:00
Joe Foraci 6b036b9bb1
Support different IVs for each track (#793)
This is supported by allowing IV to be specified in the "key_info_string".

Fixes #543.
2020-06-25 20:37:50 -07:00
Jacob Trimble 1911c1beaa Add flag for extra PlayReady header data.
Fixes #756

Change-Id: I4fa6328480130675a0257fd2c6663d91729cf72c
2020-06-22 22:55:25 +00:00
Jacob Trimble 665e784cbd Move PSSH generation to EncryptionHandler.
The KeySource now only handles fetching the keys and loading any PSSH
info from the license; it will not handle generating new PSSH info
based on the config.

This will allow the PSSH generation to access to the full
EncryptionConfig so we can add additional options to it.

Issue #756

Change-Id: Ia67387aa3d5ec0d723b7f5f21fc517f64c840393
2020-06-22 22:51:44 +00:00
Jacob Trimble 51fe84f9d5 Provide better diffs for MP4 failures.
If the user has the GPAC MP4 tools installed, this will use that to
provide a better, text-based diff of the MP4 files.  This makes looking
at test failures much better than just "binary files differ".

Change-Id: Ifdca54c02226a9f0fe9ddcf9c6b28e960e568111
2020-06-10 17:12:24 +00:00
Zajcev Evgeny 8913dbda85
Mpeg1 Audio: Support for iso-bmff output (#780)
Issue #779.
2020-06-06 17:18:00 -07:00
Jacob Trimble f0107beb9e Make some of the test args better.
Change-Id: I473f3318c6913e78f60a19166a54f7c873078b73
2020-06-04 15:05:40 -07:00
Jacob Trimble 719668aa1c Fix output in Python3 when tests fail.
Change-Id: Icd7552cee1336c10fe42f9f0bae175171347d369
2020-06-04 14:59:40 -07:00
Jacob Trimble 7e41937bb1 Consolidate key system enums.
There were several enum types that all were used for key systems.  This
combines them into one to make it more clear and only needing to update
one.  This also uses a bit field to specify multiple key systems instead
of using a std::vector.

Change-Id: Ia88039835492a5bd47f449ba4b76187046deeec0
2020-06-04 17:19:18 +00:00
Weiguo Shao 4f068bfaa8
Support DD+JOC in DASH and HLS (#775)
Spec: ETSI TS 102 366 V1.4.1
HLS: https://developer.apple.com/documentation/http_live_streaming/hls_authoring_specification_for_apple_devices/hls_authoring_specification_for_apple_devices_appendices
DASH: https://github.com/Dash-Industry-Forum/DASH-IF-IOP/issues/268

Closes #753.
2020-06-03 22:02:49 -07:00
KongQun Yang f51e98c422 Fix possible incorrect resolutions with avc3
The resolution values are uninitialized when parsing AVC decoder
configuration record if it does not contain parameter sets (SPS/PPS),
thus they could contain undefined values.

Fixes #750.

Change-Id: I6d54ec9f8740acd45a67b4b7d69031e097fbacc1
2020-06-03 22:59:30 +00:00
KongQun Yang 1b262b5784 Fix failures with latest gpylint
Change-Id: Id80000b530b0582b907730db9311075a7f5307fa
2020-06-03 22:59:22 +00:00
Zajcev Evgeny 98a9d1baf6
Support for MPEG-1 Audio in mpeg2ts I/O and packed-audio output (#778)
Implemented according to https://www.datavoyage.com/mpgscript/mpeghdr.htm.

Closes #779.
2020-06-02 17:32:19 -07:00
Alen Vrečko 15934d66c0
H265: Fixed inaccurate parsing of ref pic list modification (#773)
Fixes #717: playback issue of HEVC content with cbcs encryption in AVplayer.
2020-05-24 11:51:42 -07:00
yokoyama10 ca47cd7a0d
Fixed build error with Python 3 (#765)
Add parentheses to print methods in `generate_license_notice.py`.
2020-05-06 11:21:23 -07:00
sr90 7aefbeb27f
Adding check for creating captions with dash_only and hls_only. (#761)
Fix the problems in the previous CL for #651.
2020-04-29 17:39:12 -07:00
Sergio Garcia Murillo dba798798b
Prevent seg fault when finalizing empty segment (#759)
Fixes #757.
2020-04-25 14:09:48 -07:00
Tim Lansen 8e113af215
[DASH] Include <mspr:pro> alongside to <cenc:pssh> for PlayReady (#749)
Configurable under flag --include_mspr_pro_for_playready. True by default.

Closes #743.
2020-04-17 10:20:03 -07:00
sr90 fbcc8f31e3
Consider DASH stream descriptor field "roles" for WebVTT text streams. (#740)
Fixes #708.
2020-03-26 23:16:07 -07:00
sr90 4bfa603b52
[DASH] Support TrickPlay using separate trick play specific streams (#736)
Closes #732.
2020-03-24 12:15:30 -07:00
Joey Parrish 962baf0286 Fix reading WebVTT from a pipe
Opening a named pipe can block until both ends are open, and we cannot
control when the other end will be open.  Ideally, we would always
open files in a thread so that Packager can be used with piped inputs
from naive applications without a potential deadlock.

This change will defer opening WebVTT files until the parser Run()
method is called from a thread.  This way, WebVTT files being sent in
from a pipe will never be able to block the main thread.

Previously, files were opened on the main thread before calling the
parser constructor, passing the open file to the constructor as an
argument.  I also tried doing it in the parser's InitializeInternal()
method, but that is also called from the main thread.

Change-Id: I54cc68ed9d48a8dc697829119be84d4065b1ae1c
2020-03-19 20:25:07 -07:00
Joey Parrish 9a3ea747a4 Fix python style errors
Change-Id: I78d387329cf4d9b4bead30e4df5d684b31ef104e
2020-03-19 15:50:25 -07:00
sr90 55349aa4c8
Adding --allow_codec_switching (#726)
To allow adaptive switching between different codecs.

Closes #542.
2020-03-17 19:33:44 -07:00
Abhay Sundaram 28537034e8
Fix git not found error on Windows when running gclient (#728)
It happens if `git` is not installed as a standard alone application, but as a shell command.

Fixes #724.
2020-03-13 09:22:12 -07:00
Tomohiro IKEDA c576814d30
Clean up descriptions in mpd command line flags (#730)
Remove the 'Exclusive' statements on --mpd_output and --output_media_info as they
can already work together.
2020-03-11 10:25:33 -07:00
sr90 a1dd82d478
Support dash_only and hls_only parameters (#721)
This allows conditional stream descriptors which apply to DASH or HLS only.

Closes #651.
2020-03-06 10:19:47 -08:00
KongQun Yang 055c67888b Add an option to allow write |mvex| before |trak|
Under command line flag --mvex_before_trak.

This is needed to workaround Android MediaExtractor bug which
requires |mvex| to appear before |trak|.

Closes #711.

Change-Id: Id41d71af5c0016f59023dda6408bbf502e12ac55
2020-02-28 02:10:08 +00:00
KongQun Yang 4028bf727b Allow specifying protection pattern for pattern encryption
Added --crypt_byte_block, --skip_byte_block to allow users to specify
protection pattern other than 1:9 for pattern based encryption scheme,
e.g. cbcs and cens.

Closes #710.
b/147307451

Change-Id: I9f64a7639170c737f138572689b28d17286325c7
2020-02-28 00:50:58 +00:00
sr90 1ca873f453
[DASH] Support signalling of last segment number (#713)
Per https://dashif.org/docs/DASH-IF-IOP-v4.3.pdf 4.4.3.6 Signalling the last segment number in Period, there are three ways to signal the last segment number:

  a. Use the lmsg signalling as defined in clause 4.4.3.5.
  b. Use the Segment Timeline with @r value greater or equal to 0.
  c. Add a Supplemental Descriptor with @schemeIdUri set to http://dashif.org/guidelines/last-segment-number with the @value set to the last segment number.

We do not support (a). This change adds support for (c) when Segment Timeline (b) is not used, i.e. when Representation has constant duration (could be approximate).

Under flag --dash_add_last_segment_number_when_needed (disabled by default).
2020-02-24 23:12:53 -08:00
KongQun Yang ce932f68a2 Change AV1 cbcs to protect all bytes of decode_tile structure
AV1-ISOBMFF spec is updated recently to use start alignment instead of
end alignment for cbcs:

for the protected scheme cbcs:
- BytesOfProtectedData SHALL start on the first byte and end on the
  last byte of the decode_tile structure (including any trailing bits).
- A subsample SHALL be created for each tile, even if its size is less
  than 16 bytes.
- ...

cenc protection scheme is not affected.

Closes #698.

Change-Id: Ic83a478fb2602d830c30daf3206a1c2d2c238a08
2020-02-11 22:15:11 +00:00
KongQun Yang 624b2ca725 Fix possible compilation errors with gcc
Remove custom constructors, which is no longer needed with C++11. Use
C++ struct zero initialization instead.

Fixes #686.

Change-Id: I512da9f23a250e8b9ebf8bb8e0a39ad0f822d0d3
2020-02-11 05:46:27 +00:00
KongQun Yang b900565a0f Support Dolby Vision backward compatible profiles
Added Dolby Vision backward compatible signalling, i.e. for Dolby Vision
profile 8, both base codec without Dolby Vision and HDR codec with Dolby
Vision are signalled.

This is achieved by using a new MuxerListener implementation
MultiCodecMuxerListener, which wraps multiple child MuxerListeners and
is able to delegate to the child MuxerListeners based on the codecs in
the stream.

Closes #341.

Change-Id: I1967bb1ed503087cdd011c364e5fb5647d516ca4
2020-02-11 05:24:09 +00:00
Daniel Cantarín 1ed7de268d
Fix timestamp truncated to 32 bits in TS segment with $Time$ in template
Fixes #701.
2020-02-01 18:37:26 -08:00
Daniel Cantarín 7aab7a8b50
Add --hls_media_sequence_number to support custom value in HLS
HLS uses the EXT-X-MEDIA-SEQUENCE tag at the start of a live playlist in
order to specify the first segment sequence number. This is because any
live playlist have a limited number of segments, and they also keep
updating with new segments while removing old ones. When a player refreshes
the playlist, this information is important for keeping track of segments
positions.

When the packager starts, it naturally starts this count from zero. However,
there are many situations where the packager may be restarted, without this
meaning starting this value from zero (but continuing a previous sequence).
The most common situations are problems in the encoder feeding the packager.

With those cases in mind, this parameter allows to set the initial
EXT-X-MEDIA-SEQUENCE value. This way, it's possible to continue the sequence
number from previous packager run.

Closes #691.
2020-01-31 10:25:19 -08:00
KongQun Yang ff5f3f3abc Call WSAStartup once for every new socket
Some users are seeing problems with only one WSAStartup call.

WSAStartup can be called more than once:
https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-wsastartup

Fixes #643.

Change-Id: I81e0e7979d6a586da452984a96a8557b7b3ce7f6
2019-11-20 14:00:51 -08:00
Tomohiro IKEDA 0b53b40428 Change --generate_static_mpd to --generate_static_live_mpd (#672) 2019-11-15 11:53:47 -08:00
Vladimir Kazakov 981515e6c8 Generate correct PlayReady PSSH data when AES-CBC encryption is used
Fixes #602.
2019-11-15 11:48:48 -08:00
KongQun Yang 1bcaf0a835 Add an end to end test for non square pixels
Issue #663.

Change-Id: Iaba52f0fc6c97d413e973f9a3d8c74cf8c83aa03
2019-10-23 18:41:18 +00:00
KongQun Yang cb8b27e491 Properly initialize crypto engine to enable HWAES
Call CRYPTO_library_init to properly initialize crypto engine, which
enables AES-NI (Hardware AES) if it is supported by CPU.

Also added a performance benchmark test.

Closes #198.

Change-Id: I962a2da588d2f4f6cbe00c83ecc9a832db0e6042
2019-10-22 21:37:12 -07:00
KongQun Yang c80f053ba2 Roll boringssl/src fc9c67599..76918d016
Also roll_boringssl.py script is also adjusted to work with latest
boringssl.

Disable ASM compilation on Windows x64 which fails to compile. It also
means there are no HW AES on Windows x64.

Issue #198.

Change-Id: Ib7e8ff506f014c8c733f1882eeeddbe34fa28511
2019-10-23 04:32:33 +00:00
KongQun Yang 0342adb132 Fix possible packager hangs when reading mp4 from FIFO
For MP4 files, mp4 parser tries to open and read the same file again
to handle trailing MOOV box.

Open FIFO again may result in packager hang.

Update the code to only attempt to load MOOV for local regular files,
as FIFO and remote files are unseekable anyway.

Fixes #664.

Change-Id: Ib286d2876d202cd5a248ffe70b13589b3cc74bc9
2019-10-21 18:49:52 -07:00
KongQun Yang 7973c5396f Replace Dolby Vision test content
Issue #341

Change-Id: I530b0768341e352f6ee0a1326540cd5712f01638
2019-10-09 21:34:53 +00:00
KongQun Yang 4f14a6f973 [HLS] Always set FRAME-RATE attribute
Although FRAME-RATE is optional per HLS specification, but per HLS
Authoring Specification for Apple Devices (https://apple.co/30n90DC):
  Each EXT-X-STREAM-INF tag MUST have a FRAME-RATE attribute.

Also, iOS and TVos refuse to play the content if VIDEO-RANGE is
present but FRAME-RATE is missing.

Issue #632, #634.

Change-Id: Ica282f023a7e8538f7b506094e2286840cf5c193
2019-10-09 21:20:32 +00:00
KongQun Yang b70da0ed93 Add --quiet to suppress LOG(INFO) outputs
Closes #661.

Change-Id: Ic75479fba4f8dc26146b42b85ab95af6151302b6
2019-10-08 10:20:51 -07:00
KongQun Yang ab8fa87d18 [HLS] Always signal Dolby Vision as PQ
Issue #341.

Change-Id: I9665ba032b1e069500d866281cb8569ce59876f9
2019-10-04 16:19:07 -07:00
KongQun Yang 0f15ce149b [HLS] Support FRAME-RATE attribute
Calculate FRAME-RATE from sample duration as in the DASH solution.

Right now calculated frame-rate may not be accurate in some scenarios,
so we avoid setting the attribute in HLS unless it is more than 30
fps. We will set it unconditionally once it is fixed.

Fixes #634.

Change-Id: I87b6e9a047d959ae88dd4dcb2b4786527ba5c9fc
2019-10-04 22:50:34 +00:00
KongQun Yang 3f909fa551 [HLS] Support HDR signaling, i.e. VIDEO-RANGE attribute
- Parse and extract transfer_characteristics from H264/H265 VUI
  parameters.
- Set VIDEO-RANGE attribute in HLS according to HLS specification:
  https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-02#section-4.4.4.2
- Also added an end to end test.

Fixes #632.

Change-Id: Iadf557d967b42ade321fb0b152e8e7b64fe9ff3e
2019-10-04 22:50:20 +00:00
KongQun Yang 8029004c6b Add HEVC Dolby Vision support
- Add relevant FOURCCs for Dolby Vision.
- Parse DOVIDecoderConfigurationRecord (dvcC, dvvC) to generate
  Dolby Vision codec string.
- Propagate Dolby Vision configs (dvcC, dvvC, hvcE) from Demuxer
  to Muxer.
- Add a Dolby Vision end to end test.

Support for backward compatibility signaling in DASH and HLS will be
added in a later CL.

Issue #341

Change-Id: If1385df5f48e04b59cb7661130bea48e26b453bf
2019-10-03 23:04:15 +00:00
Phillip Baxter 00fde07bf7 Fix non standard channel layout AAC audio with PCE encoding
Latest version of FFmpeg encodes non standard channel layout, e.g. 5.1(side), in AAC using PCE.

This is now supported with the below changes:
- Allow channel_configuration in ADTS header to be 0, as the cctual channel layout is specified 
  in PCE.
- Add GetFrameSizeWithoutParsing to determine the frame size before actually parsing the frame.
- Skip and resume later if not the whole frame is available. 
- Also ensure that the next frame starts with a proper sync word.

Fixes #598.
2019-10-01 10:15:58 -07:00