Commit Graph

92 Commits

Author SHA1 Message Date
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 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 273ab09f05 Support HLS characteristics
Add hls_characteristics stream descriptor, which is a colon or semi-colon
separated list of strings. It is optional.

Fixes #430.

Change-Id: Ifcf79316e68768ff065891933de565cd0ff32ec4
2018-11-26 20:02:43 +00:00
KongQun Yang 1742e03471 Drepcate --num_subsegments_per_sidx
This flag was designed for two purpose:
- Grouping fragments into subsegments, achieving three level hierarchy:
  segment < subsegment < fragment.
- Indicate whether to generate 'sidx' box in media segments (when the
  value is set to a negative number).

There are no practical use case for the first purpose. Removing it to
simplify the code and reduce the confusion.

Introduce another flag --generate_sidx_in_media_segments for the second
purpose.

Change-Id: I4be7cd42662fb324c1158b978e05768ee49dd048
2018-07-02 21:59:14 +00:00
KongQun Yang b4256bf040 [Cleanup] Use int64_t for time for consistency
Change-Id: I408f3fe7c98320be4e43ca2a5bcb9b22cc8a2012
2018-06-29 22:53:06 +00:00
KongQun Yang 6e4820eedc [Ad Insertion] Support one file per Representation per Period
Allow the output file to contain template identifiers like $Number$,
$Time$ etc. Unlike the actual template used in SegmentTemplate, the
identifiers in output will be populated before pushing to the DASH
manifest.

Issue: #384

Change-Id: Ife1caadb6fccd32167fa1bc83fe2afcb2d2ad087
2018-05-31 23:59:21 +00:00
KongQun Yang 192ef2a0ac Update MuxerListeners to support multiple OnMediaStart/End
This is needed to support one file per representation per period where
there will be multiple content files generated.

Issue: #384

Change-Id: Ib7af750edf864d99075b8da4f3640217a5a94302
2018-05-25 20:43:34 +00:00
KongQun Yang 0af2c5cdcf Integrate PackedAudioWriter
Closes #342.

Change-Id: I2fb4a651ad90448ab226b386c92c94e11ff9f9a8
2018-05-16 18:12:42 -07:00
KongQun Yang 39beb99d6c Implemented PackedAudioWriter
Issue #342.

Change-Id: Ic1379b00e38f818460f24ad57122ca22c5b5285a
2018-05-16 21:52:18 +00:00
KongQun Yang b5a73fc1d5 Refactor ProtectionSystemSpecificInfo class to struct
This is in preparation of supporting entitlement license API, where
common encryption server may return concatenated PSSHs directly.

Refactored ProtectionSystemSpecificInfo into a struct containing
concatenated PSSHs. This will make it easier to pass PSSHs around.

Also, most of the time, users of ProtectionSystemSpecificInfo do
not care what is in PSSH; so moved PSSH box parsing and building out
of ProtectionSystemSpecificInfo.

b/78171767

Change-Id: I1c4d5e7e23efd2f7d4b2b9704378323112e47f00
2018-05-11 00:10:07 +00:00
KongQun Yang a78c3d3224 Use MessageDifferencer for proto comparison
Change-Id: Ifa4c56d09a7e9c5c71a37ec70f81d546fe58f0a9
2018-05-08 21:30:50 +00:00
KongQun Yang b2932d5a33 Fix bitrate for DASH on-demand profile too
Removed the logic in MuxerListener to estimate bandwidth from file
size and duration, since it is not compliant to the spec.

MpdBuilder will estimate bandwidth from segment size and duration
if bandwidth is not specified in MediaInfo.

Here is the statement from DASH spec (23009-1:2014):

Consider a hypothetical constant bitrate channel of
bandwidth with the value of this attribute in bits per second
(bps). Then, if the Representation is continuously delivered
at this bitrate, starting at any SAP that is indicated either by
@startwithsap or by any Segment Index box, a client can
be assured of having enough data for continuous playout
providing playout begins after @minbuffertime *
@bandwidth bits have been received (i.e. at time
@minbuffertime after the first bit is received).
For dependent Representations this value specifies the
bandwidth according to the above definition for the
aggregation of this Representation and all complementary
Representations.

