Commit Graph

1389 Commits

Author SHA1 Message Date
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
KongQun Yang a86a697d8d Add more loggings for GAPs
Fixes #474.

Change-Id: I32f097c8a0e8d3381a276e6a130cb888e3ddd7f6
2019-09-11 00:02:52 +00:00
KongQun Yang 3ec2975e36 Log socket error code on failure
Issue #643.

Change-Id: I8adfb9910e1e43294738abb7783a64645a4f42c3
2019-09-10 21:44:28 +00:00
Tomohiro IKEDA b8ee20df1d Improve ConvertToADTS function performance (#639)
Remove the extra data copying.
2019-09-10 13:15:17 -07:00
Herlon Aguiar 443519aeb3 Update general_encryption_options with a better clear_lead description (#638) 2019-09-06 13:24:24 -07:00
KongQun Yang 9029e2d34f [HLS] Fix live chunks not deleted with $Time$ in segment template
Store and use the segment start time in the original time scale to
delete old segments, instead of storing it in seconds, as the segment
file name is generated using the time with the time scale.

Fixes #625.

Change-Id: I7524d597b1ffc081dd1399d6fb3ea47c13502881
2019-08-20 17:43:46 +00:00
KongQun Yang faa9a3ea68 [HLS Packed Audio] Truncate timestamp to 33 bits
Fixes #629.

Change-Id: Iadbbb28de051bf6b8b08561c152a3c1c2014aa80
2019-08-08 14:31:05 -07:00
KongQun Yang edd776eea2 Move DerivePixelWidthHeight to video_util.cc
Change-Id: I14df8b39fb58078635f08377f4177a45e341be79
2019-08-05 11:56:20 -07:00
KongQun Yang c257113e08 Support parameter sets in stream (avc3, hev1 etc)
- Parses parameter set NAL units in the samples.
- Calculate pixel width and height from track width and height.

Fixes #621, #627.

Change-Id: Ic1e120dccbd220b01168f7bf4effeaa43f95b055
2019-08-05 17:38:34 +00:00
Tomohiro IKEDA f810fea0ef Cleanup condition on `bind` error (#624) 2019-08-01 17:32:28 -07:00
KongQun Yang 78941394dd Add flag FLAGS_disable_peer_verification
To allow disable peer verification.

Issue #623.

Change-Id: I0781d10dea3ef6c92f0139aa1fa4949449c5da36
2019-07-22 16:33:32 -07:00
Tomohiro IKEDA 2c51dcc601 Code cleanup: no "if return else return" (#611)
- Unify code format
- Low nest level
2019-07-15 11:03:42 -07:00
KongQun Yang 3c26dfbd53 Estimate target duration in bandwidth calculation from initial blocks
We used to use the target segment duration provided by the user.
Unfortunately that does not work for iframe only playlist which
the target duration is effectively equal to the GOP duration.

In the new approach, we estimate the target duration from the initial
few blocks (10 blocks right now).

Fixes #610.

Change-Id: Ie8bf943e157149ca7ed3b9382fe0a1088d0774e2
2019-07-11 17:45:55 -07:00
KongQun Yang 15a4f0553c Add a new utility function for XmlNode
Add AddDescriptor function to add new descriptor nodes with schemeIdUri
and value fields.

Change-Id: I423e642939fdef99764a67da74d4efd4d32aefe8
2019-07-01 20:29:11 +00:00
KongQun Yang 796974d2a1 [DASH] Support custom Accessibility and Role elements
Add dash_accessibilities stream descriptor, which is a semi-colon
separated list of accessibility_scheme_id_uri=value. It is optional.

Add dash_roles stream descriptor, which is a semi-colon separated
list of strings. It is optional.

Closes #565.

Change-Id: Idb1c20bb410fdd016db07e11fe507c102a3dd8ea
2019-06-13 15:43:32 -07:00
KongQun Yang 0a2b43939c [HLS] Replace hev1 in codec with hvc1 and avc3 with avc1
And also dvhe with dvh1.

Apple's specification does not recommend video formats with the
parameter sets stored in the samples.

It also fails mediastreamvalidator checks and some Apple devices /
platforms refused to play.

See https://apple.co/30n90DC 1.10.

Replaced with the corresponding formats with the parameter sets stored
in the sample descriptions instead.

Fixes #587.

Change-Id: Ic5d3f6fde115b1d09d1dcac32cef5fe0ad246aa0
2019-05-22 13:17:27 -07:00
KongQun Yang adc3c804a9 Support absolute file path in playlist_name
Fixes #585.

Change-Id: Icd0bc97a0b210c22a2dab716542d993a69d3d081
2019-05-13 18:13:37 -07:00
KongQun Yang ac616f36e4 SimpleHlsNotifierTest: Use value parameterized tests for rebase tests
Change-Id: Ie734624f6335b01b9bf989e1432ddb4fdf2e4b8b
2019-05-07 23:55:23 +00:00
KongQun Yang 4b8e9a662f Fix problems that target duration is not set in mpd/hls params
We have logics in bandwidth calculation to ignore segments that is
smaller than half of target duration. The logic does not have any
effect right now as the target duration in mpd/hls params is always
zero.

This change will set target duration in mpd/hls params, thus it can fix
part of issue #581 as the last segment which is less than half of
target duration.

Issue #581.
Fixes #498.

Change-Id: Ieb2dbf4da9fc72a7b9de802cda4294f1954d29b4
2019-04-30 22:41:14 +00:00
KongQun Yang b85e5c9368 Use segment duration in buffer depth calculation
Segment start,end time was used previously, which could result in
problems if there are discontinuity in the streams. E.g. if the
stream has timestamp, 10000, 10001, 10002 and then next segment
comes in with timestamp 1. With the previous logic, all the segments
would remain in the time shift buffer until after 10000 segments
even with a small time shift buffer depth of 10.

This could also happen when timestamp wraps around, which could
happen during long time of live streaming.

This change will also be useful to support multi-period live DASH.

Fixes #563.

Change-Id: Ie078d76c6e4af13ade9ad46191c8e3529069ed4d
2019-04-17 22:47:10 +00:00
KongQun Yang fa2c4409a6 Add a flag --video_feature for Widevine
Change-Id: Id9ab958add1239972a4f94faf5e65cffe64444be
2019-04-16 07:55:08 -07:00
KongQun Yang fa7a6d967a Allow CMAF file extensions
Extensions cmfv, cmfa, cmft are now supported and recognized as
CONTAINER_MOV.

Fixes #574.

Change-Id: I728feefaba91f862966af49c780bbac8068722f2
2019-03-26 12:27:46 -07:00
KongQun Yang 26bc55503d Allow reserved NAL units in H264/H265
This is needed for Dolby Vision as Dolby Vision uses NAL unit type 62
to carry private information.

Issue #341.

Change-Id: Ib3f06d8f36ef3d89c33162dd74c012a0c3a805e5
2019-03-18 17:40:25 -07:00
KongQun Yang 5d80895923 Update README.md on AC-3 / E-AC-3 in TS support
Issue #557.

Change-Id: I1bf692f5be5999d3378deccbeab364c54fbf3a94
2019-02-27 23:32:54 +00:00
KongQun Yang d850befb72 Refactor and Cleanup Descriptor classes
- Define BaseDescriptor and generic read / write operations.

- Define descriptors: ESDescriptor, DecoderConfigDescriptor,
  DecoderSpecificInfoDescriptor, SLConfigDescriptor.
  DecoderSpecificInfoDescriptor and all other descriptors can now
  handle arbitrary length size, not limiting to 64 byte for
  DecoderSpecificInfoDescriptor, which was placed to limit
  ESDescriptor length size to one byte.

- Now DecoderConfigDescriptor is able to handle reading and writing
  of all fields including buffer_size_db, which was not handled
  earlier.

Fixes #536.

Change-Id: Ia8a775f8bf6e90e3343a85f0e643bc44cd017c7a
2019-02-27 22:26:10 +00:00
KongQun Yang fcfc843a2e Use IV from Widevine key server if available
Fixes #555.

Change-Id: Ic077f97884a0c3d26159cd44791298bdd400068d
2019-02-27 22:17:21 +00:00
KongQun Yang a529d4677d Add pssh tool in docker image
Issue #550.

Change-Id: Id3fc6317789609b5d31cc671b2a361f8a8739f77
2019-02-19 23:06:05 +00:00
KongQun Yang 57046be126 Make packager_test.py work with python 3.5
Addresses binary/str conversion problems like
'can't use a string pattern on a bytes-like object'.

With this change, packager_test.py will work with any version of python
after python2.5.

Fixes #553.

Change-Id: I02066942e4bcdddc1db1daf761abab4cc46169a9
2019-02-13 19:07:56 +00:00
KongQun Yang de534f8550 Make packager_test.py work with python 3.0
Use logging instead of print.

Fixes #553.

Change-Id: I46b9a5bb9bb5d4cb03ddd94163905aebc4b4e9dd
2019-02-01 22:52:59 +00:00
KongQun Yang 72c4797a59 Update pssh-box.py to remove external dependencies
With the update, the script needs to be launched from
out/{Debug,Release} directory.

Also updated docs to make it clear how to use the tool.

Fixes #538.

Change-Id: I37b71afc33e3b73ff5232e43d79c52ffa5859d57
2019-01-31 00:49:12 +00:00
srebrnyp 22af5533b1 Add crypto_period_seconds to Widevine key request (#545)
Add crypto_period_seconds to Widevine key request

When using key rotation with Widevine DRM, a key server has to know
the duration of crypto period to relate generated keys to the media
playback time. This helps the server to provide relevant keys to
a client during license request.

Closes #544.
2019-01-24 10:39:54 -08:00
KongQun Yang 6d6db76c80 Retry file deletion if it fails
The file deletion could fail if it is still held by the web server.

This CL adds retry logic to retry the deletion.

Closes #533.

Change-Id: Ib42ed8db11f32897a29e3b58c1be89d05f5dd034
2019-01-02 15:23:27 -08:00
KongQun Yang 5bf8ad5ed5 Update the CHANGELOG for v2.3.0
Change-Id: I8cf0591672d580a4bb3245170f1f34b0b7149946
2018-12-21 00:39:42 +00:00
KongQun Yang 4640cac4eb Reduce Docker image size
This is achieved with these techniques:
- Use Alpine as the base image, which is only ~5MB.
- Use docker's multi-stage build to keep only the result binaries in
  the final image.

The new image is ~15MB after this change.

Also updated Dockerfile to use the current checkout code instead of always
sync from the latest.

Also added a .dockerignore file to ignore temporary build artifacts.

Closes #535.

Change-Id: I3c90805ebba40295e69241214ed6d7adbde465b8
2018-12-20 13:31:03 -08:00
KongQun Yang 3f7ecd4e29 Workaround extra AUD in the access unit
VLC seems to generate access units with extra AUDs. In #526, the below
sequence is seen:

  AUD | SPS | PPS | SPS | PPS | AUD | SEI | SEI | SEI | IDR_SLICE

Previously we exit early when seeing AUD, which results in delayed
processing of the access unit.

The behavior is changed to continue processing the following NAL units
to workaround the content issue.

Closes #526.

Change-Id: I80f571c0711c6db1337eb393fce36fae5432b6c5
2018-12-15 00:32:06 +00:00
KongQun Yang 89611a526b [HLS] Support audio only master playlist
Generate an audio only master playlist if there are no videos and
subtitles.

We do not support mixing audio only EXT-X-STREAM-INF with video
EXT-X-STREAM-INF right now.

Fixes #461.

Change-Id: I999b335ad7abbe183ffcb0f5d471948977c2772f
2018-12-13 23:52:35 +00:00
KongQun Yang cd7640a5bd Support trick play with Ad cues
Fixes #528.

Change-Id: I558285a2fae3d2048ef7cefabcd4761e35be47a8
2018-12-13 00:27:11 +00:00
KongQun Yang 9819adf9d6 Fix error code message for trick play error
Issue #528.

Change-Id: Ib0752960db94910038290b235f64b360cd4f2f00
2018-12-13 00:26:55 +00:00
KongQun Yang d97e531465 Set output directory permission appropriately
The new directory permission is set to the permission of the last
existing directory in the file path. If none of the directory exists,
it is default to 0755.

Previously we use base::CreateDirectoryAndGetError(), which always sets
the new directory permission to 0700, which is not what we want.

Fixes #499.

Change-Id: Iee9429d5e63ada9588f74ff20d3cce28a1a6437b
2018-12-11 23:17:15 +00:00
KongQun Yang 492f55a018 Use upper case for Marlin uuid
This is required by Marlin although it is against uuid specification
(ITU-T X.667).

Issue #525.

Change-Id: I1592d6abe24ae09bfbb2f80931a330ee6fd61eb5
2018-12-05 13:03:25 -08:00
KongQun Yang c5fa32f0eb Return an error when seeing duplicated outputs
Fixes #497.

Change-Id: Ic3f5352b6774fbd488e6d688df4c8a5053732549
2018-11-27 22:38:48 +00:00
KongQun Yang 4b97a6d8a2 Add support for --default_text_language
It allows users to override the default language for text tracks.

If not specified, --default_language applies to both audio and text
tracks.

Issue #430.

Change-Id: I86a9baba2072be27b6661fa7b65a8bc8b6adb3cc
2018-11-26 13:42:58 -08:00