Fixes #376.

Change-Id: I0fddce39e709d0cded0a4c9ae59adbbcc97ec5ea
2018-04-24 23:25:02 +00:00
KongQun Yang 60d7a4b2d5 Make MediaPlaylist accept HlsParams as contructor param
And for HlsNotifier and SimpleHlsNotifier as well.

This will make it easier to add preserve_segments_outside_live_window
param in a later CL.

Change-Id: I86d464fe247e04574158a0a76e39d8a122960ae4
2018-04-23 18:29:38 -07:00
Aaron Vaage 30b5fdf19f Add Text Codec To Codec String
This change has the hls master playlist add the text codec string
to the list of codecs in a variant.

Bug: 72942756

Change-Id: Ib25bb2064a291d10d7b1d261a4307991df62220c
2018-02-28 19:23:36 +00:00
KongQun Yang b647c6731c Support KeyFrame events in TS and MP4
Issue: #287

Change-Id: I7c50853c7cc61c5fadbb620f44f7574a27dc2b68
2018-02-02 14:05:50 -08:00
KongQun Yang 570a2d1a15 Support 'iframe_playlist_name' stream descriptor
Issue: #287

Change-Id: I484761dfacadce05175d16c4c12454f0ed932579
2018-02-02 22:00:18 +00:00
KongQun Yang 82735be58d Support key frame events in MuxerListener and HlsNotifier
Issue: #287

Change-Id: I33b91b73988fc40e113bd2e627d08f549a7e3dc5
2018-02-02 00:00:53 +00:00
Aaron Vaage 44847a0737 Changed Group Name Fallback
If no hls group name is given, we would default to "audio" but as
we are working to support text, this won't make sense to see
GROUP="audio" on a text stream.

Instead default to "default-audio-group" for audio streams. A specific
text default will be added later.

Bug: #205

Change-Id: Iefc8bfd35708286619d0004348294d98f2c38482
2018-02-01 10:24:58 -08:00
KongQun Yang c9fb2b4a85 Use start_time from CueEvent in NotifyCueEvent
Instead of using next segment start time, as CueEvent time may not
align with segment start time exactly.

Also remove the incorrect DCHECK in ChunkingHandler when processing
kScte35Event.

Change-Id: I4987740c99c8d0d25c9b99bddc5e557e45d308e0
2018-01-20 01:18:38 +00:00
Aaron Vaage c57da2b42d Create Muxer Listener Factory
Moved muxer listener creation into a factory so that it can be
initialized once and then the factory only needs to be passed
around rather than all the parameters.

Change-Id: Ibf7df66c08debddbe6f6ff8995e7910b9ad17f3f
2018-01-10 18:59:11 +00:00
Aaron Vaage 4ecb567daf Changed muxer listener to use "default"
Changed muxer listener to use "default" instead of {}
when defining its constructor and destructor in its
header file.

Change-Id: I3c80e808aa624293c3d7720ac6a47b470a663312
2018-01-08 17:52:04 +00:00
Aaron Vaage c88fe54553 WebVTT Output
This change introduces handlers to output WebVtt text files. There is
only one output but there is a common base to support others.

WebVttOutputHandler which handles all communication with other handlers
and WebVttSegmentedOutputHandler is responsible for listening for events
and choosing when and where to write cues and headers.

Bug: 36138902
Change-Id: I2b13a94262554398e66fee8cf024aa21041ddbab
2018-01-05 00:05:48 +00:00
KongQun Yang db74d6756e Propage CueEvent to MpdNotifier/HlsNotifier
Change-Id: I9828af11a28300d20cc8742251bbe1b4ebfdbad1
2018-01-04 18:25:03 +00:00
Haoming Chen feeb7361ff Clean up #ifndef in packager/media. (#310) 2017-12-19 16:56:36 -08:00
KongQun Yang 8e96dd3b37 Address gcc build failures in some platforms
Seeing some failures on some platforms when compiled with clang
disabled:
  GYP_DEFINES="clang=0" gclient runhooks

Several changes to make it work:
1. Mark packager code with packager_code=1 in GYP definitions.
2. Disable a few checks in non-packager code, which we do not have
   direct control: dangling-else, deprecated-declarations,
                   unused-function
3. Fix the relevant errors in packager code.
4. Revert HAVE_STROPTS_H in curl config which is not available in
   all linux distributions.

Fixes #286
Fixes #293

Change-Id: I729b41f99403c5ad9487c6cc4a7dc06f6323cef8
2017-12-07 11:45:26 -08:00
Aaron Vaage a9d957e7f0 Move Muxer Creation To Own Method
Moved all the code to do with creating a muxer to its own function to
help isolate it.

Change-Id: Ib259da7aaa41d325632d5f9bb3d54ae9df8d0e31
2017-09-11 12:23:07 -07:00
Ivan L. Isaev 1706b0bc3a multi-manifest (e.g. DASH + HLS) output support
Fixes #262
2017-08-29 13:42:33 -07:00
KongQun Yang 4e82ab13bd Consolidate Mp4OutputParams into MuxerOptions
Change-Id: I533e40ef9eb84453c15cbdb7ef42fc85bef5125d
2017-08-18 11:57:34 -07:00
KongQun Yang b451d3a7ca Consolidate various playlist_type types
Change-Id: If6fafc0867e7e1f3cd2ed612617e91c7cb144f20
2017-07-21 20:43:14 +00:00
KongQun Yang 61c58724ec Remove size parameter in OnMediaEnd
Derive file size from media ranges instead.

Also fix subsegment range reporting for WebM (internal variable,
no output affected).

Change-Id: I5f8152dff4c2cd5fbae5550992b86a669e278f7b
2017-07-21 20:42:44 +00:00
KongQun Yang eb98a87f7d Move packager/media/file to packager/file
Change-Id: Idc0d75a7ceab7c8ce460ef896fdefdec088124bb
2017-07-17 12:08:28 -07:00
Rintaro Kuroiwa d096f4b485 HLS byte range
- Use byte range format if segment_template is not set in MediaInfo.
- Change HlsNotifier::NotifyNewSegment() to take start byte offset.
- Change HlsNotifyMuxerListener to cache the segment information if
  MuxerOptions::segment_template is set.

Change-Id: Ida1b8b9198acc5c43e3a5d9a641c78c81bc9a6ac
2017-07-12 17:19:56 -07:00
Rintaro Kuroiwa 0dfdace280 Change MuxerListener::OnMediaEnd to take ranges
- Changed OnMediaEnd() to take (sub)segment ranges.
- Define a structure to pass the ranges.
- This requires muxers to "cache" the segment ranges but in most cases,
  they already do it, e.g. 'sidx' for mp4.

Change-Id: I16b974c1f0f54ca658cc6dbe605efff84a3f52eb
2017-07-11 15:59:16 -07:00
KongQun Yang e56d1faaf0 Make HLS with key rotation work
- Remove the TS key rotation not supported check as there is nothing
  to be done for key rotation in TS for SAMPLE-AES.
- Fix IV updated problem in new segments even if crypto period does
  not change.
- Avoid duplicate EXT-X-KEY tags if it does not change.
- Make EXT-X-DISCONTINUITY-SEQUENCE match with number of removed
  EXT-X-DISCONTINUITY.
- Added end to end test for HLS with key rotation.

Change-Id: I73cb82e9f5575fcdf63ee643228efe78e6766302
2017-06-29 21:03:36 +00:00
KongQun Yang b4aa34b803 Support live and event HLS playlists
Closes #114

Change-Id: I6440383c3dc022fba5a9926839f79b9ed8a51f55
2017-06-24 01:09:32 +00:00
Haoming Chen 27abb208aa Remove the trick_play_factor in media_info.proto.
- Use the playback_rate instead.

Change-Id: I341c39de1c28aacebab5b31aa013bcbbcc2fa9d0
2017-05-17 22:10:49 +00:00
Haoming Chen da8877d8a2 Rename trick play rate to trick play factor.
- Add a "tpf" abbreviation in stream descriptor for
  trick_play_factor.

Change-Id: Ia09313bb9778456b53bdb0a8cc46d2ba8caa2ac2
2017-05-17 21:51:34 +00:00
Haoming Chen 4ba5bec660 Integrate trick play.
- Add trick play adaptation in mpd. This addresses #178.

Change-Id: Id6cc08c788eda074c261d0274768051837b84541
2017-05-09 13:33:11 -07:00
Rintaro Kuroiwa f3e91301c2 Widevine HLS new key format media event side
- This change has the muxer listener side changes.
- Also changed SetContentProtectionFields() to take vector for
  default_key_id so that MuxerListener subclasses don't need to convert
  it to string.

Change-Id: I8832848a0c7e34b84e2b4e6baeba364861900ff1
2017-04-05 11:12:57 -07:00
Rintaro Kuroiwa 92280bf214 Full vtt in mp4 path
Change-Id: I7f49dbfed188ff7a451b0b4fbd6947590e8935d1
2017-03-29 18:52:25 +00:00
Kongqun Yang 277c5b23c0 Allow generating avc3 / hev1 from TS and Wvm files
Added a flag --strip_parameter_set_nalus. When enabled, parameter
set NAL units, SPS/PPS for H264 and SPS/PPS/VPS for H265, are stripped
from frames when converting NAL byte stream (AnnexB stream) to NAL
unit stream, which generates avc1/hvc1; otherwise they are not
stripped, and avc3/hev1 is generated.

Parameter set NAL units should not be stripped if they are varying
in the frames otherwise the frames may fail to be decoded.

The flag is enabled by default as we don't usually see varying
SPS/PPS/VPS and it is more space efficient with them stripped.

Set --strip_parameter_set_nalus=false to disable the flag if there
are varying SPS/PPS/VPS in the frames. This addresses #206.

Change-Id: I34bde6f33069f9f77d51a510b39f58a0f0e141aa
2017-03-23 13:53:14 -07:00
Kongqun Yang 160700b452 Integrate ChunkingHandler
Also moved MediaHandler output validation to Initialize instead.

This CL also addresses #122 with consistent chunking.

Change-Id: I60c0da6d1b33421d7828bcb827d18899e71884ce
2017-03-16 20:54:36 +00:00
Kongqun Yang 6235352bf4 Fix mpd duration not set in static live manifest
Closes #201

Change-Id: Ie9ab58ec58e1b135931a6576fb46145454b0f049
2017-02-11 00:52:32 +00:00
Kongqun Yang 97fbaaa567 Replace scoped_refptr with std::shared_ptr
Change-Id: Ie8ea66e78c42c7387a97bb1abc331c636be11aa4
2017-01-26 02:20:47 +00:00
Kongqun Yang 80c54a533a Update cmd flags to support static mpd with live profile
- Deprecated command line flags --profile and --single_segment.
  'segment_template' in stream descriptors implies live profile
  and non-single segment.
- Added flag --generate_static_mpd_for_live_profile to generate
  static mpd for live profile; if not set, dynamic mpd will be
  generated.

Close #142

Change-Id: I78879297ed118f0f246c4753a16ad125bd6b5e4f
2017-01-13 20:00:10 +00:00
Kongqun Yang 5aaae303e8 Part one of supporting live profile with static mpd
- Added two new fields in MpdOptions: dash_profile and mpd_type
- Updated MpdBuilder to support LiveProfile with static mpd
- Command line arguments will be updated in the next CL

Issue #142

Change-Id: Ibd35e5c9e1b1ef98043392e3f04a0af4700135c1
2017-01-13 19:59:49 +00:00
Rintaro Kuroiwa e7c0dbf09d Ensure some method calls NotifyEncryptionStart()
- If OnEncryptionStart() is called OnMediaStart(), someone should be
  calling NotifyEncrytionStart().

Fixes #169

Change-Id: I597f317d2ddeb3091b7e9d238eb9695b4cc9c69d
2016-11-08 15:56:28 -08:00
Kongqun Yang 23f2913248 Update DEPS to fix mac build failure
Change-Id: I1cf95d5da8e3b950300cd61cd9286e957ef653ce
2016-08-19 13:49:41 -07:00
Kongqun Yang 644629c616 Replace scoped_ptr with std::unique_ptr
Change-Id: I1ed18bf876b6154d08a1f7913aa7e76c525451f9
2016-08-18 17:12:36 -07:00